!function (modules) { function __webpack_require__(moduleId) { if (installedModules[moduleId]) return installedModules[moduleId].exports; var module = installedModules[moduleId] = { exports: {}, id: moduleId, loaded: !1 }; return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), module.loaded = !0, module.exports } var installedModules = {}; return __webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.p = "", __webpack_require__(0) }([function (module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _Case = __webpack_require__(18), _Case2 = _interopRequireDefault(_Case), _CaseDeleteActivity = __webpack_require__(195), _CaseDeleteActivity2 = _interopRequireDefault(_CaseDeleteActivity), _container = null, _caseSysSerial = 0, _uiLists = null, _stationId = 0, _userSysSerial = null, _userFullName = "", _userGroupIds = [], _isAdmin = !1, _isGuest = !1, _allowAssetsViewing = !1, _allowAssetsPlaying = !1, _allowAssetsDownloading = !1, _allowCaseDeleting = !1, _allowCaseWithEvidenceDeleting = !1, _allowCaseSharing = !1, _allowEditCaseId = !1, _allowEditCaseTitle = !1; window._dataModified = !1; var _showSendEmailUpdatetoWatchers = !1, _editUserGroup = !1, getCaseDetailAndRenderUI = function (id) { showLoaderOnVP(); var url = "/Case/GetCaseDetail"; 1 == _isGuest ? (url = "/Public/Case/GetCaseDetail", url = url + "?id=" + id + "&stnId=" + _stationId + "&ESyndicationId=" + _ESyndicationId) : url = url + "?id=" + id + "&stnId=" + _stationId, makeAjaxRequest({ type: "GET", url: url, onComplete: function (resp) { var json = JSON.parse(resp.responseText); 1 == json.success ? renderCaseUI(json) : showErrorMsg(json.msg), hideLoaderOnVP() } }) }, SaveCaseDetail = function (caseDetail, description) { showLoaderOnVP(), caseDetail.CaseAssets.length > 50 && showMsg("Tagging of Assets may take a while. Please wait."), makeAjaxRequest({ type: "POST", url: "/Case/SaveCaseDetail", params: { caseDetail: JSON.stringify(caseDetail), description: JSON.stringify(description) }, onComplete: function (resp) { var _isMerged = !1, json = JSON.parse(resp.responseText); 1 == json.success ? (window._dataModified = !1, _isMerged = json.isMerged, _caseSysSerial <= 0 && window.history.replaceState({}, document.title, "/Case/Detail?id=" + json.caseSysSerial), _isMerged && window.history.replaceState({}, document.title, "/Case/Detail?id=" + json.caseSysSerial), _caseSysSerial = json.caseSysSerial, showSuccessMsg("Data saved successfully !"), getCaseDetailAndRenderUI(json.caseSysSerial)) : showErrorMsg(json.msg), hideLoaderOnVP() } }) }, onCancel = function () { window._dataModified = !1, getCaseDetailAndRenderUI(_caseSysSerial) }, onStationChanged = function (stnId) { _stationId = stnId }, onDataChanged = function () { window._dataModified = !0 }, onSaveCase = function (caseDetail, description) { SaveCaseDetail(caseDetail, description) }, onShareCase = function (caseSysSerial, isShared, stationIntegrationMapping) { var askTitle = "Are you sure you want to"; askTitle += 1 == isShared ? " Unshare with " : " Share with ", askTitle += stationIntegrationMapping.IntegrationTypeName, askTitle += "?", showConfirmDialog({ msg: askTitle, callbackYes: function (arg) { var model = { caseSysSerial: caseSysSerial, isShared: !isShared, stationIntegrationMapping: stationIntegrationMapping }, params = { data: JSON.stringify(model) }; makeAjaxRequest({ type: "POST", url: "/Case/ShareCase", params: params, onComplete: function (resp) { var json = JSON.parse(resp.responseText); 1 == json.success ? showSuccessMsg("Data saved successfully !") : showErrorMsg(json.msg), hideLoaderOnVP() }, onError: function (resp) { showErrorMsg("Something went wrong") } }), getCaseDetailAndRenderUI(caseSysSerial) } }) }, getUserRightViaCaseUserGroups = function (caseUserGroups, CaseSubUserGroups) { var assignedGroups = caseUserGroups.filter(function (e) { return _userGroupIds.indexOf(e.AssignedUserGroup.Id) != -1 }), found_RW_Right = assignedGroups.find(function (e) { return "RW" == e.ACL || "DRW" == e.ACL }); if (null != found_RW_Right) return "RW"; var assignedSubGroups = CaseSubUserGroups.filter(function (e) { return _userGroupIds.indexOf(e.AssignedUserGroup.Id) != -1 }), found_SubGroup_RW_Right = assignedSubGroups.find(function (e) { return "RW" == e.ACL || "DRW" == e.ACL }); if (null != found_SubGroup_RW_Right) return "RW"; var found_R_Right = assignedGroups.find(function (e) { return "R" == e.ACL || "DR" == e.ACL }); return null != found_R_Right ? "R" : null }, renderCaseUI = function (json) { var caseDetail = json.caseDetail; _caseSysSerial <= 0 && (caseDetail.stationId = _stationId); var readOnlyMode = !1, IsDeleted = json.caseDetail.IsDeleted; if (1 == _isAdmin) readOnlyMode = !1; else if (_isGuest) readOnlyMode = !0; else if (_caseSysSerial > 0 && caseDetail.CreatedByUser.Id != _userSysSerial) if (readOnlyMode = !0, 1 == json.editAllCases) readOnlyMode = !1; else { var userRightViaCaseUserGroups = getUserRightViaCaseUserGroups(caseDetail.CaseUserGroups, caseDetail.CaseSubUserGroups); if ("RW" == userRightViaCaseUserGroups || 0 == _viewAllCasesReadOnly) readOnlyMode = !1; else if (null == userRightViaCaseUserGroups || "R" == userRightViaCaseUserGroups) { var assignedUser = caseDetail.CaseUsers.find(function (e) { return e.AssignedUser.Id == _userSysSerial }); readOnlyMode = null == assignedUser || "RW" != assignedUser.ACL } } IsDeleted && (readOnlyMode = !0); var sendEmailUpdatetoWatchers = !!caseDetail.SendEmailUpdatetoWatchers && caseDetail.SendEmailUpdatetoWatchers; ReactDOM.render(React.createElement(_Case2.default, { sysSerial: _caseSysSerial, station: _stationId, caseID: json.caseID, caseDetail: caseDetail, uiLists: _uiLists, userInfo: { userId: _userSysSerial, contextList: [], userFullName: _userFullName, isAdmin: _isAdmin, userGroupIds: _userGroupIds }, onSave: onSaveCase, onCancel: onCancel, onShare: onShareCase, readOnlyMode: readOnlyMode, isGuest: _isGuest, allowAssetsViewing: _allowAssetsViewing, allowAssetsPlaying: _allowAssetsPlaying, allowAssetsDownloading: _allowAssetsDownloading, allowCaseSharing: _allowCaseSharing, allowCaseDeleting: _allowCaseDeleting, allowCaseWithEvidenceDeleting: _allowCaseWithEvidenceDeleting, allowEditCaseId: _allowEditCaseId, allowEditCaseTitle: _allowEditCaseTitle, editUserGroup: _editUserGroup, onStationChanged: onStationChanged, onDataChanged: onDataChanged, isMergeDescriptionView: !1, sendEmailUpdatetoWatchers: sendEmailUpdatetoWatchers, showSendEmailUpdatetoWatchers: _showSendEmailUpdatetoWatchers, IsDeleted: IsDeleted }), _container) }, showCaseUI = function (container, id, uiLists, stationId, userSysSerial, userFullName, isAdmin, isGuest, allowAssetsViewing, allowAssetsPlaying, allowAssetsDownloading, userGroupIds, allowCaseDeleting, allowCaseWithEvidenceDeleting, allowEditCaseId, allowEditCaseTitle, viewAllCasesReadOnly, showSendEmailUpdatetoWatchers, editUserGroup, allowCaseSharing) { _container = container, _caseSysSerial = id, _stationId = stationId, _uiLists = uiLists, _userSysSerial = userSysSerial, _userFullName = escape(userFullName), _userGroupIds = userGroupIds, _isAdmin = isAdmin, _isGuest = isGuest, _allowAssetsViewing = allowAssetsViewing, _allowAssetsPlaying = allowAssetsPlaying, _allowAssetsDownloading = allowAssetsDownloading, _allowCaseDeleting = allowCaseDeleting, _allowCaseWithEvidenceDeleting = allowCaseWithEvidenceDeleting, _allowEditCaseId = allowEditCaseId, _allowEditCaseTitle = allowEditCaseTitle, _showSendEmailUpdatetoWatchers = !!showSendEmailUpdatetoWatchers && showSendEmailUpdatetoWatchers, _editUserGroup = editUserGroup, _allowCaseSharing = allowCaseSharing, getCaseDetailAndRenderUI(id) }, ShowDeleteActivityUI = function (container, sysSerial, caseID, readOnlyMode, allowCaseDeleting, allowCaseWithEvidenceDeleting, showButtonUI, showFromLister) { ReactDOM.render(React.createElement(_CaseDeleteActivity2.default, { caseSysSerial: sysSerial, caseID: caseID, readOnlyMode: readOnlyMode, allowCaseDeleting: allowCaseDeleting, allowCaseWithEvidenceDeleting: allowCaseWithEvidenceDeleting, showButtonUI: showButtonUI, showFromLister: showFromLister }), container) }; window.showCaseUI = showCaseUI, window.ShowDeleteActivityUI = ShowDeleteActivityUI, window.onbeforeunload = function () { if (window._dataModified === !0) return "Are you sure to leave this page. Any unsaved changes will be lost." } }, function (module, exports) { module.exports = React }, , , , , , function (module, exports) {/* object-assign (c) Sindre Sorhus @license MIT */ "use strict"; function toObject(val) { if (null === val || void 0 === val) throw new TypeError("Object.assign cannot be called with null or undefined"); return Object(val) } function shouldUseNative() { try { if (!Object.assign) return !1; var test1 = new String("abc"); if (test1[5] = "de", "5" === Object.getOwnPropertyNames(test1)[0]) return !1; for (var test2 = {}, i = 0; i < 10; i++)test2["_" + String.fromCharCode(i)] = i; var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n] }); if ("0123456789" !== order2.join("")) return !1; var test3 = {}; return "abcdefghijklmnopqrst".split("").forEach(function (letter) { test3[letter] = letter }), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, test3)).join("") } catch (err) { return !1 } } var getOwnPropertySymbols = Object.getOwnPropertySymbols, hasOwnProperty = Object.prototype.hasOwnProperty, propIsEnumerable = Object.prototype.propertyIsEnumerable; module.exports = shouldUseNative() ? Object.assign : function (target, source) { for (var from, symbols, to = toObject(target), s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) hasOwnProperty.call(from, key) && (to[key] = from[key]); if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++)propIsEnumerable.call(from, symbols[i]) && (to[symbols[i]] = from[symbols[i]]) } } return to } }, , , , , , , , , , , function (module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } var _mergeOptions = __webpack_require__(19), _mergeOptions2 = _interopRequireDefault(_mergeOptions), _objectAssign = __webpack_require__(7), _objectAssign2 = _interopRequireDefault(_objectAssign), _Header = __webpack_require__(21), _Header2 = _interopRequireDefault(_Header), _CoreInfo = __webpack_require__(23), _CoreInfo2 = _interopRequireDefault(_CoreInfo), _Description = __webpack_require__(24), _Description2 = _interopRequireDefault(_Description), _Assets = __webpack_require__(73), _Assets2 = _interopRequireDefault(_Assets), _Activity = __webpack_require__(190), _Activity2 = _interopRequireDefault(_Activity), _Users = __webpack_require__(193), _Users2 = _interopRequireDefault(_Users), _UserGroups = __webpack_require__(194), _UserGroups2 = _interopRequireDefault(_UserGroups), _constants = __webpack_require__(22), _CaseDeleteActivity = __webpack_require__(195), _CaseDeleteActivity2 = _interopRequireDefault(_CaseDeleteActivity), _MergeAssetDescriptionView = __webpack_require__(196), _MergeAssetDescriptionView2 = _interopRequireDefault(_MergeAssetDescriptionView), _isCaseAlreadyExist = (__webpack_require__(74), !1), _caseAccess = !1, _checkCaseIDAlreadyExist = function (caseId, sysSerial) { var url = "/Case/IsCaseExist"; showLoaderOnVP(), makeAjaxRequest({ params: { caseID: caseId, sysSerial: sysSerial }, type: "GET", timeout: 3e5, url: url, async: !1, scope: void 0, onComplete: function (resp) { var jsonResp = $.parseJSON(resp.responseText); _isCaseAlreadyExist = jsonResp.success, _caseAccess = jsonResp.caseAccessType, hideLoaderOnVP() } }) }, Case = React.createClass({ displayName: "Case", propTypes: { sysSerial: React.PropTypes.number.isRequired, station: React.PropTypes.number.isRequired, caseID: React.PropTypes.string.isRequired, caseDetail: React.PropTypes.object.isRequired, uiLists: React.PropTypes.object.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, onSave: React.PropTypes.func.isRequired, onCancel: React.PropTypes.func.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, isGuest: React.PropTypes.bool.isRequired, allowAssetsViewing: React.PropTypes.bool.isRequired, allowAssetsPlaying: React.PropTypes.bool.isRequired, allowAssetsDownloading: React.PropTypes.bool.isRequired, onStationChanged: React.PropTypes.func.isRequired, onDataChanged: React.PropTypes.func.isRequired, allowCaseDeleting: React.PropTypes.bool.isRequired, allowCaseWithEvidenceDeleting: React.PropTypes.bool.isRequired, isMergeDescriptionView: React.PropTypes.bool.isRequired, sendEmailUpdatetoWatchers: React.PropTypes.bool.isRequired, showSendEmailUpdatetoWatchers: React.PropTypes.bool.isRequired, IsDeleted: React.PropTypes.bool }, getInitialState: function () { return { station: null, caseDetail: null, oldCaseDetail: null, errors: [], incidentsList: [], watchersList: [], groupsList: [], isMergeDescriptionView: !1, sendEmailUpdatetoWatchers: !0, IsDeleted: !1 } }, onSave: function (e) { e.preventDefault(); var caseDetail = this._getChangedCaseDetail(!0); if (caseDetail.CaseComments = [], caseDetail.CaseHistories = [], !this.isValidCaseData(caseDetail)) return !1; var caseDescription = caseDetail.description; if (caseDetail.description = "", _checkCaseIDAlreadyExist(caseDetail.CaseID, caseDetail.sysSerial), _isCaseAlreadyExist) _caseAccess ? showErrorMsg("This Case ID already exists. You do not have rights to merge in that case. Please contact administrator!") : this.setState({ isMergeDescriptionView: !0, caseDetail: caseDetail }); else { var caseUsersDeactivated = caseDetail.CaseUsers.filter(function (e) { return 2 === e.AssignedUser.Status && e.AssignedUser.Id != caseDetail.CreatedByUser.Id }); if (caseUsersDeactivated.length > 0) { var deactivatedUsersName = ""; caseUsersDeactivated.map(function (user, index) { deactivatedUsersName += user.AssignedUser.FullName + "," }), deactivatedUsersName = deactivatedUsersName.replace(/,(?=\s*$)/, ""), showErrorMsg(String.format("Case cannot be save because of deactivated users in watchers list. Users are {0}", deactivatedUsersName)) } else this.props.onSave.apply(this, [caseDetail, caseDescription]) } }, onShare: function (e) { e.preventDefault() }, isValidCaseData: function (caseDetail) { this.refs.Header.refs.caseID.validate(), this.refs.Header.refs.title.validate(), this.refs.ErrorSummary.setErrors([]); var errors = [], stationId = caseDetail.stationId; stationId || errors.push({ msg: "Please Select Station" }); var title = $.trim(caseDetail.title); title.length < 3 && errors.push({ msg: "Title is required. Minimum 3 characters" }); var caseID = $.trim(caseDetail.CaseID); caseID.length < 3 && errors.push({ msg: "CaseID is required. Minimum 3 characters" }), 0 == caseDetail.CaseIncidents.length && errors.push({ msg: "At least one category must be selected" }), 0 != caseDetail.description.blocks.length && 0 != caseDetail.description.blocks[0].text.length || errors.push({ msg: "Description is required" }); var descriptionCheckResult = checkForValidInputContent(decodeURI(caseDetail.descriptionPlainText), "Description"); if (descriptionCheckResult && descriptionCheckResult.length > 0 && errors.push({ msg: "Invalid Description. Special Characters are not allowed." }), caseDetail.sysSerial <= 0 && 0 == caseDetail.CaseAssets.length && errors.push({ msg: "At least one Asset must be tagged to the Case" }), errors.length > 0) this.refs.ErrorSummary.setErrors(errors), setTimeout(function () { IrsaModulesUtil.scrollToElement($(".irsa-error-summary").get(0)) }, 300); else { var errorsInfo = IrsaModulesUtil.validateUserInputSection($(".user-input-section").first()); errorsInfo && errorsInfo.length > 0 && (errors = errorsInfo.map(function (m) { return { msg: m } })), this.refs.ErrorSummary.setErrors(errors), setTimeout(function () { IrsaModulesUtil.scrollToElement($(".irsa-error-summary").get(0)) }, 300) } return 0 == errors.length }, onCancel: function (e) { e.preventDefault(), showConfirmDialog({ msg: "Are you sure to cancel? Any unsaved changes will be lost.", callbackYes: function () { this.redirectToCaseLister() }, scope: this }) }, _getChangedCaseDetail: function (isForSave) { var _this = this, caseDetail = (0, _mergeOptions2.default)({}, this.state.caseDetail); caseDetail.title = this.refs.Header.state.title, caseDetail.prefix = this.refs.Header.state.prefix, caseDetail.CaseID = this.refs.Header.state.caseID; var _refs$CoreInfo$state = this.refs.CoreInfo.state, station = _refs$CoreInfo$state.station, status = _refs$CoreInfo$state.status, priority = _refs$CoreInfo$state.priority, severity = _refs$CoreInfo$state.severity, incidents = _refs$CoreInfo$state.incidents; caseDetail.stationId = station, caseDetail.status = status, caseDetail.priority = priority, caseDetail.severity = severity; new Date; caseDetail.CaseIncidents = incidents.map(function (e) { return _this._convertMultiSelectValueToCaseIncident(e) }); var rawDescription = this.refs.Description.refs.descriptionRTE.getEditorContent(); if (1 == isForSave) { caseDetail.description = rawDescription; var descriptionPlainText = this.refs.Description.getDescriptionAsPlainText(); caseDetail.descriptionPlainText = encodeURIComponent(descriptionPlainText) } else caseDetail.description = JSON.stringify(rawDescription); caseDetail.CaseAssets = this.refs.Assets.state.assets, caseDetail.CaseChildAssets = this.refs.Assets.state.childAssets; var usersRef = this.refs.Users; caseDetail.CaseUsers = usersRef.state.assignedUsers.map(function (m) { return { sysSerial: m.sysSerial, AssignedUser: { Id: m.value, FullName: m.label, Status: m.Status }, ACL: m.ACL, ACLComparer: m.ACLComparer } }); var userGroupsRef = this.refs.UserGroups; return caseDetail.CaseUserGroups = userGroupsRef.state.assignedGroups.map(function (m) { return { sysSerial: m.sysSerial, AssignedUserGroup: { Id: m.value, Name: m.label, PDId: m.PDId }, ACL: m.ACL, ACLComparer: m.ACLComparer } }), caseDetail }, onChangeIncidents: function (incidents) { var _this2 = this, caseDetail = (new Date, this._getChangedCaseDetail()); caseDetail.CaseIncidents = incidents.map(function (e) { return _this2._convertMultiSelectValueToCaseIncident(e) }), this.setState({ caseDetail: caseDetail }) }, getCaseInfoOnStationChange: function (stdId) { var result = {}; return makeAjaxRequest({ params: { stationId: stdId }, type: "GET", url: "/Case/getCaseInfoOnStationChange", async: !1, scropt: this, onComplete: function (resp) { var jsonResp = $.parseJSON(resp.responseText); 1 == jsonResp.success && (result = { stationDefaultUserGroups: jsonResp.defaultStationWatchers, caseGroupsList: jsonResp.caseGroupsList, caseUsersList: jsonResp.caseUsersList }) } }), result }, onChangeStation: function (value, stationPdId) { var _this3 = this, uiLists = this.props.uiLists, stationPrefixInfo = uiLists.casePrefixesForStations.find(function (e) { return e.StationId == value }), incidentsList = uiLists.incidentsList.filter(function (e) { return null == e.stationId || e.stationId <= 0 || e.stationId == value }), stationID = uiLists.stationList.find(function (e) { return e.value == value }).text, caseDetail = this._getChangedCaseDetail(); caseDetail.prefix = stationPrefixInfo.CasePrefix, caseDetail.stationId = value, caseDetail.Station = { Id: value, StationID: stationID, CasePrefix: stationPrefixInfo.CasePrefix }; var newDate = new Date, _newCaseId = caseDetail.prefix + "-"; _newCaseId += newDate.getUTCFullYear().toString(), _newCaseId += newDate.getUTCMonth() < 12 ? newDate.getMonth() + 1 : 1, _newCaseId += newDate.getUTCDate().toString(), _newCaseId += newDate.getUTCHours().toString(), _newCaseId += newDate.getUTCMinutes().toString(), _newCaseId += newDate.getUTCSeconds().toString(), _newCaseId += newDate.getUTCMilliseconds().toString(), this.props.userInfo.userId > 0 && (_newCaseId += this.props.userInfo.userId.toString()), _newCaseId += Math.floor(999 * Math.random() + 1).toString(); var PdId = stationPdId, result = this.getCaseInfoOnStationChange(value); this.refs.UserGroups.changeDefaultWatchersGroups(result.stationDefaultUserGroups, PdId), this.refs.Users.changeAssignedUsers(PdId), setTimeout(function () { caseDetail.CaseUserGroups = _this3.refs.UserGroups.state.assignedGroups.map(function (m) { return { sysSerial: m.sysSerial, AssignedUserGroup: { Id: m.value, Name: m.label, PDId: m.PDId }, ACL: m.ACL, ACLComparer: m.ACLComparer } }), caseDetail.CaseUsers = _this3.refs.Users.state.assignedUsers.map(function (m) { return { sysSerial: m.sysSerial, AssignedUser: { Id: m.value, FullName: m.label, Status: m.Status, PdId: m.PdId }, ACL: m.ACL, ACLComparer: m.ACLComparer } }) }, 100), showConfirmDialog({ msg: String.format("Your present caseID {0} would be changed to {1}. Do you want to change it?", caseDetail.CaseID, _newCaseId), callbackYes: function (arg) { caseDetail.CaseID = _newCaseId, this.setState({ caseDetail: caseDetail, station: value, incidentsList: incidentsList, watchersList: result.caseUsersList, groupsList: result.caseGroupsList }), this.props.onStationChanged(value) }, callbackNo: function (arg) { value = this.state.station, this.setState({ caseDetail: caseDetail, station: value, incidentsList: incidentsList, watchersList: result.caseUsersList, groupsList: result.caseGroupsList }), this.props.onStationChanged(value) }, scope: this }) }, _convertMultiSelectValueToCaseIncident: function (e) { return { sysSerial: e.sysSerial && e.sysSerial > 0 ? e.sysSerial : -1, IncidentId: e.value, Name: e.label, CreatedOn: e.CreatedOn ? e.CreatedOn : dt, CreatedOnTicks: e.CreatedOn ? e.CreatedOn.getTime() : dt.getTime(), CreatedByUser: e.CreatedByUser ? e.CreatedByUser : { Id: this.props.userInfo.userId, FullName: this.props.userInfo.userFullName } } }, onTaggedAssetsChange: function (taggedAssets, isNewAssetsAdded, isAssetDeleted, taggedChildAssets) { if (isNewAssetsAdded === !0) { var caseDetail = this._getChangedCaseDetail(), existingIncidents = [].concat(_toConsumableArray(caseDetail.CaseIncidents)); taggedAssets.map(function (e) { e.incidents.map(function (t) { var found = existingIncidents.find(function (c) { return c.IncidentId == t.IncidentId }); if (!found) { var incObj = (0, _objectAssign2.default)({}, t); existingIncidents.push(incObj) } }) }), caseDetail.CaseAssets = taggedAssets, null != taggedChildAssets && (caseDetail.CaseChildAssets = taggedChildAssets), caseDetail.CaseIncidents = existingIncidents, this.setState({ caseDetail: caseDetail }) } else if (isAssetDeleted === !0) { var _caseDetail = this._getChangedCaseDetail(); _caseDetail.CaseAssets = taggedAssets, this.setState({ caseDetail: _caseDetail }) } }, _getCaseIncidentsInMultiSelectFormat: function (caseIncidents) { return caseIncidents.map(function (e) { return { value: e.IncidentId, label: e.Name, sysSerial: e.sysSerial } }) }, componentWillMount: function () { var _props = this.props, caseDetail = _props.caseDetail, station = _props.station, uiLists = _props.uiLists, isMergeDescriptionView = _props.isMergeDescriptionView, caseIncsNotInMainIncList = caseDetail.CaseIncidents.filter(function (e) { return null == uiLists.incidentsList.find(function (a) { return a.value == e.IncidentId }) }), validIncsList = uiLists.incidentsList.filter(function (e) { return null == e.stationId || e.stationId <= 0 || e.stationId == station }); caseIncsNotInMainIncList.map(function (e) { validIncsList.push({ value: e.IncidentId, label: e.Name, StationId: station }) }); var evidenceGroupIds = caseDetail.CaseAssets.map(function (e) { return e.evidenceGroupId }), records = caseDetail.CaseChildAssets.filter(function (e) { if (evidenceGroupIds.includes(e.evidenceGroupId) === !1) return e }); records && records.length > 0 && records.forEach(function (e) { caseDetail.CaseAssets.push(e) }, this), this.setState({ station: station, caseDetail: caseDetail, oldCaseDetail: caseDetail, incidentsList: validIncsList, watchersList: uiLists.usersList, groupsList: uiLists.groupsList, isMergeDescriptionView: isMergeDescriptionView }) }, componentWillReceiveProps: function (nextProps) { var caseDetail = nextProps.caseDetail, station = nextProps.station, uiLists = nextProps.uiLists, isMergeDescriptionView = nextProps.isMergeDescriptionView, caseIncsNotInMainIncList = caseDetail.CaseIncidents.filter(function (e) { return null == uiLists.incidentsList.find(function (a) { return a.value == e.IncidentId }) }), validIncsList = uiLists.incidentsList.filter(function (e) { return null == e.stationId || e.stationId <= 0 || e.stationId == station }); caseIncsNotInMainIncList.map(function (e) { validIncsList.push({ value: e.IncidentId, label: e.Name, StationId: station }) }), this.setState({ station: station, caseDetail: caseDetail, oldCaseDetail: caseDetail, incidentsList: validIncsList, watchersList: uiLists.usersList, groupsList: uiLists.groupsList, isMergeDescriptionView: isMergeDescriptionView }) }, onSaveFromMergeDescription: function () { var caseDetail = this._getChangedCaseDetail(!0); if (caseDetail.CaseComments = [], caseDetail.CaseHistories = [], !this.isValidCaseData(caseDetail)) return !1; var caseDescription = caseDetail.description; caseDetail.description = "", this.props.onSave.apply(this, [caseDetail, caseDescription]) }, setMergeDescritionViewState: function () { this.setState({ isMergeDescriptionView: !1 }) }, exportAllAssets: function (type) { var isGuest = this.props.isGuest, Currenturl = new URL(window.location.href), searchParams = Currenturl.searchParams, EsyndicatedId = searchParams.get("ce"); null != EsyndicatedId && "" != EsyndicatedId || (EsyndicatedId = searchParams.get("E")); var EsyndicationId = ""; null != EsyndicatedId && "" != EsyndicatedId && (EsyndicationId = EsyndicatedId.replace(/\+/g, "|")); var exportType = type.toUpperCase(), _caseAssets = this.refs.Assets.state.assets, _caseId = this.state.caseDetail.sysSerial, exportURL = this.props.caseDetail.AssetExportAllURL, selectedEvidenceGroup = [], selectedAssets = [], evidenceGroups = _caseAssets.map(function (e) { return e.evidenceGroupId }), assetSysSerials = _caseAssets.map(function (e) { return e.assetSysSerial }); if (selectedEvidenceGroup = [].concat(_toConsumableArray(new Set(evidenceGroups))), selectedAssets = [].concat(_toConsumableArray(new Set(assetSysSerials))), selectedEvidenceGroup.length > 0) if ("ZipAsNewAsset" === type) RequestCreatingZipAsNewAsset(selectedAssets, selectedEvidenceGroup, "", !1, _caseId); else { if (selectedEvidenceGroup.length > 50 || selectedAssets.length > 50) var url = exportURL + JSON.stringify([]) + "&evidenceGroupIds=" + JSON.stringify(selectedEvidenceGroup) + "&selectChildAsset=true&caseId=" + _caseId + "&Exp=true&type=" + exportType + "&EsyndicatedId=" + EsyndicationId; else var url = exportURL + JSON.stringify(selectedAssets) + "&evidenceGroupIds=" + JSON.stringify([]) + "&selectChildAsset=false&caseId=" + _caseId + "&Exp=true&type=" + exportType + "&EsyndicatedId=" + EsyndicationId + "&SingleSegment=true"; $.downloadMediaFile(url), this.trackCaseHistory(isGuest, null, exportType) } else showErrorMsg("No Asset is available for export.") }, trackCaseHistory: function (isGuest, mediaId, exportType) { var sydicatedId = window.location.href.split("=")[1]; 1 == isGuest && null != sydicatedId && makeAjaxRequest({ type: "POST", url: "/Public/Case/UpdateCaseHistory", async: !1, params: { sydicatedId: sydicatedId, mediaId: mediaId, exportType: exportType }, onComplete: function (resp) { var json = JSON.parse(resp.responseText); 1 != json.success && console.log(json.msg) } }) }, onChangeSendEmailUpdatetoWatchers: function (e) { var isChecked = e.target.checked, caseDetail = this._getChangedCaseDetail(); caseDetail.SendEmailUpdatetoWatchers = isChecked, this.setState({ caseDetail: caseDetail }) }, redirectToCaseLister: function () { window.location.href = gAppBaseURL + "Case/Index" }, render: function () { var _this4 = this, _props2 = this.props, sysSerial = _props2.sysSerial, caseID = _props2.caseID, uiLists = _props2.uiLists, userInfo = _props2.userInfo, readOnlyMode = (_props2.usersList, _props2.readOnlyMode), isGuest = _props2.isGuest, allowAssetsViewing = _props2.allowAssetsViewing, allowAssetsPlaying = _props2.allowAssetsPlaying, allowAssetsDownloading = _props2.allowAssetsDownloading, allowCaseDeleting = _props2.allowCaseDeleting, allowCaseWithEvidenceDeleting = _props2.allowCaseWithEvidenceDeleting, allowEditCaseId = _props2.allowEditCaseId, allowEditCaseTitle = _props2.allowEditCaseTitle, onDataChanged = _props2.onDataChanged, showSendEmailUpdatetoWatchers = _props2.showSendEmailUpdatetoWatchers, editUserGroup = _props2.editUserGroup, IsDeleted = _props2.IsDeleted, allowCaseSharing = _props2.allowCaseSharing, _state = this.state, caseDetail = _state.caseDetail, station = _state.station, incidentsList = _state.incidentsList, watchersList = _state.watchersList, groupsList = _state.groupsList, ViewAssetMergeDescription = void 0, incidentsForMultiSelect = this._getCaseIncidentsInMultiSelectFormat(caseDetail.CaseIncidents), btnCancel = void 0, activityUI = void 0, caseButtonsUI = void 0, assetsUI = void 0, caseUsersUI = void 0, caseUserGroupsUI = void 0, CaseDeleteActivityUI = void 0, CaseShareUI = void 0, btnSaveTitle = "Save"; isGuest !== !0 && sysSerial > 0 ? (btnCancel = React.createElement("button", { className: "btn btn-default btn-case-cancel", onClick: this.onCancel }, "Cancel"), activityUI = React.createElement(_Activity2.default, { ref: "Activity", sysSerial: sysSerial, stationId: station, userInfo: userInfo, comments: caseDetail.CaseComments, history: caseDetail.CaseHistories, taggedAssets: caseDetail.CaseAssets })) : btnSaveTitle = "Create Case", CaseDeleteActivityUI = React.createElement(_CaseDeleteActivity2.default, { caseSysSerial: sysSerial, caseID: caseID, readOnlyMode: readOnlyMode, allowCaseDeleting: allowCaseDeleting, allowCaseWithEvidenceDeleting: allowCaseWithEvidenceDeleting, showButtonUI: !0, showFromLister: !1 }); var CaseShareButton = function (_ref) { var caseSysSerial = _ref.caseSysSerial, caseDetail = _ref.caseDetail, allowCaseSharing = _ref.allowCaseSharing, buttonsUI = void 0, notAllowedCaseStatus = [4]; if (caseSysSerial > 0 && caseDetail.StationIntegrationMapping) { var stationIntegrationMapping = caseDetail.StationIntegrationMapping; if (notAllowedCaseStatus.indexOf(caseDetail.status) < 0 && null != stationIntegrationMapping.IntegrationTypeId && stationIntegrationMapping.IntegrationTypeId.toString().length > 0 && stationIntegrationMapping.SecretKeyLen > 0 && 0 == caseDetail.IsDeleted && 1 == allowCaseSharing) { var isShared = caseDetail.IsShared, shareButtonText = ""; shareButtonText = 1 == isShared ? "Unshare with " : "Share with ", shareButtonText += stationIntegrationMapping.IntegrationTypeName, buttonsUI = React.createElement("div", { className: "case-share-buttons" }, React.createElement("button", { className: "btn btn-primary", onClick: function () { return _this4.props.onShare.apply(_this4, [caseSysSerial, caseDetail.IsShared, caseDetail.StationIntegrationMapping]) } }, React.createElement("i", { className: "fa fa-share-o", style: { marginRight: "5px", color: "#404040" } }), React.createElement("span", null, shareButtonText))) } } return React.createElement("div", null, buttonsUI) }; CaseShareUI = React.createElement(CaseShareButton, { caseSysSerial: sysSerial, caseDetail: caseDetail, allowCaseSharing: allowCaseSharing }), 0 == IsDeleted && (readOnlyMode !== !0 || allowEditCaseId || allowEditCaseTitle) && (caseButtonsUI = React.createElement("div", { className: "case-buttons-container" }, React.createElement("button", { className: "btn btn-glow inverse btn-save-case", onClick: this.onSave }, btnSaveTitle), btnCancel, CaseDeleteActivityUI, CaseShareUI)), (!isGuest || isGuest === !0 && allowAssetsViewing === !0) && (assetsUI = React.createElement(_Assets2.default, { ref: "Assets", assets: caseDetail.CaseAssets, childAssets: caseDetail.CaseChildAssets, stationId: station, userInfo: userInfo, caseSysSerial: sysSerial, onTaggedAssetsChange: this.onTaggedAssetsChange, readOnlyMode: readOnlyMode, isGuest: isGuest, allowAssetsPlaying: allowAssetsPlaying, allowAssetsDownloading: allowAssetsDownloading, onChanged: onDataChanged, exportAllAssets: this.exportAllAssets, trackCaseHistory: this.trackCaseHistory })), isGuest || (caseUsersUI = React.createElement(_Users2.default, { ref: "Users", usersList: watchersList, stationId: station, caseCreatedByUserId: caseDetail.CreatedByUser.Id, users: caseDetail.CaseUsers, userInfo: userInfo, readOnlyMode: readOnlyMode, onChanged: onDataChanged }), caseUserGroupsUI = React.createElement(_UserGroups2.default, { ref: "UserGroups", groupsList: groupsList, stationId: station, caseCreatedByUserId: caseDetail.CreatedByUser.Id, groups: caseDetail.CaseUserGroups, userInfo: userInfo, readOnlyMode: readOnlyMode, editUserGroup: editUserGroup, onChanged: onDataChanged, defaultWatchers: caseDetail.DefaultWatchers })), this.state.isMergeDescriptionView && (ViewAssetMergeDescription = React.createElement(MergeAssetView, { setMergeDescritionViewState: this.setMergeDescritionViewState, onSaveFromMergeDescription: this.onSaveFromMergeDescription, readOnlyMode: readOnlyMode, isMergeDescriptionView: this.state.isMergeDescriptionView, caseDetail: caseDetail, stationId: station, userInfo: userInfo, caseSysSerial: sysSerial, isGuest: isGuest, allowAssetsPlaying: allowAssetsPlaying, allowAssetsDownloading: allowAssetsDownloading })); var emailUpdateToWatchersVisibility = void 0; return emailUpdateToWatchersVisibility = 0 == IsDeleted && showSendEmailUpdatetoWatchers ? { visibility: "visible" } : { visibility: "hidden" }, React.createElement("div", { className: "case-wrapper user-input-section" }, React.createElement("div", { id: "mediaPreview" }), React.createElement(_Header2.default, { ref: "Header", caseSysSerial: sysSerial, userInfo: userInfo, prefix: caseDetail.prefix, caseID: caseDetail.CaseID, title: caseDetail.title, readOnlyMode: readOnlyMode, allowCaseDeleting: allowCaseDeleting, allowCaseWithEvidenceDeleting: allowCaseWithEvidenceDeleting, allowEditCaseId: allowEditCaseId, allowEditCaseTitle: allowEditCaseTitle, onChanged: onDataChanged, IsDeleted: IsDeleted }), React.createElement(_CoreInfo2.default, { ref: "CoreInfo", userInfo: userInfo, station: station, status: caseDetail.status, priority: caseDetail.priority, severity: caseDetail.severity, incidents: incidentsForMultiSelect, createdBy: caseDetail.CreatedByUser.FullName, createdOn: caseDetail.CreatedOnTicks, updatedOn: caseDetail.UpdatedOnTicks, stationList: uiLists.stationList, statusList: uiLists.statusList, priorityList: uiLists.priorityList, severityList: uiLists.severityList, incidentsList: incidentsList, onChangeIncidents: this.onChangeIncidents, onChangeStation: this.onChangeStation, readOnlyMode: readOnlyMode, onChanged: onDataChanged, IsDeleted: IsDeleted }), React.createElement(_Description2.default, { ref: "Description", userInfo: userInfo, description: caseDetail.description, taggedAssets: caseDetail.CaseAssets, readOnlyMode: readOnlyMode, onChanged: onDataChanged }), assetsUI, caseUserGroupsUI, caseUsersUI, React.createElement("div", { style: emailUpdateToWatchersVisibility }, React.createElement("input", { type: "checkbox", id: "sendEmailUpdatetoWatchers", checked: caseDetail.SendEmailUpdatetoWatchers, onChange: this.onChangeSendEmailUpdatetoWatchers }), React.createElement("label", null, "Send Email Update to Watchers")), caseButtonsUI, React.createElement(IrsaErrorSummary, { ref: "ErrorSummary", title: "Missing or invalid data. Please correct", errors: [] }), activityUI, ViewAssetMergeDescription) } }), MergeAssetView = React.createClass({ displayName: "MergeAssetView", propTypes: { caseDetail: React.PropTypes.object.isRequired, stationId: React.PropTypes.number.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, isGuest: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, onSaveFromMergeDescription: React.PropTypes.func.isRequired, setMergeDescritionViewState: React.PropTypes.func.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, isMergeDescriptionView: React.PropTypes.bool.isRequired }, getInitialState: function () { return { isMergeDescriptionView: !1, show: !1 } }, componentWillMount: function () { var showModel = this.props.show; showModel = !!this.props.isMergeDescriptionView, this.setState({ show: showModel, isMergeDescriptionView: this.props.isMergeDescriptionView }) }, componentWillReceiveProps: function (nextProps) { var showModel = nextProps.show; showModel = !!nextProps.isMergeDescriptionView, this.setState({ show: showModel, isMergeDescriptionView: nextProps.isMergeDescriptionView }) }, getContent: function () { if (this.state.isMergeDescriptionView) { var myContent = React.createElement("div", null, React.createElement("div", { className: "alert alert-danger" }, "This Case ID already exists. Do you want to merge these assets to the case already created?"), React.createElement(_MergeAssetDescriptionView2.default, { assets: this.props.caseDetail.CaseAssets, stationId: this.props.stationId, userInfo: this.props.userInfo, MergeCaseID: this.props.caseDetail.CaseID, readOnlyMode: !0, isGuest: this.props.isGuest, caseSysSerial: this.props.caseSysSerial })); return myContent } }, onOk: function () { $("#CaseAssetMergeModel .btn-glow").attr("disabled", !0), this.props.onSaveFromMergeDescription() }, onCancel: function () { this.props.setMergeDescritionViewState() }, render: function () { return React.createElement(IrsaReactModal, { id: "CaseAssetMergeModel", ref: "CaseAssetMergeModel", title: "Case Merge", show: this.state.show, content: this.getContent(), width: 750, height: 550, buttons: [{ key: "ok", text: "Proceed", width: 90, className: "btn-glow inverse", onClick: this.onOk }, { key: "cancel", text: "Cancel", width: 90, className: "btn-glow", onClick: this.onCancel }] }) } }); module.exports = Case }, function (module, exports, __webpack_require__) { "use strict"; function getEnumerableOwnPropertyKeys(value) { var keys = []; for (var key in value) hasOwnProperty.call(value, key) && keys.push(key); if (Object.getOwnPropertySymbols) for (var symbols = Object.getOwnPropertySymbols(value), i = 0; i < symbols.length; i++)propIsEnumerable.call(value, symbols[i]) && keys.push(symbols[i]); return keys } function clone(value) { return Array.isArray(value) ? cloneArray(value) : isOptionObject(value) ? cloneOptionObject(value) : value } function cloneArray(array) { var result = array.slice(0, 0); return getEnumerableOwnPropertyKeys(array).forEach(function (key) { result[key] = clone(array[key]) }), result } function cloneOptionObject(obj) { var result = null === Object.getPrototypeOf(obj) ? Object.create(null) : {}; return getEnumerableOwnPropertyKeys(obj).forEach(function (key) { result[key] = clone(obj[key]) }), result } function mergeKeys(merged, source, keys, mergeOpts) { return keys.forEach(function (key) { key in merged ? merged[key] = merge(merged[key], source[key], mergeOpts) : merged[key] = clone(source[key]) }), merged } function concatArrays(merged, source, mergeOpts) { var result = merged.slice(0, 0), resultIndex = 0; return [merged, source].forEach(function (array) { for (var indices = [], k = 0; k < array.length; k++)hasOwnProperty.call(array, k) && (indices.push(String(k)), array === merged ? result[resultIndex++] = array[k] : result[resultIndex++] = clone(array[k])); result = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(function (key) { return indices.indexOf(key) === -1 }), mergeOpts) }), result } function merge(merged, source, mergeOpts) { return mergeOpts.concatArrays && Array.isArray(merged) && Array.isArray(source) ? concatArrays(merged, source, mergeOpts) : isOptionObject(source) && isOptionObject(merged) ? mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), mergeOpts) : clone(source) } var isOptionObject = __webpack_require__(20), hasOwnProperty = Object.prototype.hasOwnProperty, propIsEnumerable = Object.propertyIsEnumerable, globalThis = this, defaultMergeOpts = { concatArrays: !1 }; module.exports = function () { for (var mergeOpts = merge(clone(defaultMergeOpts), this !== globalThis && this || {}, defaultMergeOpts), merged = {}, i = 0; i < arguments.length; i++) { var option = arguments[i]; if (void 0 !== option) { if (!isOptionObject(option)) throw new TypeError("`" + option + "` is not an Option Object"); merged = merge(merged, option, mergeOpts) } } return merged } }, function (module, exports) { "use strict"; var toString = Object.prototype.toString; module.exports = function (x) { var prototype; return "[object Object]" === toString.call(x) && (prototype = Object.getPrototypeOf(x), null === prototype || prototype === Object.getPrototypeOf({})) } }, function (module, exports, __webpack_require__) { "use strict"; function _defineProperty(obj, key, value) { return key in obj ? Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }) : obj[key] = value, obj } var _constants = __webpack_require__(22), Header = React.createClass({ displayName: "Header", propTypes: { caseSysSerial: React.PropTypes.number.isRequired, prefix: React.PropTypes.string.isRequired, caseID: React.PropTypes.string.isRequired, title: React.PropTypes.string, userInfo: _constants.LoggedInUserShape.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, onChanged: React.PropTypes.func.isRequired, IsDeleted: React.PropTypes.bool }, getDefaultProps: function () { return { prefix: "" } }, getInitialState: function () { return { title: "", prefix: "", caseID: "" } }, onChangeTitle: function (e) { e.preventDefault(), this.setState({ title: e.target.value }), this.props.onChanged() }, onChangeCaseID: function (e) { e.preventDefault(), this.setState({ caseID: e.target.value }), this.props.onChanged() }, componentWillMount: function () { this.setState({ prefix: this.props.prefix, title: this.props.title, caseID: this.props.caseID }) }, componentWillReceiveProps: function (nextProps) { this.setState({ prefix: nextProps.prefix, title: nextProps.title, caseID: nextProps.caseID }) }, render: function () { var _React$createElement, _props = this.props, caseSysSerial = _props.caseSysSerial, readOnlyMode = _props.readOnlyMode, allowEditCaseId = _props.allowEditCaseId, allowEditCaseTitle = _props.allowEditCaseTitle, userInfo = _props.userInfo, IsDeleted = _props.IsDeleted, CaseIDUI = void 0, isDisabledCaseId = !1, isDisabledCaseTitle = !1; return caseSysSerial > 0 && (readOnlyMode || userInfo.isAdmin ? readOnlyMode && (allowEditCaseId || (isDisabledCaseId = !0), allowEditCaseTitle || (isDisabledCaseTitle = !0)) : (isDisabledCaseId = allowEditCaseId !== !0, isDisabledCaseTitle = allowEditCaseTitle !== !0), IsDeleted && (isDisabledCaseId = !0, isDisabledCaseTitle = !0)), CaseIDUI = React.createElement("div", { className: "casePrefixAndID" }, React.createElement(IrsaEditableText, (_React$createElement = { ref: "caseID", value: this.state.caseID, fieldName: "CaseID", onChange: this.onChangeCaseID, maxlength: 200, placeholder: "Case ID..." }, _defineProperty(_React$createElement, "maxlength", 50), _defineProperty(_React$createElement, "disabled", isDisabledCaseId), _defineProperty(_React$createElement, "validation", [{ type: "required", description: "ID is required" }, { type: "minLength", value: 3, description: "Minimum 3 characters" }]), _React$createElement))), React.createElement("div", { className: "case-header", id: "casePreFixID" }, CaseIDUI, React.createElement(IrsaEditableText, { ref: "title", value: this.state.title, fieldName: "Title", onChange: this.onChangeTitle, maxlength: 200, placeholder: "Case title...", disabled: isDisabledCaseTitle, validation: [{ type: "required", description: "Title is required" }, { type: "minLength", value: 3, description: "Minimum 3 characters" }] })) } }); module.exports = Header }, function (module, exports) { "use strict"; var ERROR_IMAGE_PATH = gAppBaseURL + "Content/Images/no-media-irsa-logo.png", VIDEO_ASSET_TYPES = [1, 5], IMAGE_ASSET_TYPES = [3], AUDIO_ASSET_TYPES = [2], LoggedInUserShape = React.PropTypes.shape({ userId: React.PropTypes.number.isRequired, contextList: React.PropTypes.arrayOf(React.PropTypes.number).isRequired, userFullName: React.PropTypes.string, isAdmin: React.PropTypes.bool.isRequired, userGroupIds: React.PropTypes.arrayOf(React.PropTypes.number) }), CommentShape = React.PropTypes.shape({ sysSerial: React.PropTypes.number.isRequired, description: React.PropTypes.string, CreatedByUser: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, FullName: React.PropTypes.string.isRequired }).isRequired, CreatedOnTicks: React.PropTypes.number.isRequired, UpdatedByUser: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, FullName: React.PropTypes.string.isRequired }), UpdatedOnTicks: React.PropTypes.number }), HistoryShape = React.PropTypes.shape({ sysSerial: React.PropTypes.number.isRequired, description: React.PropTypes.string, CreatedOnTicks: React.PropTypes.number.isRequired, CreatedAgainstUser: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, FullName: React.PropTypes.string.isRequired }).isRequired }), UserShape = React.PropTypes.shape({ sysSerial: React.PropTypes.number.isRequired, AssignedUser: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, FullName: React.PropTypes.string.isRequired, Status: React.PropTypes.number.isRequired }).isRequired, AssignedByUser: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, FullName: React.PropTypes.string.isRequired }), CreatedOnTicks: React.PropTypes.number, ACL: React.PropTypes.oneOf(["RW", "R"]) }), GroupShape = React.PropTypes.shape({ sysSerial: React.PropTypes.number.isRequired, AssignedUserGroup: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, Name: React.PropTypes.string.isRequired }).isRequired, AssignedByUser: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, FullName: React.PropTypes.string.isRequired }), CreatedOnTicks: React.PropTypes.number, ACL: React.PropTypes.oneOf(["RW", "R", "DRW", "DR"]) }), MediaForTaggingShape = React.PropTypes.shape({ sysSerial: React.PropTypes.number.isRequired, assetSysSerial: React.PropTypes.number.isRequired, assetID: React.PropTypes.string.isRequired, evidenceGroupId: React.PropTypes.number.isRequired, description: React.PropTypes.string, thumbnail: React.PropTypes.string.isRequired, orderIdStr: React.PropTypes.string.isRequired, mediaTypeId: React.PropTypes.number.isRequired, mediaStatus: React.PropTypes.number.isRequired, mediaState: React.PropTypes.number.isRequired, extension: React.PropTypes.string.isRequired, userId: React.PropTypes.number.isRequired, incidents: React.PropTypes.arrayOf(React.PropTypes.shape({ IncidentId: React.PropTypes.number.isRequired, Name: React.PropTypes.string.isRequired })), checked: React.PropTypes.bool, assetURLForExport: React.PropTypes.string.isRequired, isMaster: React.PropTypes.bool.isRequired, OtherAssetsOfGroup: React.PropTypes.array, TotalSegments: React.PropTypes.number }), AssetShape = React.PropTypes.shape({ sysSerial: React.PropTypes.number.isRequired, assetSysSerial: React.PropTypes.number.isRequired, assetID: React.PropTypes.string.isRequired, evidenceGroupId: React.PropTypes.number.isRequired, extension: React.PropTypes.string.isRequired, mediaTypeId: React.PropTypes.number.isRequired, mediaStatus: React.PropTypes.number.isRequired, mediaState: React.PropTypes.number.isRequired, thumbnail: React.PropTypes.string.isRequired, orderIdStr: React.PropTypes.string.isRequired, description: React.PropTypes.string, incidents: React.PropTypes.arrayOf(React.PropTypes.shape({ IncidentId: React.PropTypes.number.isRequired, Name: React.PropTypes.string.isRequired })), CreatedOnTicks: React.PropTypes.number.isRequired, UpdatedOnTicks: React.PropTypes.number, CreatedByUser: React.PropTypes.shape({ Id: React.PropTypes.number.isRequired, FullName: React.PropTypes.string.isRequired }), checked: React.PropTypes.bool, assetURLForExport: React.PropTypes.string.isRequired, TotalSegments: React.PropTypes.number, Ext_RMSID: React.PropTypes.string, segmentsTagged: React.PropTypes.bool, isAssetFromBucket: React.PropTypes.bool }); module.exports = { ERROR_IMAGE_PATH: ERROR_IMAGE_PATH, VIDEO_ASSET_TYPES: VIDEO_ASSET_TYPES, IMAGE_ASSET_TYPES: IMAGE_ASSET_TYPES, AUDIO_ASSET_TYPES: AUDIO_ASSET_TYPES, LoggedInUserShape: LoggedInUserShape, CommentShape: CommentShape, HistoryShape: HistoryShape, UserShape: UserShape, GroupShape: GroupShape, MediaForTaggingShape: MediaForTaggingShape, AssetShape: AssetShape } }, function (module, exports, __webpack_require__) { "use strict"; var _constants = __webpack_require__(22), CoreInfo = React.createClass({ displayName: "CoreInfo", propTypes: { station: React.PropTypes.number.isRequired, status: React.PropTypes.number.isRequired, priority: React.PropTypes.number.isRequired, severity: React.PropTypes.number.isRequired, incidents: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, label: React.PropTypes.string.isRequired, sysSerial: React.PropTypes.number.isRequired })).isRequired, createdBy: React.PropTypes.string.isRequired, createdOn: React.PropTypes.number.isRequired, updatedOn: React.PropTypes.number, stationList: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, text: React.PropTypes.string.isRequired, pdId: React.PropTypes.number.isRequired })), statusList: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, text: React.PropTypes.string.isRequired })).isRequired, priorityList: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, text: React.PropTypes.string.isRequired })).isRequired, severityList: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, text: React.PropTypes.string.isRequired })).isRequired, incidentsList: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, label: React.PropTypes.string.isRequired })).isRequired, userInfo: _constants.LoggedInUserShape.isRequired, onChangeIncidents: React.PropTypes.func.isRequired, onChangeStation: React.PropTypes.func.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, onChanged: React.PropTypes.func.isRequired, IsDeleted: React.PropTypes.bool }, getInitialState: function () { return { station: null, status: 1, priority: 3, severity: 3, incidents: [] } }, onChangeDropdown: function (fieldName, value) { var _this = this, newState = {}; newState[fieldName] = value, this.setState(newState, function () { _this.props.onChanged() }) }, onChangeStation: function (value) { var _this2 = this, stPdId = this.props.stationList.find(function (e) { return e.value == value }).pdId; this.setState({ incidents: [], station: value }, function () { _this2.props.onChangeStation(value, stPdId), _this2.props.onChanged() }) }, onChangeIncidents: function (e, parentComp) { var vls = e ? e : []; parentComp.setState({ incidents: vls }, function () { setTimeout(function () { parentComp.props.onChangeIncidents(vls), parentComp.props.onChanged() }, 50) }) }, componentWillMount: function () { var _props = this.props, station = _props.station, status = _props.status, priority = _props.priority, severity = _props.severity, incidents = _props.incidents; this.setState({ station: station, status: status, priority: priority, severity: severity, incidents: incidents }) }, componentWillReceiveProps: function (nextProps) { var station = nextProps.station, status = nextProps.status, priority = nextProps.priority, severity = nextProps.severity, incidents = nextProps.incidents; this.setState({ station: station, status: status, priority: priority, severity: severity, incidents: incidents }) }, render: function () { var _this3 = this, _props2 = this.props, userInfo = _props2.userInfo, readOnlyMode = _props2.readOnlyMode, createdBy = _props2.createdBy, createdOn = _props2.createdOn, stationList = (_props2.updatedOn, _props2.stationList), statusList = _props2.statusList, priorityList = _props2.priorityList, severityList = _props2.severityList, incidentsList = _props2.incidentsList, IsDeleted = _props2.IsDeleted, that = this, crDate = kendo.toString(new Date(createdOn), _stationDateFormat), readOnlyStation = !0; return userInfo.isAdmin === !0 && (readOnlyStation = !1), 1 == IsDeleted && (readOnlyStation = !0), React.createElement("div", { className: "panel panel-default case-core-info-wrapper" }, React.createElement("div", { className: "panel-body" }, React.createElement("table", { className: "table case-core-info" }, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", { className: "left-col-label" }, React.createElement("div", null)), React.createElement("th", { className: "left-col-value" }, React.createElement("div", null)), React.createElement("th", { className: "right-col-label" }, React.createElement("div", null)), React.createElement("th", { className: "right-col-value" }, React.createElement("div", null)))), React.createElement("tbody", null, React.createElement("tr", null, React.createElement("td", { className: "core-info-label" }, React.createElement("span", null, "Station")), React.createElement("td", { className: "core-info-value" }, React.createElement(IrsaReactDropdown, { id: "stationDropdown", data: stationList, value: this.state.station, optionLabel: "Select Station", disabled: readOnlyStation, context: this, change: function (e) { return _this3.onChangeStation(e) } })), React.createElement("td", { className: "core-info-label" }, React.createElement("span", null)), React.createElement("td", { className: "core-info-value" }, React.createElement("span", null))), React.createElement("tr", null, React.createElement("td", { className: "core-info-label" }, React.createElement("span", null, "Status")), React.createElement("td", { className: "core-info-value" }, React.createElement(IrsaReactDropdown, { id: "statusDropdown", data: statusList, value: this.state.status, optionLabel: "Select Status", disabled: readOnlyMode, context: this, change: function (e) { return _this3.onChangeDropdown("status", e) } })), React.createElement("td", { className: "core-info-label" }, React.createElement("span", null, "Priority")), React.createElement("td", { className: "core-info-value" }, React.createElement(IrsaReactDropdown, { id: "priorityDropdown", data: priorityList, value: this.state.priority, optionLabel: "Select Priority", disabled: readOnlyMode, context: this, change: function (e) { return _this3.onChangeDropdown("priority", e) } }))), React.createElement("tr", null, React.createElement("td", { className: "core-info-label" }, React.createElement("span", null, "Severity")), React.createElement("td", { className: "core-info-value" }, React.createElement(IrsaReactDropdown, { id: "severityDropdown", data: severityList, value: this.state.severity, optionLabel: "Select Severity", disabled: readOnlyMode, context: this, change: function (e) { return _this3.onChangeDropdown("severity", e) } })), React.createElement("td", { className: "core-info-label" }, React.createElement("span", null, "Categories")), React.createElement("td", { className: "core-info-value incidents" }, React.createElement(Select, { id: "incidentsMultiSelect", name: "incidentsMultiSelect", options: incidentsList, value: this.state.incidents, placeholder: "Select Categories", onChange: function (e) { _this3.onChangeIncidents(e, that) }, delimiter: ",", joinValues: !0, multi: !0, simple: !1, searchable: !0, clearable: !0, disabled: readOnlyMode }))), React.createElement("tr", null, React.createElement("td", { className: "core-info-label" }, "Created By"), React.createElement("td", { className: "core-info-value" }, createdBy), React.createElement("td", { className: "core-info-label" }, "Created On"), React.createElement("td", { className: "core-info-value" }, crDate)))))) } }); module.exports = CoreInfo }, function (module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _IrsaReactRichTextEditor = __webpack_require__(25), _IrsaReactRichTextEditor2 = _interopRequireDefault(_IrsaReactRichTextEditor), _constants = __webpack_require__(22), _commons = __webpack_require__(72), Description = React.createClass({ displayName: "Description", propTypes: { description: React.PropTypes.string, userInfo: _constants.LoggedInUserShape.isRequired, taggedAssets: React.PropTypes.array, readOnlyMode: React.PropTypes.bool.isRequired, onChanged: React.PropTypes.func.isRequired }, getDefaultProps: function () { return { description: "", taggedAssets: [] } }, getInitialState: function () { return { description: "", isEditMode: !1, taggedAssets: [] } }, _onConfirmEdit: function () { this.props.onChanged() }, getDescriptionAsPlainText: function () { return this.refs.descriptionRTE.getContentAsPlainText() }, componentWillMount: function () { this.setState({ description: this.props.description, taggedAssets: this.props.taggedAssets }) }, componentWillReceiveProps: function (nextProps) { this.setState({ description: nextProps.description, taggedAssets: nextProps.taggedAssets }) }, render: function () { var _state = this.state, isEditMode = _state.isEditMode, taggedAssets = _state.taggedAssets, description = _state.description, readOnlyMode = this.props.readOnlyMode, edtMode = readOnlyMode !== !0 && isEditMode; return React.createElement("div", { className: "case-description" }, React.createElement("label", { className: "section-heading" }, "Description"), React.createElement(_IrsaReactRichTextEditor2.default, { ref: "descriptionRTE", isEditMode: edtMode, showEditButton: readOnlyMode !== !0, showDeleteButton: !1, onConfirmEdit: this._onConfirmEdit, content: description, requiredContentPromptMsg: "Description is required", strategies: [{ regex: _commons.rgx, component: _commons.hashtagHTML, context: taggedAssets }] })) } }); module.exports = Description }, function (module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _ModulesCommons = __webpack_require__(26), _SimpleDecorator = __webpack_require__(39), _SimpleDecorator2 = _interopRequireDefault(_SimpleDecorator), deepEqual = __webpack_require__(40); window._editorsArray = []; var _Draft = Draft, Editor = _Draft.Editor, EditorState = _Draft.EditorState, Modifier = _Draft.Modifier, RichUtils = _Draft.RichUtils, convertToRaw = _Draft.convertToRaw, convertFromRaw = _Draft.convertFromRaw, Entity = (_Draft.convertFromHTML, _Draft.ContentState, _Draft.Entity), KeyBindingUtil = (_Draft.getDefaultKeyBinding, _Draft.KeyBindingUtil), BLOCK_TYPES = (KeyBindingUtil.hasCommandModifier, [{ label: "Heading 1", style: "header-one" }, { label: "Heading 2", style: "header-two" }, { label: "Heading 3", style: "header-three" }, { label: "Heading 4", style: "header-four" }, { label: "Heading 5", style: "header-five" }, { label: "Heading 6", style: "header-six" }, { label: "Block quote", style: "blockquote" }]), colorStyleMap = { black: { color: "rgba(0, 0, 0, 1.0)" }, red: { color: "rgba(255, 0, 0, 1.0)" }, orange: { color: "rgba(255, 127, 0, 1.0)" }, yellow: { color: "rgba(180, 180, 0, 1.0)" }, green: { color: "rgba(0, 180, 0, 1.0)" }, blue: { color: "rgba(0, 0, 255, 1.0)" }, indigo: { color: "rgba(75, 0, 130, 1.0)" }, violet: { color: "rgba(127, 0, 255, 1.0)" } }, COLORS = [{ label: "Black", style: "black" }, { label: "Red", style: "red" }, { label: "Orange", style: "orange" }, { label: "Yellow", style: "yellow" }, { label: "Green", style: "green" }, { label: "Blue", style: "blue" }, { label: "Indigo", style: "indigo" }, { label: "Violet", style: "violet" }], validateRTEFileTypeForUpload = function (fileExtension, fileName) { var mediaType = "", ext = fileExtension.toLowerCase(); switch (ext) { case ".jpg": case ".png": case ".bmp": case ".gif": mediaType = "Image"; break; case ".pdf": mediaType = "PDFDoc"; break; case ".txt": mediaType = "Text"; break; case ".doc": case ".docx": mediaType = "WordDoc"; break; case ".xls": case ".xlsx": mediaType = "ExcelDoc"; break; case ".ppt": case ".pptx": mediaType = "PowerPointDoc"; break; default: throw mediaType = "Others", new Error(String.format("Cannot upload selected file. Unsupported File Type: {0}", fileName)) }return mediaType }, LinkURLInputModal = React.createClass({ displayName: "LinkURLInputModal", props: { onOK: React.PropTypes.func.isRequired, onCancel: React.PropTypes.func.isRequired }, getInitialState: function () { return { inputURL: "" } }, onChangeInput: function (e) { e.preventDefault(), this.setState({ inputURL: e.target.value }) }, onOK: function () { var url = this.state.inputURL; return 0 != url.indexOf("http://") && 0 != url.indexOf("https://") && (url = "http://" + url), this.props.onOK(url), !1 }, getContent: function () { return React.createElement("form", { className: "form-horizontal" }, React.createElement("div", { className: "form-group" }, React.createElement("div", { className: "col-md-7" }, React.createElement("input", { type: "text", id: "inputURL", ref: "inputURL", style: { width: "325px", height: "36px", marginTop: "10px" }, value: this.state.inputURL, maxLength: "500", onChange: this.onChangeInput, className: "form-control" })))) }, componentWillReceiveProps: function (nextProps) { this.setState({ inputURL: "" }) }, componentDidMount: function () { $("#inputURL").focus() }, componentDidUpdate: function () { $("#inputURL").focus() }, render: function () { return React.createElement(IrsaReactModal, { ref: "urlInputModal", title: "Enter Link URL", content: this.getContent(), width: 300, buttons: [{ key: "ok", text: "OK", width: 90, className: "btn-glow inverse", onClick: this.onOK }, { key: "cancel", text: "Cancel", width: 90, className: "btn-glow", isCloseButton: !0, onClick: this.props.onCancel }] }) } }), openLinkInContent = function (url, e) { e.preventDefault(), window.open(url, "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=50,left=300,width=840,height=580") }, styles = { link: { color: "#006aae", cursor: "pointer" } }, ColorDropdown = function (_ref) { var onClick = _ref.onClick, title = _ref.title, parentComp = _ref.parentComp, ttle = title ? title : "", clrCnt = 0; return React.createElement("div", { className: "btn-group color-dropdown", title: ttle }, React.createElement("button", { type: "button", className: "btn btn-default" }, React.createElement("span", { className: "fa fa-font color-alphabet" }), React.createElement("span", { className: "colored-alphabet-underline" })), React.createElement("button", { type: "button", className: "btn btn-default dropdown-toggle", "data-toggle": "dropdown", "aria-haspopup": "true", "aria-expanded": "false" }, React.createElement("span", { className: "caret" }), React.createElement("span", { className: "sr-only" }, "Toggle Color Dropdown")), React.createElement("ul", { className: "dropdown-menu color-picker" }, Object.keys(colorStyleMap).map(function (k) { clrCnt++; var colorObj = colorStyleMap[k]; return React.createElement("li", { key: "clr_" + clrCnt }, React.createElement("span", { title: ttle, onMouseDown: function (e) { var arr = COLORS.filter(function (e) { return e.label.toLowerCase() == k.toLowerCase() }), toggledColor = arr[0].style; onClick.apply(parentComp, [toggledColor]) }, style: { backgroundColor: colorObj.color } })) }))) }; ColorDropdown.propTypes = { onClick: React.PropTypes.func, title: React.PropTypes.string.isRequired, parentComp: React.PropTypes.object.isRequired }; var Link = function (props) { var _Entity$get$getData = Entity.get(props.entityKey).getData(), url = _Entity$get$getData.url; return React.createElement("a", { href: "#", style: styles.link, onClick: function (e) { openLinkInContent(url, e) } }, props.decoratedText) }, LINK_REGEX = /(https?:\/\/[^\s]+)/g, LinkHTML = function (props) { var url = props.decoratedText; return React.createElement("a", { href: "#", style: styles.link, onClick: function (e) { openLinkInContent(url, e) } }, url) }, createSimpleDecorator = function (strategies, textEditorComp) { var simpleDecorator = new _SimpleDecorator2.default(function (contentBlock, callback) { var text = contentBlock.getText(); contentBlock.findEntityRanges(function (character) { var entityKey = character.getEntity(); return null !== entityKey && "LINK" === Entity.get(entityKey).getType() }, function (start, end) { var customProps = { strategyInfo: { component: Link } }; callback(start, end, customProps) }); var matchArrLink = void 0, startLink = void 0, customPropsForLinkHTML = void 0; for (customPropsForLinkHTML = { strategyInfo: { component: LinkHTML } }; null !== (matchArrLink = LINK_REGEX.exec(text));)startLink = matchArrLink.index, callback(startLink, startLink + matchArrLink[0].length, customPropsForLinkHTML); strategies.forEach(function (strgyInfo) { for (var regex = strgyInfo.regex, matchArr = void 0, start = void 0, customProps = { strategyInfo: strgyInfo, textEditorComp: textEditorComp }; null !== (matchArr = regex.exec(text));)start = matchArr.index, callback(start, start + matchArr[0].length, customProps) }) }, function (props) { return props.strategyInfo.component(props) }); return simpleDecorator }, IrsaReactRichTextEditor = function (_React$Component) { function IrsaReactRichTextEditor(props) { _classCallCheck(this, IrsaReactRichTextEditor); var _this = _possibleConstructorReturn(this, (IrsaReactRichTextEditor.__proto__ || Object.getPrototypeOf(IrsaReactRichTextEditor)).call(this, props)); _this._id = props.id ? props.id : _ModulesCommons.Util.generateUUID(); var strategies = props.strategies, onChangeContent = props.onChangeContent; return _this.compositeDecorator = createSimpleDecorator(strategies, _this), _this.state = { editorState: EditorState.createEmpty(_this.compositeDecorator), rawStateContentClone: null, showURLInput: !1, isEditMode: !1, setReadOnlyWhileInEditMode: !1, hideEditContentButtons: !1, showEditButton: !1, showDeleteButton: !1, hasChanges: !1 }, _this.focus = function () { return _this.refs.editor.focus() }, _this.onChange = function (editorState) { var oldRawContent = convertToRaw(_this.state.editorState.getCurrentContent()), newRawContent = convertToRaw(editorState.getCurrentContent()); _this.setState({ editorState: editorState }), setTimeout(function () { var sameContent = deepEqual(oldRawContent, newRawContent); sameContent === !1 && (_this.setState({ hasChanges: !0 }), onChangeContent(newRawContent, _this)) }, 50) }, _this.handleKeyCommand = _this._handleKeyCommand.bind(_this), _this } return _inherits(IrsaReactRichTextEditor, _React$Component), _createClass(IrsaReactRichTextEditor, [{ key: "_handleKeyCommand", value: function (command) { var newState = RichUtils.handleKeyCommand(this.state.editorState, command); return !!newState && (this.onChange(newState), !0) } }, { key: "_promptForLink", value: function (e) { e.preventDefault(); var editorState = this.state.editorState, selection = editorState.getSelection(); selection.isCollapsed() || this.setState({ showURLInput: !0, isEditMode: !1 }) } }, { key: "_onCancelForLink", value: function (e) { e.preventDefault(), this.setState({ showURLInput: !1, isEditMode: !0 }) } }, { key: "_confirmLink", value: function (urlValue) { var _this2 = this, editorState = this.state.editorState, entityKey = Entity.create("LINK", "MUTABLE", { url: urlValue }), selection = editorState.getSelection(), contentState = Modifier.applyEntity(editorState.getCurrentContent(), selection, entityKey), linked = EditorState.push(editorState, contentState, "apply-entity"), collapsed = selection.merge({ anchorOffset: selection.getEndOffset(), focusOffset: selection.getEndOffset() }), newEditorState = EditorState.forceSelection(linked, collapsed); this.setState({ showURLInput: !1, isEditMode: !0, editorState: newEditorState }, function () { setTimeout(function () { _this2.refs.editor.focus(), _this2._insertSpace() }, 10) }) } }, { key: "_removeLink", value: function (e) { e.preventDefault(); var editorState = this.state.editorState, selection = editorState.getSelection(); selection.isCollapsed() || this.setState({ editorState: RichUtils.toggleLink(editorState, selection, null) }) } }, { key: "_insertSpace", value: function () { var editorState = this.state.editorState, selection = editorState.getSelection(), cs = Modifier.insertText(editorState.getCurrentContent(), selection, " "), newEditorState = EditorState.push(editorState, cs, "insert-text"); this.setState({ editorState: newEditorState }) } }, { key: "_onBoldClick", value: function (e) { e.preventDefault(), this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, "BOLD")) } }, { key: "_onItalicClick", value: function (e) { e.preventDefault(), this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, "ITALIC")) } }, { key: "_onUnderlineClick", value: function (e) { e.preventDefault(), this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, "UNDERLINE")) } }, { key: "_onStyleClick", value: function (value) { return this.onChange(RichUtils.toggleBlockType(this.state.editorState, value)), !1 } }, { key: "_onBulletListClick", value: function (e) { e.preventDefault(), this.onChange(RichUtils.toggleBlockType(this.state.editorState, "unordered-list-item")) } }, { key: "_onNumberedListClick", value: function (e) { e.preventDefault(), this.onChange(RichUtils.toggleBlockType(this.state.editorState, "ordered-list-item")) } }, { key: "_onChooseColorClick", value: function (toggledColor) { var editorState = this.state.editorState, selection = editorState.getSelection(), nextContentState = Object.keys(colorStyleMap).reduce(function (contentState, color) { return Modifier.removeInlineStyle(contentState, selection, color) }, editorState.getCurrentContent()), nextEditorState = EditorState.push(editorState, nextContentState, "change-inline-style"), currentStyle = editorState.getCurrentInlineStyle(); selection.isCollapsed() && (nextEditorState = currentStyle.reduce(function (state, color) { return RichUtils.toggleInlineStyle(state, color) }, nextEditorState)), currentStyle.has(toggledColor) || (nextEditorState = RichUtils.toggleInlineStyle(nextEditorState, toggledColor)), this.onChange(nextEditorState) } }, { key: "_onAttachmentClick", value: function (e) { e.preventDefault(), $("#irsa-rte-file").trigger("click") } }, { key: "_onAttachmentSelected", value: function (e) { e.preventDefault(); var file = $("#irsa-rte-file").get(0).files[0]; if (file) try { if (file.name.indexOf(".") == -1) return void showErrorMsg("Files without extension are not supported"); var arr = file.name.split("."), ext = "." + arr[arr.length - 1]; validateRTEFileTypeForUpload(ext, file.name) } catch (e) { return void showErrorMsg(e.toString()) } } }, { key: "_onEditClick", value: function (e) { var _props, _this3 = this; e.preventDefault(), _editorsArray.forEach(function (editorObj) { editorObj._id != _this3._id && editorObj._hideEditContentButtons() }); var rawStateContent = this.getEditorContent(); this.setState({ isEditMode: !0, rawStateContentClone: rawStateContent }), (_props = this.props).onEditClick.apply(_props, _toConsumableArray(this.props.defaultArgs).concat([this])) } }, { key: "_onConfirmEdit", value: function (e) { var _props2, _this5 = this; e && e.preventDefault(); var reqPromptMsg = this.props.requiredContentPromptMsg, rawStateContent = this.getEditorContent(); return 0 == rawStateContent.blocks.length || 0 == rawStateContent.blocks[0].text.length ? (this.setState({ isEditMode: !1 }), void showErrorMsg({ msg: reqPromptMsg, callback: function () { var _this4 = this; this.setState({ isEditMode: !0 }), setTimeout(function () { _this4.refs.editor.focus() }, 200) }, scope: this })) : (rawStateContent ? this.setState({ isEditMode: !1, rawStateContentClone: rawStateContent, hasChanges: !1 }) : this.setState({ isEditMode: !1, hasChanges: !1 }), _editorsArray.forEach(function (editorObj) { editorObj._id != _this5._id && editorObj._showEditContentButtons() }), void (_props2 = this.props).onConfirmEdit.apply(_props2, _toConsumableArray(this.props.defaultArgs).concat([this]))) } }, { key: "_onCancelEdit", value: function (e) { var _props3, _this6 = this; e.preventDefault(); var rawStateContent = this.state.rawStateContentClone; if (rawStateContent) { var contentState = convertFromRaw(rawStateContent), editorState = EditorState.createWithContent(contentState, this.compositeDecorator); this.setState({ isEditMode: !1, editorState: editorState, hasChanges: !1 }) } else this.setState({ isEditMode: !1, hasChanges: !1 }); _editorsArray.forEach(function (editorObj) { editorObj._id != _this6._id && editorObj._showEditContentButtons() }), (_props3 = this.props).onCancelEdit.apply(_props3, _toConsumableArray(this.props.defaultArgs).concat([this])) } }, { key: "_onDeleteClick", value: function (e) { var _props4; e.preventDefault(), (_props4 = this.props).onDeleteClick.apply(_props4, _toConsumableArray(this.props.defaultArgs).concat([this])) } }, { key: "getEditorContent", value: function () { var editorState = this.state.editorState, content = editorState.getCurrentContent(); return convertToRaw(content) } }, { key: "setEditorContent", value: function (rawState) { if (rawState) { var contentState = convertFromRaw(rawState); this.refs.editor.setState({ editorState: contentState }) } } }, { key: "getContentAsPlainText", value: function (delimiter) { var plainText = "", editorState = this.state.editorState, contentState = editorState.getCurrentContent(); return contentState.hasText() && (plainText = contentState.getPlainText(delimiter ? delimiter : null)), plainText } }, { key: "componentWillMount", value: function () { var _props5 = this.props, strategies = _props5.strategies, isEditMode = _props5.isEditMode, hideEditContentButtons = _props5.hideEditContentButtons, content = _props5.content, showEditButton = _props5.showEditButton, showDeleteButton = _props5.showDeleteButton; this.compositeDecorator = createSimpleDecorator(strategies, this); var state = {}; if (null != content && content.length > 0) { var contentState = convertFromRaw(JSON.parse(content)), editorState = EditorState.createWithContent(contentState, this.compositeDecorator); state.editorState = editorState, state.rawStateContentClone = convertToRaw(editorState.getCurrentContent()) } state.hideEditContentButtons = hideEditContentButtons, state.isEditMode = isEditMode, state.showEditButton = showEditButton, state.showDeleteButton = showDeleteButton, this.setState(state) } }, { key: "componentWillReceiveProps", value: function (nextProps) { var strategies = nextProps.strategies, isEditMode = nextProps.isEditMode, hideEditContentButtons = nextProps.hideEditContentButtons, content = nextProps.content, showEditButton = nextProps.showEditButton, showDeleteButton = nextProps.showDeleteButton; this.compositeDecorator = createSimpleDecorator(strategies, this); var state = {}; if (null != content && content.length > 0) { var contentState = convertFromRaw(JSON.parse(content)), editorState = EditorState.createWithContent(contentState, this.compositeDecorator); state.editorState = editorState, state.rawStateContentClone = convertToRaw(editorState.getCurrentContent()) } state.hideEditContentButtons = hideEditContentButtons, state.isEditMode = isEditMode, state.showEditButton = showEditButton, state.showDeleteButton = showDeleteButton, this.setState(state) } }, { key: "_hideEditContentButtons", value: function () { 1 != this.props.hideEditContentButtons && this.setState({ hideEditContentButtons: !0 }) } }, { key: "_showEditContentButtons", value: function () { 1 != this.props.hideEditContentButtons && this.setState({ hideEditContentButtons: !1 }) } }, { key: "componentDidMount", value: function () { var _this7 = this; _editorsArray.push(this), 1 == this.props.isEditMode && _editorsArray.forEach(function (editorObj) { editorObj._id != _this7._id && editorObj._hideEditContentButtons() }), $(document).bind("click.irsaRTE" + this._id, function (event) { _this7.state.isEditMode && !_this7.state.setReadOnlyWhileInEditMode ? $(event.target).closest("#" + _this7._id).length || _this7.setState({ setReadOnlyWhileInEditMode: !0 }) : _this7.state.isEditMode && _this7.state.setReadOnlyWhileInEditMode && $(event.target).closest("#" + _this7._id).length && _this7.setState({ setReadOnlyWhileInEditMode: !1 }) }) } }, { key: "componentWillUnmount", value: function () { $(document).unbind("click.irsaRTE" + this._id); } }, { key: "getToolbarUI", value: function () { this.state.editorState.getSelection(); return React.createElement("div", { className: "irsa-rich-text-toolbar-container" }, React.createElement("div", { className: "irsa-rich-text-editor-toolbar fa-hover" }, React.createElement(IrsaReactDropdown, { data: BLOCK_TYPES.map(function (e) { return { value: e.style, text: e.label, itemClassName: e.style } }), optionLabel: "Style", onBeforeChange: this._onStyleClick.bind(this) }), React.createElement("a", { title: "Bold", className: "rte-button", onClick: this._onBoldClick.bind(this) }, React.createElement("i", { className: "fa fa-bold" })), React.createElement("a", { title: "Italic", className: "rte-button", onClick: this._onItalicClick.bind(this) }, React.createElement("i", { className: "fa fa-italic" })), React.createElement("a", { title: "Underline", className: "rte-button", onClick: this._onUnderlineClick.bind(this) }, React.createElement("i", { className: "fa fa-underline" })), React.createElement(ColorDropdown, { title: "Text Color", parentComp: this, onClick: this._onChooseColorClick.bind(this) }), React.createElement("a", { title: "Create Hyperlink", className: "rte-button", onClick: this._promptForLink.bind(this) }, React.createElement("i", { className: "fa fa-link" })), React.createElement("a", { title: "Remove Hyperlink", className: "rte-button", onClick: this._removeLink.bind(this) }, React.createElement("i", { className: "fa fa-unlink" })), React.createElement("a", { title: "Bullet List", className: "rte-button", onClick: this._onBulletListClick.bind(this) }, React.createElement("i", { className: "fa fa-list-ul" })), React.createElement("a", { title: "Numbered List", className: "rte-button", onClick: this._onNumberedListClick.bind(this) }, React.createElement("i", { className: "fa fa-list" })))) } }, { key: "render", value: function () { var _this8 = this, _props6 = this.props, placeholder = _props6.placeholder, headerElement = _props6.headerElement, _state = (_props6.onConfirmEdit, _props6.onCancelEdit, this.state), isEditMode = _state.isEditMode, setReadOnlyWhileInEditMode = _state.setReadOnlyWhileInEditMode, hideEditContentButtons = _state.hideEditContentButtons, editorState = _state.editorState, showEditButton = _state.showEditButton, showDeleteButton = _state.showDeleteButton, toolbarUI = void 0, urlInput = void 0, editContentButtonsUI = void 0, editButton = void 0, deleteButton = void 0, confirmButtonsUI = void 0; 1 != isEditMode && 1 != this.state.showURLInput || (toolbarUI = this.getToolbarUI()), showEditButton && (editButton = React.createElement("span", { className: "fa fa-edit edit-content", title: "Edit", onClick: this._onEditClick.bind(this) })), showDeleteButton && (deleteButton = React.createElement("span", { className: "icon icon-remove delete-content", title: "Delete", onClick: this._onDeleteClick.bind(this) })), 1 == hideEditContentButtons || isEditMode || this.state.showURLInput || (editContentButtonsUI = React.createElement("div", { className: "irsa-editable-text-edit-buttons" }, editButton, deleteButton)), isEditMode && (confirmButtonsUI = React.createElement("div", { className: "irsa-rich-text-confirm-content-buttons" }, React.createElement("button", { className: "btn btn-primary", title: "Confirm", onClick: this._onConfirmEdit.bind(this) }, "OK"), React.createElement("button", { className: "btn btn-default", href: "#", title: "Cancel", onClick: this._onCancelEdit.bind(this) }, "Cancel"))), 1 == this.state.showURLInput && (urlInput = React.createElement(LinkURLInputModal, { onOK: this._confirmLink.bind(this), onCancel: this._onCancelForLink.bind(this) })), setTimeout(function () { 1 == isEditMode && _this8.refs.editor && _this8.refs.editor.focus() }, 300); var readOnly = !0; return readOnly = 1 == setReadOnlyWhileInEditMode || !isEditMode, React.createElement("div", { id: this._id, className: "irsa-rich-text-container" }, React.createElement("div", { className: "irsa-rich-text-editor panel panel-default" }, React.createElement("div", { className: "panel-heading" + (isEditMode ? " edit-mode" : " view-mode") }, React.createElement("div", { className: "irsa-rich-text-irsa-tools" }, React.createElement("div", { className: "header-element" }, headerElement), editContentButtonsUI), toolbarUI), urlInput, React.createElement("div", { className: "panel-body" }, React.createElement(Editor, { customStyleMap: colorStyleMap, ref: "editor", readOnly: readOnly, placeholder: placeholder, editorState: editorState, onChange: this.onChange, handleKeyCommand: this.handleKeyCommand }))), confirmButtonsUI) } }]), IrsaReactRichTextEditor }(React.Component); IrsaReactRichTextEditor.propTypes = { id: React.PropTypes.string, placeholder: React.PropTypes.string, content: React.PropTypes.string, onChangeContent: React.PropTypes.func, hideEditContentButtons: React.PropTypes.bool, isEditMode: React.PropTypes.bool, showEditButton: React.PropTypes.bool, showDeleteButton: React.PropTypes.bool, headerElement: React.PropTypes.element, onEditClick: React.PropTypes.func, onDeleteClick: React.PropTypes.func, onConfirmEdit: React.PropTypes.func, onCancelEdit: React.PropTypes.func, defaultArgs: React.PropTypes.array, strategies: React.PropTypes.arrayOf(React.PropTypes.shape({ regex: React.PropTypes.any.isRequired, component: React.PropTypes.func.isRequired, context: React.PropTypes.any })), requiredContentPromptMsg: React.PropTypes.string }, IrsaReactRichTextEditor.defaultProps = { placeholder: null, content: "", onChangeContent: function (rawState, editorObj) { }, hideEditContentButtons: !1, isEditMode: !1, showEditButton: !1, showDeleteButton: !1, onEditClick: function () { }, onConfirmEdit: function () { }, onCancelEdit: function () { }, onDeleteClick: function () { }, defaultArgs: [], strategies: [], requiredContentPromptMsg: "Content is required for Rich Text Editor. Please type." }, module.exports = IrsaReactRichTextEditor }, function (module, exports, __webpack_require__) { "use strict"; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function StoreError(message, errors) { this.name = "StoreError", this.message = message || "", this.errors = errors || "", this.stack = (new Error).stack } var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }, _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), Locker = __webpack_require__(27), locker = new Locker; StoreError.prototype = Object.create(Error.prototype), StoreError.prototype.constructor = StoreError; var _MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], Util = function () { function Util() { _classCallCheck(this, Util) } return _createClass(Util, null, [{ key: "generateUUID", value: function () { var uuid = (+Date.now() + Math.floor(999999 * Math.random())).toString(36); return uuid } }, { key: "mergeArrays", value: function (a, b, createNew) { if (createNew !== !0) return a = b.reduce(function (coll, item) { return coll.push(item), coll }, a); var result = []; return Util.mergeArrays(result, a), Util.mergeArrays(result, b), result } }, { key: "setCookie", value: function (cookieName, cookieValue, nMins) { var today = new Date; null != nMins && void 0 != nMins && 0 != nMins || (nMins = 1440); var expire = new Date(today.getTime() + 6e4 * nMins); document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString() + ";path=/" } }, { key: "getCookie", value: function (c_name) { var i, x, y, ARRcookies = document.cookie.split(";"); for (i = 0; i < ARRcookies.length; i++)if (x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")), y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1), x = x.replace(/^\s+|\s+$/g, ""), x == c_name) return unescape(y) } }, { key: "removeCookie", value: function (c_name) { document.cookie = c_name + "=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/" } }, { key: "formatDate", value: function (dateObj, format) { return dateObj ? Date && Date.CultureInfo ? dateObj.toString(format) : void dateObj.toLocaleTimeString("en-US", { hour12: !0 }) : "" } }, { key: "orderByDescendingDate", value: function (array, datePropName, dateIsInTicks) { var dateKeywordFormat = arguments.length > 3 && void 0 !== arguments[3] && arguments[3], result = [].concat(_toConsumableArray(array)); return result.sort(function (a, b) { return dateIsInTicks === !0 ? dateKeywordFormat === !1 ? new Date(b[datePropName]) - new Date(a[datePropName]) : new Date(parseInt(b[datePropName].substr(6))) - new Date(parseInt(a[datePropName].substr(6))) : b[datePropName] - a[datePropName] }), result } }, { key: "orderByAscendingDate", value: function (array, datePropName, dateIsInTicks) { var result = [].concat(_toConsumableArray(array)); return result.sort(function (a, b) { return dateIsInTicks === !0 ? new Date(a[datePropName]) - new Date(b[datePropName]) : a[datePropName] - b[datePropName] }), result } }, { key: "detectLeftButtonPress", value: function (evt) { evt = evt || window.event; var button = evt.which || evt.button; return 1 == button } }, { key: "findWithRegex", value: function (regex, contentBlock, callback) { for (var text = contentBlock.getText(), matchArr = void 0, start = void 0; null !== (matchArr = regex.exec(text));)start = matchArr.index, callback(start, start + matchArr[0].length) } }, { key: "shortenMonth", value: function (date) { if (!date) return ""; var m = _MONTHS.find(function (e) { return date.indexOf(e) > -1 }); return m ? date.replace(m, m.substring(0, 3)) : date } }, { key: "validateUserInputSection", value: function ($inputSection) { var errorsInfo = ($inputSection.find("input[type=text],input[type=email],input[type=number],input[type=search],input[type=tel],input[type=url],textarea"), []); return $("input[type=text]").map(function (idx, input) { var $input = $(input); if ($input.is("input[type=text],input[type=email],input[type=number],input[type=search],input[type=tel],input[type=url],textarea")) { var fieldName = $input.data("fieldName"); fieldName = fieldName ? fieldName : ""; var inputVal = $.trim($input.val()), result = checkForValidInputContent(inputVal, fieldName); result && result.length > 0 && errorsInfo.push(result) } }), errorsInfo } }, { key: "getValueFromWindowHistory", value: function (key) { if (!window.history || "function" != typeof window.history.replaceState) throw new Error("Your Browser does not support History API to be used by this module"); if ("string" != typeof key) throw new Error('"key" argument for getValueFromWindowHistory function must be a string'); if (null == key || void 0 == key) throw new Error('"key" argument for getValueFromWindowHistory function is required'); var valueObj = null, wState = window.history.state; if (wState) { var strState = wState[key]; strState && (valueObj = JSON.parse(strState)) } return valueObj } }, { key: "getValueFromWindowHistoryAsync", value: function (key) { if (!window.history || "function" != typeof window.history.replaceState) throw new Error("Your Browser does not support History API to be used by this module"); if ("string" != typeof key) throw new Error('"key" argument for getValueFromWindowHistoryAsync function must be a string'); if (null == key || void 0 == key) throw new Error('"key" argument for getValueFromWindowHistoryAsync function is required'); return locker.lock(function () { var valueObj = null, wState = window.history.state; if (wState) { var strState = wState[this.key]; strState && strState.length > 0 && (valueObj = JSON.parse(strState)) } return Promise.resolve(valueObj) }, { key: key }) } }, { key: "writeValueToWindowHistory", value: function (key, value, url) { if (!window.history || "function" != typeof window.history.replaceState) throw new Error("Your Browser does not support History API to be used by this module"); if ("string" != typeof key) throw new Error('"key" argument for writeValueToWindowHistory function must be a string'); if (null == key || void 0 == key) throw new Error('"key" argument for writeValueToWindowHistory function is required'); if ("string" != typeof url) throw new Error('"url" argument for writeValueToWindowHistory function must be a string'); if (null == url || void 0 == url) throw new Error('"url" argument for writeValueToWindowHistory function is required'); return locker.lock(function () { var vlu = void 0; if ("object" == _typeof(this.value)) vlu = JSON.stringify(this.value); else { if ("string" != typeof this.value) throw new Error('"value" argument for writeValueToWindowHistory function must either be a string, object or an array'); vlu = this.value } var wState = window.history.state; return wState || (wState = {}), "string" == typeof wState && (wState = {}), wState[this.key] = vlu, window.history.replaceState(wState, null, this.url), Promise.resolve() }, { key: key, value: value, url: url }) } }, { key: "clearWindowHistory", value: function (queryKeys) { if (!Array.isArray(queryKeys)) throw new Error('Argument "queryKeys" for clearWindowHistory function must be an array'); return locker.lock(function () { var url = document.location.href; return queryKeys.map(function (e) { url = updateQueryStringParameter(url, e, "") }), window.history.replaceState(null, null, url), Promise.resolve() }) } }, { key: "scrollToElement", value: function (elm, callback, scope) { if (elm) { var parentElm = null, arr = $(elm).closest(".k-window-content.k-content"); arr.length > 0 && (parentElm = arr.get(0)); var bodyTopMargin = 115, offset = void 0, body = void 0; parentElm ? (bodyTopMargin = 0, offset = $(elm).position(), body = $(parentElm)) : (bodyTopMargin = 115, offset = $(elm).offset(), body = $("html, body")); var scrollTop = offset.top - bodyTopMargin; scrollTop = scrollTop > 0 ? scrollTop : 0, body.stop().animate({ scrollTop: scrollTop }, "500", "swing", function () { "function" == typeof callback && callback.apply(scope ? scope : window, []) }) } } }]), Util }(); Util.LettersIncrement = function () { function isLetters(arr) { for (var i = 0; i < arr.length; i++)if (arr[i].toLowerCase() == arr[i].toUpperCase()) return !1; return !0 } function next(c) { var u = c.toUpperCase(); if (same(u, "Z")) { for (var txt = "", i = u.length; i--;)txt += "A"; return txt + "A" } var p = "", q = ""; u.length > 1 && (p = u.substring(0, u.length - 1), q = String.fromCharCode(p.slice(-1).charCodeAt(0))); var l = u.slice(-1).charCodeAt(0), z = nextLetter(l); return "A" === z ? p.slice(0, -1) + nextLetter(q.slice(-1).charCodeAt(0)) + z : p + z } function nextLetter(l) { return l < 90 ? String.fromCharCode(l + 1) : "A" } function same(str, char) { for (var i = str.length; i--;)if (str[i] !== char) return !1; return !0 } var pub = {}, letterArray = []; return pub.increment = function (c) { if (letterArray = c.split(""), isLetters(letterArray)) return next(c); throw new Error("Letters Only") }, pub }(), module.exports = { Util: Util, StoreError: StoreError } }, function (module, exports, __webpack_require__) { function Locker() { return this instanceof Locker ? (this.locked = !1, this.busy = !1, this.running = 0, void (this.queue = [])) : new Locker } function joinQueue(fn, ctx, exclusive) { fn = promisify(fn, 0); var deferred = defer(); return this.queue.push({ fn: fn, ctx: ctx, deferred: deferred, exclusive: exclusive }), runQueue.call(this), deferred.promise } function runQueue() { for (this.busy = this.running || this.queue.length; ;) { var again = runNext.call(this); if (!again) return } } function runNext() { if (this.locked) return !1; var item = this.queue[0]; if (!item) return !1; if (item.exclusive) { if (this.running) return !1; this.locked = !0 } this.queue.shift(), this.running++; var self = this; return item.fn.call(item.ctx).then(function (res) { runDone.call(self, item, !0, res) }, function (err) { runDone.call(self, item, !1, err) }), !0 } function runDone(item, resolved, res) { this.running-- , this.locked && (this.locked = !1), item.deferred[resolved ? "resolve" : "reject"](res), runQueue.call(this) } var promisify = __webpack_require__(28), defer = __webpack_require__(37); module.exports = Locker, Locker.prototype.run = function (fn, ctx) { return joinQueue.call(this, fn, ctx, !1) }, Locker.prototype.lock = function (fn, ctx) { return joinQueue.call(this, fn, ctx, !0) } }, function (module, exports, __webpack_require__) { function makePromisify(Promise) { var co = coBluebird.use(Promise), promisify = function (fn, options) { return "number" == typeof options ? options = { numArgs: options } : (void 0 === options && (options = {}), void 0 === options.numArgs && (options.numArgs = 0)), isGeneratorFn(fn) ? co.wrap(fn) : fn.length > options.numArgs ? Promise.promisify(fn) : Promise.method(fn) }; return promisify.generators = function (obj) { for (var name in obj) { var fn = obj[name]; isGeneratorFn(fn) && (obj[name] = co.wrap(fn)) } return obj }, promisify.use = makePromisify, promisify } var Promise = __webpack_require__(29), coBluebird = __webpack_require__(33), isGeneratorFn = __webpack_require__(36).fn; module.exports = makePromisify(Promise) }, function (module, exports, __webpack_require__) { (function (process, global, setImmediate) {/* @preserve * The MIT License (MIT) * * Copyright (c) 2013-2015 Petka Antonov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ !function (e) { module.exports = e() }(function () { var define, module, exports; return function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = "function" == typeof _dereq_ && _dereq_; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } for (var i = "function" == typeof _dereq_ && _dereq_, o = 0; o < r.length; o++)s(r[o]); return s }({ 1: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function any(promises) { var ret = new SomePromiseArray(promises), promise = ret.promise(); return ret.setHowMany(1), ret.setUnwrap(), ret.init(), promise } var SomePromiseArray = Promise._SomePromiseArray; Promise.any = function (promises) { return any(promises) }, Promise.prototype.any = function () { return any(this) } } }, {}], 2: [function (_dereq_, module, exports) { "use strict"; function Async() { this._isTickUsed = !1, this._lateQueue = new Queue(16), this._normalQueue = new Queue(16), this._trampolineEnabled = !0; var self = this; this.drainQueues = function () { self._drainQueues() }, this._schedule = schedule.isStatic ? schedule(this.drainQueues) : schedule } function AsyncInvokeLater(fn, receiver, arg) { this._lateQueue.push(fn, receiver, arg), this._queueTick() } function AsyncInvoke(fn, receiver, arg) { this._normalQueue.push(fn, receiver, arg), this._queueTick() } function AsyncSettlePromises(promise) { this._normalQueue._pushOne(promise), this._queueTick() } var firstLineError; try { throw new Error } catch (e) { firstLineError = e } var schedule = _dereq_("./schedule.js"), Queue = _dereq_("./queue.js"), util = _dereq_("./util.js"); Async.prototype.disableTrampolineIfNecessary = function () { util.hasDevTools && (this._trampolineEnabled = !1) }, Async.prototype.enableTrampoline = function () { this._trampolineEnabled || (this._trampolineEnabled = !0, this._schedule = function (fn) { setTimeout(fn, 0) }) }, Async.prototype.haveItemsQueued = function () { return this._normalQueue.length() > 0 }, Async.prototype.throwLater = function (fn, arg) { if (1 === arguments.length && (arg = fn, fn = function () { throw arg }), "undefined" != typeof setTimeout) setTimeout(function () { fn(arg) }, 0); else try { this._schedule(function () { fn(arg) }) } catch (e) { throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n") } }, util.hasDevTools ? (schedule.isStatic && (schedule = function (fn) { setTimeout(fn, 0) }), Async.prototype.invokeLater = function (fn, receiver, arg) { this._trampolineEnabled ? AsyncInvokeLater.call(this, fn, receiver, arg) : this._schedule(function () { setTimeout(function () { fn.call(receiver, arg) }, 100) }) }, Async.prototype.invoke = function (fn, receiver, arg) { this._trampolineEnabled ? AsyncInvoke.call(this, fn, receiver, arg) : this._schedule(function () { fn.call(receiver, arg) }) }, Async.prototype.settlePromises = function (promise) { this._trampolineEnabled ? AsyncSettlePromises.call(this, promise) : this._schedule(function () { promise._settlePromises() }) }) : (Async.prototype.invokeLater = AsyncInvokeLater, Async.prototype.invoke = AsyncInvoke, Async.prototype.settlePromises = AsyncSettlePromises), Async.prototype.invokeFirst = function (fn, receiver, arg) { this._normalQueue.unshift(fn, receiver, arg), this._queueTick() }, Async.prototype._drainQueue = function (queue) { for (; queue.length() > 0;) { var fn = queue.shift(); if ("function" == typeof fn) { var receiver = queue.shift(), arg = queue.shift(); fn.call(receiver, arg) } else fn._settlePromises() } }, Async.prototype._drainQueues = function () { this._drainQueue(this._normalQueue), this._reset(), this._drainQueue(this._lateQueue) }, Async.prototype._queueTick = function () { this._isTickUsed || (this._isTickUsed = !0, this._schedule(this.drainQueues)) }, Async.prototype._reset = function () { this._isTickUsed = !1 }, module.exports = new Async, module.exports.firstLineError = firstLineError }, { "./queue.js": 28, "./schedule.js": 31, "./util.js": 38 }], 3: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise) { var rejectThis = function (_, e) { this._reject(e) }, targetRejected = function (e, context) { context.promiseRejectionQueued = !0, context.bindingPromise._then(rejectThis, rejectThis, null, this, e) }, bindingResolved = function (thisArg, context) { this._isPending() && this._resolveCallback(context.target) }, bindingRejected = function (e, context) { context.promiseRejectionQueued || this._reject(e) }; Promise.prototype.bind = function (thisArg) { var maybePromise = tryConvertToPromise(thisArg), ret = new Promise(INTERNAL); ret._propagateFrom(this, 1); var target = this._target(); if (ret._setBoundTo(maybePromise), maybePromise instanceof Promise) { var context = { promiseRejectionQueued: !1, promise: ret, target: target, bindingPromise: maybePromise }; target._then(INTERNAL, targetRejected, ret._progress, ret, context), maybePromise._then(bindingResolved, bindingRejected, ret._progress, ret, context) } else ret._resolveCallback(target); return ret }, Promise.prototype._setBoundTo = function (obj) { void 0 !== obj ? (this._bitField = 131072 | this._bitField, this._boundTo = obj) : this._bitField = this._bitField & -131073 }, Promise.prototype._isBound = function () { return 131072 === (131072 & this._bitField) }, Promise.bind = function (thisArg, value) { var maybePromise = tryConvertToPromise(thisArg), ret = new Promise(INTERNAL); return ret._setBoundTo(maybePromise), maybePromise instanceof Promise ? maybePromise._then(function () { ret._resolveCallback(value) }, ret._reject, ret._progress, ret, null) : ret._resolveCallback(value), ret } } }, {}], 4: [function (_dereq_, module, exports) { "use strict"; function noConflict() { try { Promise === bluebird && (Promise = old) } catch (e) { } return bluebird } var old; "undefined" != typeof Promise && (old = Promise); var bluebird = _dereq_("./promise.js")(); bluebird.noConflict = noConflict, module.exports = bluebird }, { "./promise.js": 23 }], 5: [function (_dereq_, module, exports) { "use strict"; var cr = Object.create; if (cr) { var callerCache = cr(null), getterCache = cr(null); callerCache[" size"] = getterCache[" size"] = 0 } module.exports = function (Promise) { function ensureMethod(obj, methodName) { var fn; if (null != obj && (fn = obj[methodName]), "function" != typeof fn) { var message = "Object " + util.classString(obj) + " has no method '" + util.toString(methodName) + "'"; throw new Promise.TypeError(message) } return fn } function caller(obj) { var methodName = this.pop(), fn = ensureMethod(obj, methodName); return fn.apply(obj, this) } function namedGetter(obj) { return obj[this] } function indexedGetter(obj) { var index = +this; return index < 0 && (index = Math.max(0, index + obj.length)), obj[index] } var getGetter, util = _dereq_("./util.js"), canEvaluate = util.canEvaluate; util.isIdentifier; Promise.prototype.call = function (methodName) { for (var $_len = arguments.length, args = new Array($_len - 1), $_i = 1; $_i < $_len; ++$_i)args[$_i - 1] = arguments[$_i]; return args.push(methodName), this._then(caller, void 0, void 0, args, void 0) }, Promise.prototype.get = function (propertyName) { var getter, isIndex = "number" == typeof propertyName; if (isIndex) getter = indexedGetter; else if (canEvaluate) { var maybeGetter = getGetter(propertyName); getter = null !== maybeGetter ? maybeGetter : namedGetter } else getter = namedGetter; return this._then(getter, void 0, void 0, propertyName, void 0) } } }, { "./util.js": 38 }], 6: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { var errors = _dereq_("./errors.js"), async = _dereq_("./async.js"), CancellationError = errors.CancellationError; Promise.prototype._cancel = function (reason) { if (!this.isCancellable()) return this; for (var parent, promiseToReject = this; void 0 !== (parent = promiseToReject._cancellationParent) && parent.isCancellable();)promiseToReject = parent; this._unsetCancellable(), promiseToReject._target()._rejectCallback(reason, !1, !0) }, Promise.prototype.cancel = function (reason) { return this.isCancellable() ? (void 0 === reason && (reason = new CancellationError), async.invokeLater(this._cancel, this, reason), this) : this }, Promise.prototype.cancellable = function () { return this._cancellable() ? this : (async.enableTrampoline(), this._setCancellable(), this._cancellationParent = void 0, this) }, Promise.prototype.uncancellable = function () { var ret = this.then(); return ret._unsetCancellable(), ret }, Promise.prototype.fork = function (didFulfill, didReject, didProgress) { var ret = this._then(didFulfill, didReject, didProgress, void 0, void 0); return ret._setCancellable(), ret._cancellationParent = void 0, ret } } }, { "./async.js": 2, "./errors.js": 13 }], 7: [function (_dereq_, module, exports) { "use strict"; module.exports = function () { function CapturedTrace(parent) { this._parent = parent; var length = this._length = 1 + (void 0 === parent ? 0 : parent._length); captureStackTrace(this, CapturedTrace), length > 32 && this.uncycle() } function reconstructStack(message, stacks) { for (var i = 0; i < stacks.length - 1; ++i)stacks[i].push("From previous event:"), stacks[i] = stacks[i].join("\n"); return i < stacks.length && (stacks[i] = stacks[i].join("\n")), message + "\n" + stacks.join("\n") } function removeDuplicateOrEmptyJumps(stacks) { for (var i = 0; i < stacks.length; ++i)(0 === stacks[i].length || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) && (stacks.splice(i, 1), i--) } function removeCommonRoots(stacks) { for (var current = stacks[0], i = 1; i < stacks.length; ++i) { for (var prev = stacks[i], currentLastIndex = current.length - 1, currentLastLine = current[currentLastIndex], commonRootMeetPoint = -1, j = prev.length - 1; j >= 0; --j)if (prev[j] === currentLastLine) { commonRootMeetPoint = j; break } for (var j = commonRootMeetPoint; j >= 0; --j) { var line = prev[j]; if (current[currentLastIndex] !== line) break; current.pop(), currentLastIndex-- } current = prev } } function cleanStack(stack) { for (var ret = [], i = 0; i < stack.length; ++i) { var line = stack[i], isTraceLine = stackFramePattern.test(line) || " (No stack trace)" === line, isInternalFrame = isTraceLine && shouldIgnore(line); isTraceLine && !isInternalFrame && (indentStackFrames && " " !== line.charAt(0) && (line = " " + line), ret.push(line)) } return ret } function stackFramesAsArray(error) { for (var stack = error.stack.replace(/\s+$/g, "").split("\n"), i = 0; i < stack.length; ++i) { var line = stack[i]; if (" (No stack trace)" === line || stackFramePattern.test(line)) break } return i > 0 && (stack = stack.slice(i)), stack } function formatNonError(obj) { var str; if ("function" == typeof obj) str = "[function " + (obj.name || "anonymous") + "]"; else { str = obj.toString(); var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; if (ruselessToString.test(str)) try { var newStr = JSON.stringify(obj); str = newStr } catch (e) { } 0 === str.length && (str = "(empty array)") } return "(<" + snip(str) + ">, no stack trace)" } function snip(str) { var maxChars = 41; return str.length < maxChars ? str : str.substr(0, maxChars - 3) + "..." } function parseLineInfo(line) { var matches = line.match(parseLineInfoRegex); if (matches) return { fileName: matches[1], line: parseInt(matches[2], 10) } } var warn, async = _dereq_("./async.js"), util = _dereq_("./util.js"), bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/, stackFramePattern = null, formatStack = null, indentStackFrames = !1; util.inherits(CapturedTrace, Error), CapturedTrace.prototype.uncycle = function () { var length = this._length; if (!(length < 2)) { for (var nodes = [], stackToIndex = {}, i = 0, node = this; void 0 !== node; ++i)nodes.push(node), node = node._parent; length = this._length = i; for (var i = length - 1; i >= 0; --i) { var stack = nodes[i].stack; void 0 === stackToIndex[stack] && (stackToIndex[stack] = i) } for (var i = 0; i < length; ++i) { var currentStack = nodes[i].stack, index = stackToIndex[currentStack]; if (void 0 !== index && index !== i) { index > 0 && (nodes[index - 1]._parent = void 0, nodes[index - 1]._length = 1), nodes[i]._parent = void 0, nodes[i]._length = 1; var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; index < length - 1 ? (cycleEdgeNode._parent = nodes[index + 1], cycleEdgeNode._parent.uncycle(), cycleEdgeNode._length = cycleEdgeNode._parent._length + 1) : (cycleEdgeNode._parent = void 0, cycleEdgeNode._length = 1); for (var currentChildLength = cycleEdgeNode._length + 1, j = i - 2; j >= 0; --j)nodes[j]._length = currentChildLength, currentChildLength++; return } } } }, CapturedTrace.prototype.parent = function () { return this._parent }, CapturedTrace.prototype.hasParent = function () { return void 0 !== this._parent }, CapturedTrace.prototype.attachExtraTrace = function (error) { if (!error.__stackCleaned__) { this.uncycle(); for (var parsed = CapturedTrace.parseStackAndMessage(error), message = parsed.message, stacks = [parsed.stack], trace = this; void 0 !== trace;)stacks.push(cleanStack(trace.stack.split("\n"))), trace = trace._parent; removeCommonRoots(stacks), removeDuplicateOrEmptyJumps(stacks), util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)), util.notEnumerableProp(error, "__stackCleaned__", !0) } }, CapturedTrace.parseStackAndMessage = function (error) { var stack = error.stack, message = error.toString(); return stack = "string" == typeof stack && stack.length > 0 ? stackFramesAsArray(error) : [" (No stack trace)"], { message: message, stack: cleanStack(stack) } }, CapturedTrace.formatAndLogError = function (error, title) { if ("undefined" != typeof console) { var message; if ("object" == typeof error || "function" == typeof error) { var stack = error.stack; message = title + formatStack(stack, error) } else message = title + String(error); "function" == typeof warn ? warn(message) : "function" != typeof console.log && "object" != typeof console.log || console.log(message) } }, CapturedTrace.unhandledRejection = function (reason) { CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: ") }, CapturedTrace.isSupported = function () { return "function" == typeof captureStackTrace }, CapturedTrace.fireRejectionEvent = function (name, localHandler, reason, promise) { var localEventFired = !1; try { "function" == typeof localHandler && (localEventFired = !0, "rejectionHandled" === name ? localHandler(promise) : localHandler(reason, promise)) } catch (e) { async.throwLater(e) } var globalEventFired = !1; try { globalEventFired = fireGlobalEvent(name, reason, promise) } catch (e) { globalEventFired = !0, async.throwLater(e) } var domEventFired = !1; if (fireDomEvent) try { domEventFired = fireDomEvent(name.toLowerCase(), { reason: reason, promise: promise }) } catch (e) { domEventFired = !0, async.throwLater(e) } globalEventFired || localEventFired || domEventFired || "unhandledRejection" !== name || CapturedTrace.formatAndLogError(reason, "Unhandled rejection ") }; var shouldIgnore = function () { return !1 }, parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; CapturedTrace.setBounds = function (firstLineError, lastLineError) { if (CapturedTrace.isSupported()) { for (var firstFileName, lastFileName, firstStackLines = firstLineError.stack.split("\n"), lastStackLines = lastLineError.stack.split("\n"), firstIndex = -1, lastIndex = -1, i = 0; i < firstStackLines.length; ++i) { var result = parseLineInfo(firstStackLines[i]); if (result) { firstFileName = result.fileName, firstIndex = result.line; break } } for (var i = 0; i < lastStackLines.length; ++i) { var result = parseLineInfo(lastStackLines[i]); if (result) { lastFileName = result.fileName, lastIndex = result.line; break } } firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex || (shouldIgnore = function (line) { if (bluebirdFramePattern.test(line)) return !0; var info = parseLineInfo(line); return !!(info && info.fileName === firstFileName && firstIndex <= info.line && info.line <= lastIndex) }) } }; var fireDomEvent, captureStackTrace = function () { var v8stackFramePattern = /^\s*at\s*/, v8stackFormatter = function (stack, error) { return "string" == typeof stack ? stack : void 0 !== error.name && void 0 !== error.message ? error.toString() : formatNonError(error) }; if ("number" == typeof Error.stackTraceLimit && "function" == typeof Error.captureStackTrace) { Error.stackTraceLimit = Error.stackTraceLimit + 6, stackFramePattern = v8stackFramePattern, formatStack = v8stackFormatter; var captureStackTrace = Error.captureStackTrace; return shouldIgnore = function (line) { return bluebirdFramePattern.test(line) }, function (receiver, ignoreUntil) { Error.stackTraceLimit = Error.stackTraceLimit + 6, captureStackTrace(receiver, ignoreUntil), Error.stackTraceLimit = Error.stackTraceLimit - 6 } } var err = new Error; if ("string" == typeof err.stack && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) return stackFramePattern = /@/, formatStack = v8stackFormatter, indentStackFrames = !0, function (o) { o.stack = (new Error).stack }; var hasStackAfterThrow; try { throw new Error } catch (e) { hasStackAfterThrow = "stack" in e } return "stack" in err || !hasStackAfterThrow || "number" != typeof Error.stackTraceLimit ? (formatStack = function (stack, error) { return "string" == typeof stack ? stack : "object" != typeof error && "function" != typeof error || void 0 === error.name || void 0 === error.message ? formatNonError(error) : error.toString() },null): (stackFramePattern = v8stackFramePattern, formatStack = v8stackFormatter,function(o){ Error.stackTraceLimit = Error.stackTraceLimit + 6; try { throw new Error } catch (e) { o.stack = e.stack } Error.stackTraceLimit = Error.stackTraceLimit - 6 }) }([]), fireGlobalEvent = function () { if (util.isNode) return function (name, reason, promise) { return "rejectionHandled" === name ? process.emit(name, promise) : process.emit(name, reason, promise) }; var customEventWorks = !1, anyEventWorks = !0; try { var ev = new self.CustomEvent("test"); customEventWorks = ev instanceof CustomEvent } catch (e) { } if (!customEventWorks) try { var event = document.createEvent("CustomEvent"); event.initCustomEvent("testingtheevent", !1, !0, {}), self.dispatchEvent(event) } catch (e) { anyEventWorks = !1 } anyEventWorks && (fireDomEvent = function (type, detail) { var event; return customEventWorks ? event = new self.CustomEvent(type, { detail: detail, bubbles: !1, cancelable: !0 }) : self.dispatchEvent && (event = document.createEvent("CustomEvent"), event.initCustomEvent(type, !1, !0, detail)), !!event && !self.dispatchEvent(event) }); var toWindowMethodNameMap = {}; return toWindowMethodNameMap.unhandledRejection = "onunhandledRejection".toLowerCase(), toWindowMethodNameMap.rejectionHandled = "onrejectionHandled".toLowerCase(), function (name, reason, promise) { var methodName = toWindowMethodNameMap[name], method = self[methodName]; return !!method && ("rejectionHandled" === name ? method.call(self, promise) : method.call(self, reason, promise), !0) } }(); return "undefined" != typeof console && "undefined" != typeof console.warn && (warn = function (message) { console.warn(message) }, util.isNode && process.stderr.isTTY ? warn = function (message) { process.stderr.write("" + message + "\n") } : util.isNode || "string" != typeof (new Error).stack || (warn = function (message) { console.warn("%c" + message, "color: red") })), CapturedTrace }}, { "./async.js": 2, "./util.js": 38 }], 8: [function (_dereq_, module, exports) { "use strict"; module.exports = function (NEXT_FILTER) { function CatchFilter(instances, callback, promise) { this._instances = instances, this._callback = callback, this._promise = promise } function safePredicate(predicate, e) { var safeObject = {}, retfilter = tryCatch(predicate).call(safeObject, e); if (retfilter === errorObj) return retfilter; var safeKeys = keys(safeObject); return safeKeys.length ? (errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"), errorObj) : retfilter } var util = _dereq_("./util.js"), errors = _dereq_("./errors.js"), tryCatch = util.tryCatch, errorObj = util.errorObj, keys = _dereq_("./es5.js").keys, TypeError = errors.TypeError; return CatchFilter.prototype.doFilter = function (e) { for (var cb = this._callback, promise = this._promise, boundTo = promise._boundValue(), i = 0, len = this._instances.length; i < len; ++i) { var item = this._instances[i], itemIsErrorType = item === Error || null != item && item.prototype instanceof Error; if (itemIsErrorType && e instanceof item) { var ret = tryCatch(cb).call(boundTo, e); return ret === errorObj ? (NEXT_FILTER.e = ret.e, NEXT_FILTER) : ret } if ("function" == typeof item && !itemIsErrorType) { var shouldHandle = safePredicate(item, e); if (shouldHandle === errorObj) { e = errorObj.e; break } if (shouldHandle) { var ret = tryCatch(cb).call(boundTo, e); return ret === errorObj ? (NEXT_FILTER.e = ret.e, NEXT_FILTER) : ret } } } return NEXT_FILTER.e = e, NEXT_FILTER }, CatchFilter } }, { "./errors.js": 13, "./es5.js": 14, "./util.js": 38 }], 9: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, CapturedTrace, isDebugging) { function Context() { this._trace = new CapturedTrace(peekContext()) } function createContext() { if (isDebugging()) return new Context } function peekContext() { var lastIndex = contextStack.length - 1; if (lastIndex >= 0) return contextStack[lastIndex] } var contextStack = []; return Context.prototype._pushContext = function () { isDebugging() && void 0 !== this._trace && contextStack.push(this._trace) }, Context.prototype._popContext = function () { isDebugging() && void 0 !== this._trace && contextStack.pop() }, Promise.prototype._peekContext = peekContext, Promise.prototype._pushContext = Context.prototype._pushContext, Promise.prototype._popContext = Context.prototype._popContext, createContext } }, {}], 10: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, CapturedTrace) { var unhandledRejectionHandled, possiblyUnhandledRejection, getDomain = Promise._getDomain, async = _dereq_("./async.js"), Warning = _dereq_("./errors.js").Warning, util = _dereq_("./util.js"), canAttachTrace = util.canAttachTrace, debugging = util.isNode && (!!process.env.BLUEBIRD_DEBUG || "development" === process.env.NODE_ENV); return util.isNode && 0 == process.env.BLUEBIRD_DEBUG && (debugging = !1), debugging && async.disableTrampolineIfNecessary(), Promise.prototype._ignoreRejections = function () { this._unsetRejectionIsUnhandled(), this._bitField = 16777216 | this._bitField }, Promise.prototype._ensurePossibleRejectionHandled = function () { 0 === (16777216 & this._bitField) && (this._setRejectionIsUnhandled(), async.invokeLater(this._notifyUnhandledRejection, this, void 0)) }, Promise.prototype._notifyUnhandledRejectionIsHandled = function () { CapturedTrace.fireRejectionEvent("rejectionHandled", unhandledRejectionHandled, void 0, this) }, Promise.prototype._notifyUnhandledRejection = function () { if (this._isRejectionUnhandled()) { var reason = this._getCarriedStackTrace() || this._settledValue; this._setUnhandledRejectionIsNotified(), CapturedTrace.fireRejectionEvent("unhandledRejection", possiblyUnhandledRejection, reason, this) } }, Promise.prototype._setUnhandledRejectionIsNotified = function () { this._bitField = 524288 | this._bitField }, Promise.prototype._unsetUnhandledRejectionIsNotified = function () { this._bitField = this._bitField & -524289 }, Promise.prototype._isUnhandledRejectionNotified = function () { return (524288 & this._bitField) > 0 }, Promise.prototype._setRejectionIsUnhandled = function () { this._bitField = 2097152 | this._bitField }, Promise.prototype._unsetRejectionIsUnhandled = function () { this._bitField = this._bitField & -2097153, this._isUnhandledRejectionNotified() && (this._unsetUnhandledRejectionIsNotified(), this._notifyUnhandledRejectionIsHandled()) }, Promise.prototype._isRejectionUnhandled = function () { return (2097152 & this._bitField) > 0 }, Promise.prototype._setCarriedStackTrace = function (capturedTrace) { this._bitField = 1048576 | this._bitField, this._fulfillmentHandler0 = capturedTrace }, Promise.prototype._isCarryingStackTrace = function () { return (1048576 & this._bitField) > 0 }, Promise.prototype._getCarriedStackTrace = function () { return this._isCarryingStackTrace() ? this._fulfillmentHandler0 : void 0 }, Promise.prototype._captureStackTrace = function () { return debugging && (this._trace = new CapturedTrace(this._peekContext())), this }, Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { if (debugging && canAttachTrace(error)) { var trace = this._trace; if (void 0 !== trace && ignoreSelf && (trace = trace._parent), void 0 !== trace) trace.attachExtraTrace(error); else if (!error.__stackCleaned__) { var parsed = CapturedTrace.parseStackAndMessage(error); util.notEnumerableProp(error, "stack", parsed.message + "\n" + parsed.stack.join("\n")), util.notEnumerableProp(error, "__stackCleaned__", !0) } } }, Promise.prototype._warn = function (message) { var warning = new Warning(message), ctx = this._peekContext(); if (ctx) ctx.attachExtraTrace(warning); else { var parsed = CapturedTrace.parseStackAndMessage(warning); warning.stack = parsed.message + "\n" + parsed.stack.join("\n") } CapturedTrace.formatAndLogError(warning, "") }, Promise.onPossiblyUnhandledRejection = function (fn) { var domain = getDomain(); possiblyUnhandledRejection = "function" == typeof fn ? null === domain ? fn : domain.bind(fn) : void 0 }, Promise.onUnhandledRejectionHandled = function (fn) { var domain = getDomain(); unhandledRejectionHandled = "function" == typeof fn ? null === domain ? fn : domain.bind(fn) : void 0 }, Promise.longStackTraces = function () { if (async.haveItemsQueued() && debugging === !1) throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/DT1qyG\n"); debugging = CapturedTrace.isSupported(), debugging && async.disableTrampolineIfNecessary() }, Promise.hasLongStackTraces = function () { return debugging && CapturedTrace.isSupported() }, CapturedTrace.isSupported() || (Promise.longStackTraces = function () { }, debugging = !1), function () { return debugging } } }, { "./async.js": 2, "./errors.js": 13, "./util.js": 38 }], 11: [function (_dereq_, module, exports) { "use strict"; var util = _dereq_("./util.js"), isPrimitive = util.isPrimitive; module.exports = function (Promise) { var returner = function () { return this }, thrower = function () { throw this }, returnUndefined = function () { }, throwUndefined = function () { throw void 0 }, wrapper = function (value, action) { return 1 === action ? function () { throw value } : 2 === action ? function () { return value } : void 0 }; Promise.prototype.return = Promise.prototype.thenReturn = function (value) { return void 0 === value ? this.then(returnUndefined) : isPrimitive(value) ? this._then(wrapper(value, 2), void 0, void 0, void 0, void 0) : (value instanceof Promise && value._ignoreRejections(), this._then(returner, void 0, void 0, value, void 0)) }, Promise.prototype.throw = Promise.prototype.thenThrow = function (reason) { return void 0 === reason ? this.then(throwUndefined) : isPrimitive(reason) ? this._then(wrapper(reason, 1), void 0, void 0, void 0, void 0) : this._then(thrower, void 0, void 0, reason, void 0) } } }, { "./util.js": 38 }], 12: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { var PromiseReduce = Promise.reduce; Promise.prototype.each = function (fn) { return PromiseReduce(this, fn, null, INTERNAL) }, Promise.each = function (promises, fn) { return PromiseReduce(promises, fn, null, INTERNAL) } } }, {}], 13: [function (_dereq_, module, exports) { "use strict"; function subError(nameProperty, defaultMessage) { function SubError(message) { return this instanceof SubError ? (notEnumerableProp(this, "message", "string" == typeof message ? message : defaultMessage), notEnumerableProp(this, "name", nameProperty), void (Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : Error.call(this))) : new SubError(message) } return inherits(SubError, Error), SubError } function OperationalError(message) { return this instanceof OperationalError ? (notEnumerableProp(this, "name", "OperationalError"), notEnumerableProp(this, "message", message), this.cause = message, this.isOperational = !0, void (message instanceof Error ? (notEnumerableProp(this, "message", message.message), notEnumerableProp(this, "stack", message.stack)) : Error.captureStackTrace && Error.captureStackTrace(this, this.constructor))) : new OperationalError(message) } var _TypeError, _RangeError, es5 = _dereq_("./es5.js"), Objectfreeze = es5.freeze, util = _dereq_("./util.js"), inherits = util.inherits, notEnumerableProp = util.notEnumerableProp, Warning = subError("Warning", "warning"), CancellationError = subError("CancellationError", "cancellation error"), TimeoutError = subError("TimeoutError", "timeout error"), AggregateError = subError("AggregateError", "aggregate error"); try { _TypeError = TypeError, _RangeError = RangeError } catch (e) { _TypeError = subError("TypeError", "type error"), _RangeError = subError("RangeError", "range error") } for (var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "), i = 0; i < methods.length; ++i)"function" == typeof Array.prototype[methods[i]] && (AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]); es5.defineProperty(AggregateError.prototype, "length", { value: 0, configurable: !1, writable: !0, enumerable: !0 }), AggregateError.prototype.isOperational = !0; var level = 0; AggregateError.prototype.toString = function () { var indent = Array(4 * level + 1).join(" "), ret = "\n" + indent + "AggregateError of:\n"; level++ , indent = Array(4 * level + 1).join(" "); for (var i = 0; i < this.length; ++i) { for (var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "", lines = str.split("\n"), j = 0; j < lines.length; ++j)lines[j] = indent + lines[j]; str = lines.join("\n"), ret += str + "\n" } return level-- , ret }, inherits(OperationalError, Error); var errorTypes = Error.__BluebirdErrorTypes__; errorTypes || (errorTypes = Objectfreeze({ CancellationError: CancellationError, TimeoutError: TimeoutError, OperationalError: OperationalError, RejectionError: OperationalError, AggregateError: AggregateError }), notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes)), module.exports = { Error: Error, TypeError: _TypeError, RangeError: _RangeError, CancellationError: errorTypes.CancellationError, OperationalError: errorTypes.OperationalError, TimeoutError: errorTypes.TimeoutError, AggregateError: errorTypes.AggregateError, Warning: Warning } }, { "./es5.js": 14, "./util.js": 38 }], 14: [function (_dereq_, module, exports) { var isES5 = function () { "use strict"; return void 0 === this }(); if (isES5) module.exports = { freeze: Object.freeze, defineProperty: Object.defineProperty, getDescriptor: Object.getOwnPropertyDescriptor, keys: Object.keys, names: Object.getOwnPropertyNames, getPrototypeOf: Object.getPrototypeOf, isArray: Array.isArray, isES5: isES5, propertyIsWritable: function (obj, prop) { var descriptor = Object.getOwnPropertyDescriptor(obj, prop); return !(descriptor && !descriptor.writable && !descriptor.set) } }; else { var has = {}.hasOwnProperty, str = {}.toString, proto = {}.constructor.prototype, ObjectKeys = function (o) { var ret = []; for (var key in o) has.call(o, key) && ret.push(key); return ret }, ObjectGetDescriptor = function (o, key) { return { value: o[key] } }, ObjectDefineProperty = function (o, key, desc) { return o[key] = desc.value, o }, ObjectFreeze = function (obj) { return obj }, ObjectGetPrototypeOf = function (obj) { try { return Object(obj).constructor.prototype } catch (e) { return proto } }, ArrayIsArray = function (obj) { try { return "[object Array]" === str.call(obj) } catch (e) { return !1 } }; module.exports = { isArray: ArrayIsArray, keys: ObjectKeys, names: ObjectKeys, defineProperty: ObjectDefineProperty, getDescriptor: ObjectGetDescriptor, freeze: ObjectFreeze, getPrototypeOf: ObjectGetPrototypeOf, isES5: isES5, propertyIsWritable: function () { return !0 } } } }, {}], 15: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { var PromiseMap = Promise.map; Promise.prototype.filter = function (fn, options) { return PromiseMap(this, fn, options, INTERNAL) }, Promise.filter = function (promises, fn, options) { return PromiseMap(promises, fn, options, INTERNAL) } } }, {}], 16: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, NEXT_FILTER, tryConvertToPromise) { function returnThis() { return this } function throwThis() { throw this } function return$(r) { return function () { return r } } function throw$(r) { return function () { throw r } } function promisedFinally(ret, reasonOrValue, isFulfilled) { var then; return then = isPrimitive(reasonOrValue) ? isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue) : isFulfilled ? returnThis : throwThis, ret._then(then, thrower, void 0, reasonOrValue, void 0) } function finallyHandler(reasonOrValue) { var promise = this.promise, handler = this.handler, ret = promise._isBound() ? handler.call(promise._boundValue()) : handler(); if (void 0 !== ret) { var maybePromise = tryConvertToPromise(ret, promise); if (maybePromise instanceof Promise) return maybePromise = maybePromise._target(), promisedFinally(maybePromise, reasonOrValue, promise.isFulfilled()) } return promise.isRejected() ? (NEXT_FILTER.e = reasonOrValue, NEXT_FILTER) : reasonOrValue } function tapHandler(value) { var promise = this.promise, handler = this.handler, ret = promise._isBound() ? handler.call(promise._boundValue(), value) : handler(value); if (void 0 !== ret) { var maybePromise = tryConvertToPromise(ret, promise); if (maybePromise instanceof Promise) return maybePromise = maybePromise._target(), promisedFinally(maybePromise, value, !0) } return value } var util = _dereq_("./util.js"), isPrimitive = util.isPrimitive, thrower = util.thrower; Promise.prototype._passThroughHandler = function (handler, isFinally) { if ("function" != typeof handler) return this.then(); var promiseAndHandler = { promise: this, handler: handler }; return this._then(isFinally ? finallyHandler : tapHandler, isFinally ? finallyHandler : void 0, void 0, promiseAndHandler, void 0) }, Promise.prototype.lastly = Promise.prototype.finally = function (handler) { return this._passThroughHandler(handler, !0) }, Promise.prototype.tap = function (handler) { return this._passThroughHandler(handler, !1) } } }, { "./util.js": 38 }], 17: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, apiRejection, INTERNAL, tryConvertToPromise) { function promiseFromYieldHandler(value, yieldHandlers, traceParent) { for (var i = 0; i < yieldHandlers.length; ++i) { traceParent._pushContext(); var result = tryCatch(yieldHandlers[i])(value); if (traceParent._popContext(), result === errorObj) { traceParent._pushContext(); var ret = Promise.reject(errorObj.e); return traceParent._popContext(), ret } var maybePromise = tryConvertToPromise(result, traceParent); if (maybePromise instanceof Promise) return maybePromise } return null } function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { var promise = this._promise = new Promise(INTERNAL); promise._captureStackTrace(), this._stack = stack, this._generatorFunction = generatorFunction, this._receiver = receiver, this._generator = void 0, this._yieldHandlers = "function" == typeof yieldHandler ? [yieldHandler].concat(yieldHandlers) : yieldHandlers } var errors = _dereq_("./errors.js"), TypeError = errors.TypeError, util = _dereq_("./util.js"), errorObj = util.errorObj, tryCatch = util.tryCatch, yieldHandlers = []; PromiseSpawn.prototype.promise = function () { return this._promise }, PromiseSpawn.prototype._run = function () { this._generator = this._generatorFunction.call(this._receiver), this._receiver = this._generatorFunction = void 0, this._next(void 0) }, PromiseSpawn.prototype._continue = function (result) { if (result === errorObj) return this._promise._rejectCallback(result.e, !1, !0); var value = result.value; if (result.done === !0) this._promise._resolveCallback(value); else { var maybePromise = tryConvertToPromise(value, this._promise); if (!(maybePromise instanceof Promise) && (maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise), null === maybePromise)) return void this._throw(new TypeError("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/4Y4pDk\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n"))); maybePromise._then(this._next, this._throw, void 0, this, null) } }, PromiseSpawn.prototype._throw = function (reason) { this._promise._attachExtraTrace(reason), this._promise._pushContext(); var result = tryCatch(this._generator.throw).call(this._generator, reason); this._promise._popContext(), this._continue(result) }, PromiseSpawn.prototype._next = function (value) { this._promise._pushContext(); var result = tryCatch(this._generator.next).call(this._generator, value); this._promise._popContext(), this._continue(result) }, Promise.coroutine = function (generatorFunction, options) { if ("function" != typeof generatorFunction) throw new TypeError("generatorFunction must be a function\n\n See http://goo.gl/6Vqhm0\n"); var yieldHandler = Object(options).yieldHandler, PromiseSpawn$ = PromiseSpawn, stack = (new Error).stack; return function () { var generator = generatorFunction.apply(this, arguments), spawn = new PromiseSpawn$(void 0, void 0, yieldHandler, stack); return spawn._generator = generator, spawn._next(void 0), spawn.promise() } }, Promise.coroutine.addYieldHandler = function (fn) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); yieldHandlers.push(fn) }, Promise.spawn = function (generatorFunction) { if ("function" != typeof generatorFunction) return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/6Vqhm0\n"); var spawn = new PromiseSpawn(generatorFunction, this), ret = spawn.promise(); return spawn._run(Promise.spawn), ret } } }, { "./errors.js": 13, "./util.js": 38 }], 18: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, tryConvertToPromise, INTERNAL) { var util = _dereq_("./util.js"); util.canEvaluate, util.tryCatch, util.errorObj; Promise.join = function () { var fn, last = arguments.length - 1; if (last > 0 && "function" == typeof arguments[last]) { fn = arguments[last]; var ret } for (var $_len = arguments.length, args = new Array($_len), $_i = 0; $_i < $_len; ++$_i)args[$_i] = arguments[$_i]; fn && args.pop(); var ret = new PromiseArray(args).promise(); return void 0 !== fn ? ret.spread(fn) : ret } } }, { "./util.js": 38 }], 19: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL) { function MappingPromiseArray(promises, fn, limit, _filter) { this.constructor$(promises), this._promise._captureStackTrace(); var domain = getDomain(); this._callback = null === domain ? fn : domain.bind(fn), this._preservedValues = _filter === INTERNAL ? new Array(this.length()) : null, this._limit = limit, this._inFlight = 0, this._queue = limit >= 1 ? [] : EMPTY_ARRAY, async.invoke(init, this, void 0) } function init() { this._init$(void 0, -2) } function map(promises, fn, options, _filter) { var limit = "object" == typeof options && null !== options ? options.concurrency : 0; return limit = "number" == typeof limit && isFinite(limit) && limit >= 1 ? limit : 0, new MappingPromiseArray(promises, fn, limit, _filter) } var getDomain = Promise._getDomain, async = _dereq_("./async.js"), util = _dereq_("./util.js"), tryCatch = util.tryCatch, errorObj = util.errorObj, PENDING = {}, EMPTY_ARRAY = []; util.inherits(MappingPromiseArray, PromiseArray), MappingPromiseArray.prototype._init = function () { }, MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { var values = this._values, length = this.length(), preservedValues = this._preservedValues, limit = this._limit; if (values[index] === PENDING) { if (values[index] = value, limit >= 1 && (this._inFlight-- , this._drainQueue(), this._isResolved())) return } else { if (limit >= 1 && this._inFlight >= limit) return values[index] = value, void this._queue.push(index); null !== preservedValues && (preservedValues[index] = value); var callback = this._callback, receiver = this._promise._boundValue(); this._promise._pushContext(); var ret = tryCatch(callback).call(receiver, value, index, length); if (this._promise._popContext(), ret === errorObj) return this._reject(ret.e); var maybePromise = tryConvertToPromise(ret, this._promise); if (maybePromise instanceof Promise) { if (maybePromise = maybePromise._target(), maybePromise._isPending()) return limit >= 1 && this._inFlight++ , values[index] = PENDING, maybePromise._proxyPromiseArray(this, index); if (!maybePromise._isFulfilled()) return this._reject(maybePromise._reason()); ret = maybePromise._value() } values[index] = ret } var totalResolved = ++this._totalResolved; totalResolved >= length && (null !== preservedValues ? this._filter(values, preservedValues) : this._resolve(values)) }, MappingPromiseArray.prototype._drainQueue = function () { for (var queue = this._queue, limit = this._limit, values = this._values; queue.length > 0 && this._inFlight < limit;) { if (this._isResolved()) return; var index = queue.pop(); this._promiseFulfilled(values[index], index) } }, MappingPromiseArray.prototype._filter = function (booleans, values) { for (var len = values.length, ret = new Array(len), j = 0, i = 0; i < len; ++i)booleans[i] && (ret[j++] = values[i]); ret.length = j, this._resolve(ret) }, MappingPromiseArray.prototype.preservedValues = function () { return this._preservedValues }, Promise.prototype.map = function (fn, options) { return "function" != typeof fn ? apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n") : map(this, fn, options, null).promise() }, Promise.map = function (promises, fn, options, _filter) { return "function" != typeof fn ? apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n") : map(promises, fn, options, _filter).promise() } } }, { "./async.js": 2, "./util.js": 38 }], 20: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { var util = _dereq_("./util.js"), tryCatch = util.tryCatch; Promise.method = function (fn) { if ("function" != typeof fn) throw new Promise.TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); return function () { var ret = new Promise(INTERNAL); ret._captureStackTrace(), ret._pushContext(); var value = tryCatch(fn).apply(this, arguments); return ret._popContext(), ret._resolveFromSyncValue(value), ret } }, Promise.attempt = Promise.try = function (fn, args, ctx) { if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var ret = new Promise(INTERNAL); ret._captureStackTrace(), ret._pushContext(); var value = util.isArray(args) ? tryCatch(fn).apply(ctx, args) : tryCatch(fn).call(ctx, args); return ret._popContext(), ret._resolveFromSyncValue(value), ret }, Promise.prototype._resolveFromSyncValue = function (value) { value === util.errorObj ? this._rejectCallback(value.e, !1, !0) : this._resolveCallback(value, !0) } } }, { "./util.js": 38 }], 21: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function spreadAdapter(val, nodeback) { var promise = this; if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); var ret = tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); ret === errorObj && async.throwLater(ret.e) } function successAdapter(val, nodeback) { var promise = this, receiver = promise._boundValue(), ret = void 0 === val ? tryCatch(nodeback).call(receiver, null) : tryCatch(nodeback).call(receiver, null, val); ret === errorObj && async.throwLater(ret.e) } function errorAdapter(reason, nodeback) { var promise = this; if (!reason) { var target = promise._target(), newReason = target._getCarriedStackTrace(); newReason.cause = reason, reason = newReason } var ret = tryCatch(nodeback).call(promise._boundValue(), reason); ret === errorObj && async.throwLater(ret.e) } var util = _dereq_("./util.js"), async = _dereq_("./async.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, options) { if ("function" == typeof nodeback) { var adapter = successAdapter; void 0 !== options && Object(options).spread && (adapter = spreadAdapter), this._then(adapter, errorAdapter, void 0, this, nodeback) } return this } } }, { "./async.js": 2, "./util.js": 38 }], 22: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray) { var util = _dereq_("./util.js"), async = _dereq_("./async.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; Promise.prototype.progressed = function (handler) { return this._then(void 0, void 0, handler, void 0, void 0) }, Promise.prototype._progress = function (progressValue) { this._isFollowingOrFulfilledOrRejected() || this._target()._progressUnchecked(progressValue) }, Promise.prototype._progressHandlerAt = function (index) { return 0 === index ? this._progressHandler0 : this[(index << 2) + index - 5 + 2] }, Promise.prototype._doProgressWith = function (progression) { var progressValue = progression.value, handler = progression.handler, promise = progression.promise, receiver = progression.receiver, ret = tryCatch(handler).call(receiver, progressValue); if (ret === errorObj) { if (null != ret.e && "StopProgressPropagation" !== ret.e.name) { var trace = util.canAttachTrace(ret.e) ? ret.e : new Error(util.toString(ret.e)); promise._attachExtraTrace(trace), promise._progress(ret.e) } } else ret instanceof Promise ? ret._then(promise._progress, null, null, promise, void 0) : promise._progress(ret) }, Promise.prototype._progressUnchecked = function (progressValue) { for (var len = this._length(), progress = this._progress, i = 0; i < len; i++) { var handler = this._progressHandlerAt(i), promise = this._promiseAt(i); if (promise instanceof Promise) "function" == typeof handler ? async.invoke(this._doProgressWith, this, { handler: handler, promise: promise, receiver: this._receiverAt(i), value: progressValue }) : async.invoke(progress, promise, progressValue); else { var receiver = this._receiverAt(i); "function" == typeof handler ? handler.call(receiver, progressValue, promise) : receiver instanceof PromiseArray && !receiver._isResolved() && receiver._promiseProgressed(progressValue, promise) } } } } }, { "./async.js": 2, "./util.js": 38 }], 23: [function (_dereq_, module, exports) { "use strict"; module.exports = function () { function Promise(resolver) { if ("function" != typeof resolver) throw new TypeError("the promise constructor requires a resolver function\n\n See http://goo.gl/EC22Yn\n"); if (this.constructor !== Promise) throw new TypeError("the promise constructor cannot be invoked directly\n\n See http://goo.gl/KsIlge\n"); this._bitField = 0, this._fulfillmentHandler0 = void 0, this._rejectionHandler0 = void 0, this._progressHandler0 = void 0, this._promise0 = void 0, this._receiver0 = void 0, this._settledValue = void 0, resolver !== INTERNAL && this._resolveFromResolver(resolver) } function fillTypes(value) { var p = new Promise(INTERNAL); p._fulfillmentHandler0 = value, p._rejectionHandler0 = value, p._progressHandler0 = value, p._promise0 = value, p._receiver0 = value, p._settledValue = value } var getDomain, makeSelfResolutionError = function () { return new TypeError("circular promise resolution chain\n\n See http://goo.gl/LhFpo0\n") }, reflect = function () { return new Promise.PromiseInspection(this._target()) }, apiRejection = function (msg) { return Promise.reject(new TypeError(msg)) }, util = _dereq_("./util.js"); getDomain = util.isNode ? function () { var ret = process.domain; return void 0 === ret && (ret = null), ret } : function () { return null }, util.notEnumerableProp(Promise, "_getDomain", getDomain); var UNDEFINED_BINDING = {}, async = _dereq_("./async.js"), errors = _dereq_("./errors.js"), TypeError = Promise.TypeError = errors.TypeError; Promise.RangeError = errors.RangeError, Promise.CancellationError = errors.CancellationError, Promise.TimeoutError = errors.TimeoutError, Promise.OperationalError = errors.OperationalError, Promise.RejectionError = errors.OperationalError, Promise.AggregateError = errors.AggregateError; var INTERNAL = function () { }, APPLY = {}, NEXT_FILTER = { e: null }, tryConvertToPromise = _dereq_("./thenables.js")(Promise, INTERNAL), PromiseArray = _dereq_("./promise_array.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), CapturedTrace = _dereq_("./captured_trace.js")(), isDebugging = _dereq_("./debuggability.js")(Promise, CapturedTrace), createContext = _dereq_("./context.js")(Promise, CapturedTrace, isDebugging), CatchFilter = _dereq_("./catch_filter.js")(NEXT_FILTER), PromiseResolver = _dereq_("./promise_resolver.js"), nodebackForPromise = PromiseResolver._nodebackForPromise, errorObj = util.errorObj, tryCatch = util.tryCatch; return Promise.prototype.toString = function () { return "[object Promise]" }, Promise.prototype.caught = Promise.prototype.catch = function (fn) { var len = arguments.length; if (len > 1) { var i, catchInstances = new Array(len - 1), j = 0; for (i = 0; i < len - 1; ++i) { var item = arguments[i]; if ("function" != typeof item) return Promise.reject(new TypeError("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n")); catchInstances[j++] = item } catchInstances.length = j, fn = arguments[i]; var catchFilter = new CatchFilter(catchInstances, fn, this); return this._then(void 0, catchFilter.doFilter, void 0, catchFilter, void 0) } return this._then(void 0, fn, void 0, void 0, void 0) }, Promise.prototype.reflect = function () { return this._then(reflect, reflect, void 0, this, void 0) }, Promise.prototype.then = function (didFulfill, didReject, didProgress) { if (isDebugging() && arguments.length > 0 && "function" != typeof didFulfill && "function" != typeof didReject) { var msg = ".then() only accepts functions but was passed: " + util.classString(didFulfill); arguments.length > 1 && (msg += ", " + util.classString(didReject)), this._warn(msg) } return this._then(didFulfill, didReject, didProgress, void 0, void 0) }, Promise.prototype.done = function (didFulfill, didReject, didProgress) { var promise = this._then(didFulfill, didReject, didProgress, void 0, void 0); promise._setIsFinal() }, Promise.prototype.spread = function (didFulfill, didReject) { return this.all()._then(didFulfill, didReject, void 0, APPLY, void 0) }, Promise.prototype.isCancellable = function () { return !this.isResolved() && this._cancellable() }, Promise.prototype.toJSON = function () { var ret = { isFulfilled: !1, isRejected: !1, fulfillmentValue: void 0, rejectionReason: void 0 }; return this.isFulfilled() ? (ret.fulfillmentValue = this.value(), ret.isFulfilled = !0) : this.isRejected() && (ret.rejectionReason = this.reason(), ret.isRejected = !0), ret }, Promise.prototype.all = function () { return new PromiseArray(this).promise() }, Promise.prototype.error = function (fn) { return this.caught(util.originatesFromRejection, fn) }, Promise.getNewLibraryCopy = module.exports, Promise.is = function (val) { return val instanceof Promise }, Promise.fromNode = function (fn) { var ret = new Promise(INTERNAL), result = tryCatch(fn)(nodebackForPromise(ret)); return result === errorObj && ret._rejectCallback(result.e, !0, !0), ret }, Promise.all = function (promises) { return new PromiseArray(promises).promise() }, Promise.defer = Promise.pending = function () { var promise = new Promise(INTERNAL); return new PromiseResolver(promise) }, Promise.cast = function (obj) { var ret = tryConvertToPromise(obj); if (!(ret instanceof Promise)) { var val = ret; ret = new Promise(INTERNAL), ret._fulfillUnchecked(val) } return ret }, Promise.resolve = Promise.fulfilled = Promise.cast, Promise.reject = Promise.rejected = function (reason) { var ret = new Promise(INTERNAL); return ret._captureStackTrace(), ret._rejectCallback(reason, !0), ret }, Promise.setScheduler = function (fn) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var prev = async._schedule; return async._schedule = fn, prev }, Promise.prototype._then = function (didFulfill, didReject, didProgress, receiver, internalData) { var haveInternalData = void 0 !== internalData, ret = haveInternalData ? internalData : new Promise(INTERNAL); haveInternalData || (ret._propagateFrom(this, 5), ret._captureStackTrace()); var target = this._target(); target !== this && (void 0 === receiver && (receiver = this._boundTo), haveInternalData || ret._setIsMigrated()); var callbackIndex = target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver, getDomain()); return target._isResolved() && !target._isSettlePromisesQueued() && async.invoke(target._settlePromiseAtPostResolution, target, callbackIndex), ret }, Promise.prototype._settlePromiseAtPostResolution = function (index) { this._isRejectionUnhandled() && this._unsetRejectionIsUnhandled(), this._settlePromiseAt(index) }, Promise.prototype._length = function () { return 131071 & this._bitField }, Promise.prototype._isFollowingOrFulfilledOrRejected = function () { return (939524096 & this._bitField) > 0 }, Promise.prototype._isFollowing = function () { return 536870912 === (536870912 & this._bitField) }, Promise.prototype._setLength = function (len) { this._bitField = this._bitField & -131072 | 131071 & len }, Promise.prototype._setFulfilled = function () { this._bitField = 268435456 | this._bitField }, Promise.prototype._setRejected = function () { this._bitField = 134217728 | this._bitField }, Promise.prototype._setFollowing = function () { this._bitField = 536870912 | this._bitField }, Promise.prototype._setIsFinal = function () { this._bitField = 33554432 | this._bitField }, Promise.prototype._isFinal = function () { return (33554432 & this._bitField) > 0 }, Promise.prototype._cancellable = function () { return (67108864 & this._bitField) > 0 }, Promise.prototype._setCancellable = function () { this._bitField = 67108864 | this._bitField }, Promise.prototype._unsetCancellable = function () { this._bitField = this._bitField & -67108865 }, Promise.prototype._setIsMigrated = function () { this._bitField = 4194304 | this._bitField }, Promise.prototype._unsetIsMigrated = function () { this._bitField = this._bitField & -4194305 }, Promise.prototype._isMigrated = function () { return (4194304 & this._bitField) > 0 }, Promise.prototype._receiverAt = function (index) { var ret = 0 === index ? this._receiver0 : this[5 * index - 5 + 4]; if (ret !== UNDEFINED_BINDING) return void 0 === ret && this._isBound() ? this._boundValue() : ret }, Promise.prototype._promiseAt = function (index) { return 0 === index ? this._promise0 : this[5 * index - 5 + 3] }, Promise.prototype._fulfillmentHandlerAt = function (index) { return 0 === index ? this._fulfillmentHandler0 : this[5 * index - 5 + 0] }, Promise.prototype._rejectionHandlerAt = function (index) { return 0 === index ? this._rejectionHandler0 : this[5 * index - 5 + 1] }, Promise.prototype._boundValue = function () { var ret = this._boundTo; return void 0 !== ret && ret instanceof Promise ? ret.isFulfilled() ? ret.value() : void 0 : ret }, Promise.prototype._migrateCallbacks = function (follower, index) { var fulfill = follower._fulfillmentHandlerAt(index), reject = follower._rejectionHandlerAt(index), progress = follower._progressHandlerAt(index), promise = follower._promiseAt(index), receiver = follower._receiverAt(index); promise instanceof Promise && promise._setIsMigrated(), void 0 === receiver && (receiver = UNDEFINED_BINDING), this._addCallbacks(fulfill, reject, progress, promise, receiver, null) }, Promise.prototype._addCallbacks = function (fulfill, reject, progress, promise, receiver, domain) { var index = this._length(); if (index >= 131066 && (index = 0, this._setLength(0)), 0 === index) this._promise0 = promise, void 0 !== receiver && (this._receiver0 = receiver), "function" != typeof fulfill || this._isCarryingStackTrace() || (this._fulfillmentHandler0 = null === domain ? fulfill : domain.bind(fulfill)), "function" == typeof reject && (this._rejectionHandler0 = null === domain ? reject : domain.bind(reject)), "function" == typeof progress && (this._progressHandler0 = null === domain ? progress : domain.bind(progress)); else { var base = 5 * index - 5; this[base + 3] = promise, this[base + 4] = receiver, "function" == typeof fulfill && (this[base + 0] = null === domain ? fulfill : domain.bind(fulfill)), "function" == typeof reject && (this[base + 1] = null === domain ? reject : domain.bind(reject)), "function" == typeof progress && (this[base + 2] = null === domain ? progress : domain.bind(progress)) } return this._setLength(index + 1), index }, Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { var index = this._length(); if (index >= 131066 && (index = 0, this._setLength(0)), 0 === index) this._promise0 = promiseSlotValue, this._receiver0 = receiver; else { var base = 5 * index - 5; this[base + 3] = promiseSlotValue, this[base + 4] = receiver } this._setLength(index + 1) }, Promise.prototype._proxyPromiseArray = function (promiseArray, index) { this._setProxyHandlers(promiseArray, index) }, Promise.prototype._resolveCallback = function (value, shouldBind) { if (!this._isFollowingOrFulfilledOrRejected()) { if (value === this) return this._rejectCallback(makeSelfResolutionError(), !1, !0); var maybePromise = tryConvertToPromise(value, this); if (!(maybePromise instanceof Promise)) return this._fulfill(value); var propagationFlags = 1 | (shouldBind ? 4 : 0); this._propagateFrom(maybePromise, propagationFlags); var promise = maybePromise._target(); if (promise._isPending()) { for (var len = this._length(), i = 0; i < len; ++i)promise._migrateCallbacks(this, i); this._setFollowing(), this._setLength(0), this._setFollowee(promise) } else promise._isFulfilled() ? this._fulfillUnchecked(promise._value()) : this._rejectUnchecked(promise._reason(), promise._getCarriedStackTrace()) } }, Promise.prototype._rejectCallback = function (reason, synchronous, shouldNotMarkOriginatingFromRejection) { shouldNotMarkOriginatingFromRejection || util.markAsOriginatingFromRejection(reason); var trace = util.ensureErrorObject(reason), hasStack = trace === reason; this._attachExtraTrace(trace, !!synchronous && hasStack), this._reject(reason, hasStack ? void 0 : trace) }, Promise.prototype._resolveFromResolver = function (resolver) { var promise = this; this._captureStackTrace(), this._pushContext(); var synchronous = !0, r = tryCatch(resolver)(function (value) { null !== promise && (promise._resolveCallback(value), promise = null) }, function (reason) { null !== promise && (promise._rejectCallback(reason, synchronous), promise = null) }); synchronous = !1, this._popContext(), void 0 !== r && r === errorObj && null !== promise && (promise._rejectCallback(r.e, !0, !0), promise = null) }, Promise.prototype._settlePromiseFromHandler = function (handler, receiver, value, promise) { if (!promise._isRejected()) { promise._pushContext(); var x; if (x = receiver !== APPLY || this._isRejected() ? tryCatch(handler).call(receiver, value) : tryCatch(handler).apply(this._boundValue(), value), promise._popContext(), x === errorObj || x === promise || x === NEXT_FILTER) { var err = x === promise ? makeSelfResolutionError() : x.e; promise._rejectCallback(err, !1, !0) } else promise._resolveCallback(x) } }, Promise.prototype._target = function () { for (var ret = this; ret._isFollowing();)ret = ret._followee(); return ret }, Promise.prototype._followee = function () { return this._rejectionHandler0 }, Promise.prototype._setFollowee = function (promise) { this._rejectionHandler0 = promise }, Promise.prototype._cleanValues = function () { this._cancellable() && (this._cancellationParent = void 0) }, Promise.prototype._propagateFrom = function (parent, flags) { (1 & flags) > 0 && parent._cancellable() && (this._setCancellable(), this._cancellationParent = parent), (4 & flags) > 0 && parent._isBound() && this._setBoundTo(parent._boundTo) }, Promise.prototype._fulfill = function (value) { this._isFollowingOrFulfilledOrRejected() || this._fulfillUnchecked(value) }, Promise.prototype._reject = function (reason, carriedStackTrace) { this._isFollowingOrFulfilledOrRejected() || this._rejectUnchecked(reason, carriedStackTrace) }, Promise.prototype._settlePromiseAt = function (index) { var promise = this._promiseAt(index), isPromise = promise instanceof Promise; if (isPromise && promise._isMigrated()) return promise._unsetIsMigrated(), async.invoke(this._settlePromiseAt, this, index); var handler = this._isFulfilled() ? this._fulfillmentHandlerAt(index) : this._rejectionHandlerAt(index), carriedStackTrace = this._isCarryingStackTrace() ? this._getCarriedStackTrace() : void 0, value = this._settledValue, receiver = this._receiverAt(index); this._clearCallbackDataAtIndex(index), "function" == typeof handler ? isPromise ? this._settlePromiseFromHandler(handler, receiver, value, promise) : handler.call(receiver, value, promise) : receiver instanceof PromiseArray ? receiver._isResolved() || (this._isFulfilled() ? receiver._promiseFulfilled(value, promise) : receiver._promiseRejected(value, promise)) : isPromise && (this._isFulfilled() ? promise._fulfill(value) : promise._reject(value, carriedStackTrace)), index >= 4 && 4 === (31 & index) && async.invokeLater(this._setLength, this, 0) }, Promise.prototype._clearCallbackDataAtIndex = function (index) { if (0 === index) this._isCarryingStackTrace() || (this._fulfillmentHandler0 = void 0), this._rejectionHandler0 = this._progressHandler0 = this._receiver0 = this._promise0 = void 0; else { var base = 5 * index - 5; this[base + 3] = this[base + 4] = this[base + 0] = this[base + 1] = this[base + 2] = void 0 } }, Promise.prototype._isSettlePromisesQueued = function () { return (this._bitField & -1073741824) === -1073741824 }, Promise.prototype._setSettlePromisesQueued = function () { this._bitField = this._bitField | -1073741824 }, Promise.prototype._unsetSettlePromisesQueued = function () { this._bitField = 1073741823 & this._bitField }, Promise.prototype._queueSettlePromises = function () { async.settlePromises(this), this._setSettlePromisesQueued() }, Promise.prototype._fulfillUnchecked = function (value) { if (value === this) { var err = makeSelfResolutionError(); return this._attachExtraTrace(err), this._rejectUnchecked(err, void 0) } this._setFulfilled(), this._settledValue = value, this._cleanValues(), this._length() > 0 && this._queueSettlePromises() }, Promise.prototype._rejectUncheckedCheckError = function (reason) { var trace = util.ensureErrorObject(reason); this._rejectUnchecked(reason, trace === reason ? void 0 : trace) }, Promise.prototype._rejectUnchecked = function (reason, trace) { if (reason === this) { var err = makeSelfResolutionError(); return this._attachExtraTrace(err), this._rejectUnchecked(err) } return this._setRejected(), this._settledValue = reason, this._cleanValues(), this._isFinal() ? void async.throwLater(function (e) { throw "stack" in e && async.invokeFirst(CapturedTrace.unhandledRejection, void 0, e), e }, void 0 === trace ? reason : trace) : (void 0 !== trace && trace !== reason && this._setCarriedStackTrace(trace), void (this._length() > 0 ? this._queueSettlePromises() : this._ensurePossibleRejectionHandled())) }, Promise.prototype._settlePromises = function () { this._unsetSettlePromisesQueued(); for (var len = this._length(), i = 0; i < len; i++)this._settlePromiseAt(i) }, util.notEnumerableProp(Promise, "_makeSelfResolutionError", makeSelfResolutionError), _dereq_("./progress.js")(Promise, PromiseArray), _dereq_("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), _dereq_("./bind.js")(Promise, INTERNAL, tryConvertToPromise), _dereq_("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise), _dereq_("./direct_resolve.js")(Promise), _dereq_("./synchronous_inspection.js")(Promise), _dereq_("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL), Promise.version = "2.11.0", Promise.Promise = Promise, _dereq_("./map.js")(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL), _dereq_("./cancel.js")(Promise), _dereq_("./using.js")(Promise, apiRejection, tryConvertToPromise, createContext), _dereq_("./generators.js")(Promise, apiRejection, INTERNAL, tryConvertToPromise), _dereq_("./nodeify.js")(Promise), _dereq_("./call_get.js")(Promise), _dereq_("./props.js")(Promise, PromiseArray, tryConvertToPromise, apiRejection), _dereq_("./race.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), _dereq_("./reduce.js")(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL), _dereq_("./settle.js")(Promise, PromiseArray), _dereq_("./some.js")(Promise, PromiseArray, apiRejection), _dereq_("./promisify.js")(Promise, INTERNAL), _dereq_("./any.js")(Promise), _dereq_("./each.js")(Promise, INTERNAL), _dereq_("./timers.js")(Promise, INTERNAL), _dereq_("./filter.js")(Promise, INTERNAL), util.toFastProperties(Promise), util.toFastProperties(Promise.prototype), fillTypes({ a: 1 }), fillTypes({ b: 2 }), fillTypes({ c: 3 }), fillTypes(1), fillTypes(function () { }), fillTypes(void 0), fillTypes(!1), fillTypes(new Promise(INTERNAL)), CapturedTrace.setBounds(async.firstLineError, util.lastLineError), Promise } }, { "./any.js": 1, "./async.js": 2, "./bind.js": 3, "./call_get.js": 5, "./cancel.js": 6, "./captured_trace.js": 7, "./catch_filter.js": 8, "./context.js": 9, "./debuggability.js": 10, "./direct_resolve.js": 11, "./each.js": 12, "./errors.js": 13, "./filter.js": 15, "./finally.js": 16, "./generators.js": 17, "./join.js": 18, "./map.js": 19, "./method.js": 20, "./nodeify.js": 21, "./progress.js": 22, "./promise_array.js": 24, "./promise_resolver.js": 25, "./promisify.js": 26, "./props.js": 27, "./race.js": 29, "./reduce.js": 30, "./settle.js": 32, "./some.js": 33, "./synchronous_inspection.js": 34, "./thenables.js": 35, "./timers.js": 36, "./using.js": 37, "./util.js": 38 }], 24: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { function toResolutionValue(val) { switch (val) { case -2: return []; case -3: return {} } } function PromiseArray(values) { var parent, promise = this._promise = new Promise(INTERNAL); values instanceof Promise && (parent = values, promise._propagateFrom(parent, 5)), this._values = values, this._length = 0, this._totalResolved = 0, this._init(void 0, -2) } var util = _dereq_("./util.js"), isArray = util.isArray; return PromiseArray.prototype.length = function () { return this._length }, PromiseArray.prototype.promise = function () { return this._promise }, PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { var values = tryConvertToPromise(this._values, this._promise); if (values instanceof Promise) { if (values = values._target(), this._values = values, !values._isFulfilled()) return values._isPending() ? void values._then(init, this._reject, void 0, this, resolveValueIfEmpty) : void this._reject(values._reason()); if (values = values._value(), !isArray(values)) { var err = new Promise.TypeError("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n"); return void this.__hardReject__(err) } } else if (!isArray(values)) return void this._promise._reject(apiRejection("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n")._reason()); if (0 === values.length) return void (resolveValueIfEmpty === -5 ? this._resolveEmptyArray() : this._resolve(toResolutionValue(resolveValueIfEmpty))); var len = this.getActualLength(values.length); this._length = len, this._values = this.shouldCopyValues() ? new Array(len) : this._values; for (var promise = this._promise, i = 0; i < len; ++i) { var isResolved = this._isResolved(), maybePromise = tryConvertToPromise(values[i], promise); maybePromise instanceof Promise ? (maybePromise = maybePromise._target(), isResolved ? maybePromise._ignoreRejections() : maybePromise._isPending() ? maybePromise._proxyPromiseArray(this, i) : maybePromise._isFulfilled() ? this._promiseFulfilled(maybePromise._value(), i) : this._promiseRejected(maybePromise._reason(), i)) : isResolved || this._promiseFulfilled(maybePromise, i) } }, PromiseArray.prototype._isResolved = function () { return null === this._values }, PromiseArray.prototype._resolve = function (value) { this._values = null, this._promise._fulfill(value) }, PromiseArray.prototype.__hardReject__ = PromiseArray.prototype._reject = function (reason) { this._values = null, this._promise._rejectCallback(reason, !1, !0) }, PromiseArray.prototype._promiseProgressed = function (progressValue, index) { this._promise._progress({ index: index, value: progressValue }) }, PromiseArray.prototype._promiseFulfilled = function (value, index) { this._values[index] = value; var totalResolved = ++this._totalResolved; totalResolved >= this._length && this._resolve(this._values) }, PromiseArray.prototype._promiseRejected = function (reason, index) { this._totalResolved++ , this._reject(reason) }, PromiseArray.prototype.shouldCopyValues = function () { return !0 }, PromiseArray.prototype.getActualLength = function (len) { return len }, PromiseArray } }, { "./util.js": 38 }], 25: [function (_dereq_, module, exports) { "use strict"; function isUntypedError(obj) { return obj instanceof Error && es5.getPrototypeOf(obj) === Error.prototype } function wrapAsOperationalError(obj) { var ret; if (isUntypedError(obj)) { ret = new OperationalError(obj), ret.name = obj.name, ret.message = obj.message, ret.stack = obj.stack; for (var keys = es5.keys(obj), i = 0; i < keys.length; ++i) { var key = keys[i]; rErrorKey.test(key) || (ret[key] = obj[key]) } return ret } return util.markAsOriginatingFromRejection(obj), obj } function nodebackForPromise(promise) { return function (err, value) { if (null !== promise) { if (err) { var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); promise._attachExtraTrace(wrapped), promise._reject(wrapped) } else if (arguments.length > 2) { for (var $_len = arguments.length, args = new Array($_len - 1), $_i = 1; $_i < $_len; ++$_i)args[$_i - 1] = arguments[$_i]; promise._fulfill(args) } else promise._fulfill(value); promise = null } } } var PromiseResolver, util = _dereq_("./util.js"), maybeWrapAsError = util.maybeWrapAsError, errors = _dereq_("./errors.js"), TimeoutError = errors.TimeoutError, OperationalError = errors.OperationalError, haveGetters = util.haveGetters, es5 = _dereq_("./es5.js"), rErrorKey = /^(?:name|message|stack|cause)$/; if (PromiseResolver = haveGetters ? function (promise) { this.promise = promise } : function (promise) { this.promise = promise, this.asCallback = nodebackForPromise(promise), this.callback = this.asCallback }, haveGetters) { var prop = { get: function () { return nodebackForPromise(this.promise) } }; es5.defineProperty(PromiseResolver.prototype, "asCallback", prop), es5.defineProperty(PromiseResolver.prototype, "callback", prop) } PromiseResolver._nodebackForPromise = nodebackForPromise, PromiseResolver.prototype.toString = function () { return "[object PromiseResolver]" }, PromiseResolver.prototype.resolve = PromiseResolver.prototype.fulfill = function (value) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._resolveCallback(value) }, PromiseResolver.prototype.reject = function (reason) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._rejectCallback(reason) }, PromiseResolver.prototype.progress = function (value) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._progress(value) }, PromiseResolver.prototype.cancel = function (err) { this.promise.cancel(err) }, PromiseResolver.prototype.timeout = function () { this.reject(new TimeoutError("timeout")) }, PromiseResolver.prototype.isResolved = function () { return this.promise.isResolved() }, PromiseResolver.prototype.toJSON = function () { return this.promise.toJSON() }, module.exports = PromiseResolver }, { "./errors.js": 13, "./es5.js": 14, "./util.js": 38 }], 26: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function propsFilter(key) { return !noCopyPropsPattern.test(key) } function isPromisified(fn) { try { return fn.__isPromisified__ === !0 } catch (e) { return !1 } } function hasPromisified(obj, key, suffix) { var val = util.getDataPropertyOrDefault(obj, key + suffix, defaultPromisified); return !!val && isPromisified(val) } function checkValid(ret, suffix, suffixRegexp) { for (var i = 0; i < ret.length; i += 2) { var key = ret[i]; if (suffixRegexp.test(key)) for (var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""), j = 0; j < ret.length; j += 2)if (ret[j] === keyWithoutAsyncSuffix) throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/iWrZbw\n".replace("%s", suffix)) } } function promisifiableMethods(obj, suffix, suffixRegexp, filter) { for (var keys = util.inheritedDataKeys(obj), ret = [], i = 0; i < keys.length; ++i) { var key = keys[i], value = obj[key], passesDefaultFilter = filter === defaultFilter || defaultFilter(key, value, obj); "function" != typeof value || isPromisified(value) || hasPromisified(obj, key, suffix) || !filter(key, value, obj, passesDefaultFilter) || ret.push(key, value) } return checkValid(ret, suffix, suffixRegexp), ret } function makeNodePromisifiedClosure(callback, receiver, _, fn) { function promisified() { var _receiver = receiver; receiver === THIS && (_receiver = this); var promise = new Promise(INTERNAL); promise._captureStackTrace(); var cb = "string" == typeof method && this !== defaultThis ? this[method] : callback, fn = nodebackForPromise(promise); try { cb.apply(_receiver, withAppended(arguments, fn)) } catch (e) { promise._rejectCallback(maybeWrapAsError(e), !0, !0) } return promise } var defaultThis = function () { return this }(), method = callback; return "string" == typeof method && (callback = fn), util.notEnumerableProp(promisified, "__isPromisified__", !0), promisified } function promisifyAll(obj, suffix, filter, promisifier) { for (var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"), methods = promisifiableMethods(obj, suffix, suffixRegexp, filter), i = 0, len = methods.length; i < len; i += 2) { var key = methods[i], fn = methods[i + 1], promisifiedKey = key + suffix; if (promisifier === makeNodePromisified) obj[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix); else { var promisified = promisifier(fn, function () { return makeNodePromisified(key, THIS, key, fn, suffix) }); util.notEnumerableProp(promisified, "__isPromisified__", !0), obj[promisifiedKey] = promisified } } return util.toFastProperties(obj), obj } function promisify(callback, receiver) { return makeNodePromisified(callback, receiver, void 0, callback) } var makeNodePromisifiedEval, THIS = {}, util = _dereq_("./util.js"), nodebackForPromise = _dereq_("./promise_resolver.js")._nodebackForPromise, withAppended = util.withAppended, maybeWrapAsError = util.maybeWrapAsError, canEvaluate = util.canEvaluate, TypeError = _dereq_("./errors").TypeError, defaultSuffix = "Async", defaultPromisified = { __isPromisified__: !0 }, noCopyProps = ["arity", "length", "name", "arguments", "caller", "callee", "prototype", "__isPromisified__"], noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"), defaultFilter = function (name) { return util.isIdentifier(name) && "_" !== name.charAt(0) && "constructor" !== name }, escapeIdentRegex = function (str) { return str.replace(/([$])/, "\\$") }, makeNodePromisified = canEvaluate ? makeNodePromisifiedEval : makeNodePromisifiedClosure; Promise.promisify = function (fn, receiver) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); if (isPromisified(fn)) return fn; var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); return util.copyDescriptors(fn, ret, propsFilter), ret }, Promise.promisifyAll = function (target, options) { if ("function" != typeof target && "object" != typeof target) throw new TypeError("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/9ITlV0\n"); options = Object(options); var suffix = options.suffix; "string" != typeof suffix && (suffix = defaultSuffix); var filter = options.filter; "function" != typeof filter && (filter = defaultFilter); var promisifier = options.promisifier; if ("function" != typeof promisifier && (promisifier = makeNodePromisified), !util.isIdentifier(suffix)) throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/8FZo5V\n"); for (var keys = util.inheritedDataKeys(target), i = 0; i < keys.length; ++i) { var value = target[keys[i]]; "constructor" !== keys[i] && util.isClass(value) && (promisifyAll(value.prototype, suffix, filter, promisifier), promisifyAll(value, suffix, filter, promisifier)) } return promisifyAll(target, suffix, filter, promisifier) } } }, { "./errors": 13, "./promise_resolver.js": 25, "./util.js": 38 }], 27: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, tryConvertToPromise, apiRejection) { function PropertiesPromiseArray(obj) { for (var keys = es5.keys(obj), len = keys.length, values = new Array(2 * len), i = 0; i < len; ++i) { var key = keys[i]; values[i] = obj[key], values[i + len] = key } this.constructor$(values) } function props(promises) { var ret, castValue = tryConvertToPromise(promises); return isObject(castValue) ? (ret = castValue instanceof Promise ? castValue._then(Promise.props, void 0, void 0, void 0, void 0) : new PropertiesPromiseArray(castValue).promise(), castValue instanceof Promise && ret._propagateFrom(castValue, 4), ret) : apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/OsFKC8\n") } var util = _dereq_("./util.js"), isObject = util.isObject, es5 = _dereq_("./es5.js"); util.inherits(PropertiesPromiseArray, PromiseArray), PropertiesPromiseArray.prototype._init = function () { this._init$(void 0, -3) }, PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { this._values[index] = value; var totalResolved = ++this._totalResolved; if (totalResolved >= this._length) { for (var val = {}, keyOffset = this.length(), i = 0, len = this.length(); i < len; ++i)val[this._values[i + keyOffset]] = this._values[i]; this._resolve(val) } }, PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { this._promise._progress({ key: this._values[index + this.length()], value: value }) }, PropertiesPromiseArray.prototype.shouldCopyValues = function () { return !1 }, PropertiesPromiseArray.prototype.getActualLength = function (len) { return len >> 1 }, Promise.prototype.props = function () { return props(this) }, Promise.props = function (promises) { return props(promises) } } }, { "./es5.js": 14, "./util.js": 38 }], 28: [function (_dereq_, module, exports) { "use strict"; function arrayMove(src, srcIndex, dst, dstIndex, len) { for (var j = 0; j < len; ++j)dst[j + dstIndex] = src[j + srcIndex], src[j + srcIndex] = void 0 } function Queue(capacity) { this._capacity = capacity, this._length = 0, this._front = 0 } Queue.prototype._willBeOverCapacity = function (size) { return this._capacity < size }, Queue.prototype._pushOne = function (arg) { var length = this.length(); this._checkCapacity(length + 1); var i = this._front + length & this._capacity - 1; this[i] = arg, this._length = length + 1 }, Queue.prototype._unshiftOne = function (value) { var capacity = this._capacity; this._checkCapacity(this.length() + 1); var front = this._front, i = (front - 1 & capacity - 1 ^ capacity) - capacity; this[i] = value, this._front = i, this._length = this.length() + 1 }, Queue.prototype.unshift = function (fn, receiver, arg) { this._unshiftOne(arg), this._unshiftOne(receiver), this._unshiftOne(fn) }, Queue.prototype.push = function (fn, receiver, arg) { var length = this.length() + 3; if (this._willBeOverCapacity(length)) return this._pushOne(fn), this._pushOne(receiver), void this._pushOne(arg); var j = this._front + length - 3; this._checkCapacity(length); var wrapMask = this._capacity - 1; this[j + 0 & wrapMask] = fn, this[j + 1 & wrapMask] = receiver, this[j + 2 & wrapMask] = arg, this._length = length }, Queue.prototype.shift = function () { var front = this._front, ret = this[front]; return this[front] = void 0, this._front = front + 1 & this._capacity - 1, this._length-- , ret }, Queue.prototype.length = function () { return this._length }, Queue.prototype._checkCapacity = function (size) { this._capacity < size && this._resizeTo(this._capacity << 1) }, Queue.prototype._resizeTo = function (capacity) { var oldCapacity = this._capacity; this._capacity = capacity; var front = this._front, length = this._length, moveItemsCount = front + length & oldCapacity - 1; arrayMove(this, 0, this, oldCapacity, moveItemsCount) }, module.exports = Queue }, {}], 29: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { function race(promises, parent) { var maybePromise = tryConvertToPromise(promises); if (maybePromise instanceof Promise) return raceLater(maybePromise); if (!isArray(promises)) return apiRejection("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n"); var ret = new Promise(INTERNAL); void 0 !== parent && ret._propagateFrom(parent, 5); for (var fulfill = ret._fulfill, reject = ret._reject, i = 0, len = promises.length; i < len; ++i) { var val = promises[i]; (void 0 !== val || i in promises) && Promise.cast(val)._then(fulfill, reject, void 0, ret, null) } return ret } var isArray = _dereq_("./util.js").isArray, raceLater = function (promise) { return promise.then(function (array) { return race(array, promise) }) }; Promise.race = function (promises) { return race(promises, void 0) }, Promise.prototype.race = function () { return race(this, void 0) } } }, { "./util.js": 38 }], 30: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL) { function ReductionPromiseArray(promises, fn, accum, _each) { this.constructor$(promises), this._promise._captureStackTrace(), this._preservedValues = _each === INTERNAL ? [] : null, this._zerothIsAccum = void 0 === accum, this._gotAccum = !1, this._reducingIndex = this._zerothIsAccum ? 1 : 0, this._valuesPhase = void 0; var maybePromise = tryConvertToPromise(accum, this._promise), rejected = !1, isPromise = maybePromise instanceof Promise; isPromise && (maybePromise = maybePromise._target(), maybePromise._isPending() ? maybePromise._proxyPromiseArray(this, -1) : maybePromise._isFulfilled() ? (accum = maybePromise._value(), this._gotAccum = !0) : (this._reject(maybePromise._reason()), rejected = !0)), isPromise || this._zerothIsAccum || (this._gotAccum = !0); var domain = getDomain(); this._callback = null === domain ? fn : domain.bind(fn), this._accum = accum, rejected || async.invoke(init, this, void 0) } function init() { this._init$(void 0, -5) } function reduce(promises, fn, initialValue, _each) { if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var array = new ReductionPromiseArray(promises, fn, initialValue, _each); return array.promise() } var getDomain = Promise._getDomain, async = _dereq_("./async.js"), util = _dereq_("./util.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; util.inherits(ReductionPromiseArray, PromiseArray), ReductionPromiseArray.prototype._init = function () { }, ReductionPromiseArray.prototype._resolveEmptyArray = function () { (this._gotAccum || this._zerothIsAccum) && this._resolve(null !== this._preservedValues ? [] : this._accum) }, ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { var values = this._values; values[index] = value; var valuesPhaseIndex, length = this.length(), preservedValues = this._preservedValues, isEach = null !== preservedValues, gotAccum = this._gotAccum, valuesPhase = this._valuesPhase; if (!valuesPhase) for (valuesPhase = this._valuesPhase = new Array(length), valuesPhaseIndex = 0; valuesPhaseIndex < length; ++valuesPhaseIndex)valuesPhase[valuesPhaseIndex] = 0; if (valuesPhaseIndex = valuesPhase[index], 0 === index && this._zerothIsAccum ? (this._accum = value, this._gotAccum = gotAccum = !0, valuesPhase[index] = 0 === valuesPhaseIndex ? 1 : 2) : index === -1 ? (this._accum = value, this._gotAccum = gotAccum = !0) : 0 === valuesPhaseIndex ? valuesPhase[index] = 1 : (valuesPhase[index] = 2, this._accum = value), gotAccum) { for (var ret, callback = this._callback, receiver = this._promise._boundValue(), i = this._reducingIndex; i < length; ++i)if (valuesPhaseIndex = valuesPhase[i], 2 !== valuesPhaseIndex) { if (1 !== valuesPhaseIndex) return; if (value = values[i], this._promise._pushContext(), isEach ? (preservedValues.push(value), ret = tryCatch(callback).call(receiver, value, i, length)) : ret = tryCatch(callback).call(receiver, this._accum, value, i, length), this._promise._popContext(), ret === errorObj) return this._reject(ret.e); var maybePromise = tryConvertToPromise(ret, this._promise); if (maybePromise instanceof Promise) { if (maybePromise = maybePromise._target(), maybePromise._isPending()) return valuesPhase[i] = 4, maybePromise._proxyPromiseArray(this, i); if (!maybePromise._isFulfilled()) return this._reject(maybePromise._reason()); ret = maybePromise._value() } this._reducingIndex = i + 1, this._accum = ret } else this._reducingIndex = i + 1; this._resolve(isEach ? preservedValues : this._accum) } }, Promise.prototype.reduce = function (fn, initialValue) { return reduce(this, fn, initialValue, null) }, Promise.reduce = function (promises, fn, initialValue, _each) { return reduce(promises, fn, initialValue, _each) } } }, { "./async.js": 2, "./util.js": 38 }], 31: [function (_dereq_, module, exports) { "use strict"; var schedule, util = _dereq_("./util"), noAsyncScheduler = function () { throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n") }; if (util.isNode && "undefined" == typeof MutationObserver) { var GlobalSetImmediate = global.setImmediate, ProcessNextTick = process.nextTick; schedule = util.isRecentNode ? function (fn) { GlobalSetImmediate.call(global, fn) } : function (fn) { ProcessNextTick.call(process, fn) } } else "undefined" == typeof MutationObserver || "undefined" != typeof window && window.navigator && window.navigator.standalone ? schedule = "undefined" != typeof setImmediate ? function (fn) { setImmediate(fn) } : "undefined" != typeof setTimeout ? function (fn) { setTimeout(fn, 0) } : noAsyncScheduler : (schedule = function (fn) { var div = document.createElement("div"), observer = new MutationObserver(fn); return observer.observe(div, { attributes: !0 }), function () { div.classList.toggle("foo") } }, schedule.isStatic = !0); module.exports = schedule }, { "./util": 38 }], 32: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray) { function SettledPromiseArray(values) { this.constructor$(values) } var PromiseInspection = Promise.PromiseInspection, util = _dereq_("./util.js"); util.inherits(SettledPromiseArray, PromiseArray), SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { this._values[index] = inspection; var totalResolved = ++this._totalResolved; totalResolved >= this._length && this._resolve(this._values) }, SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { var ret = new PromiseInspection; ret._bitField = 268435456, ret._settledValue = value, this._promiseResolved(index, ret) }, SettledPromiseArray.prototype._promiseRejected = function (reason, index) { var ret = new PromiseInspection; ret._bitField = 134217728, ret._settledValue = reason, this._promiseResolved(index, ret) }, Promise.settle = function (promises) { return new SettledPromiseArray(promises).promise() }, Promise.prototype.settle = function () { return new SettledPromiseArray(this).promise() } } }, { "./util.js": 38 }], 33: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection) { function SomePromiseArray(values) { this.constructor$(values), this._howMany = 0, this._unwrap = !1, this._initialized = !1 } function some(promises, howMany) { if ((0 | howMany) !== howMany || howMany < 0) return apiRejection("expecting a positive integer\n\n See http://goo.gl/1wAmHx\n"); var ret = new SomePromiseArray(promises), promise = ret.promise(); return ret.setHowMany(howMany), ret.init(), promise } var util = _dereq_("./util.js"), RangeError = _dereq_("./errors.js").RangeError, AggregateError = _dereq_("./errors.js").AggregateError, isArray = util.isArray; util.inherits(SomePromiseArray, PromiseArray), SomePromiseArray.prototype._init = function () { if (this._initialized) { if (0 === this._howMany) return void this._resolve([]); this._init$(void 0, -5); var isArrayResolved = isArray(this._values); !this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill() && this._reject(this._getRangeError(this.length())) } }, SomePromiseArray.prototype.init = function () { this._initialized = !0, this._init() }, SomePromiseArray.prototype.setUnwrap = function () { this._unwrap = !0 }, SomePromiseArray.prototype.howMany = function () { return this._howMany }, SomePromiseArray.prototype.setHowMany = function (count) { this._howMany = count }, SomePromiseArray.prototype._promiseFulfilled = function (value) { this._addFulfilled(value), this._fulfilled() === this.howMany() && (this._values.length = this.howMany(), 1 === this.howMany() && this._unwrap ? this._resolve(this._values[0]) : this._resolve(this._values)) }, SomePromiseArray.prototype._promiseRejected = function (reason) { if (this._addRejected(reason), this.howMany() > this._canPossiblyFulfill()) { for (var e = new AggregateError, i = this.length(); i < this._values.length; ++i)e.push(this._values[i]); this._reject(e) } }, SomePromiseArray.prototype._fulfilled = function () { return this._totalResolved }, SomePromiseArray.prototype._rejected = function () { return this._values.length - this.length() }, SomePromiseArray.prototype._addRejected = function (reason) { this._values.push(reason) }, SomePromiseArray.prototype._addFulfilled = function (value) { this._values[this._totalResolved++] = value }, SomePromiseArray.prototype._canPossiblyFulfill = function () { return this.length() - this._rejected() }, SomePromiseArray.prototype._getRangeError = function (count) { var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items"; return new RangeError(message) }, SomePromiseArray.prototype._resolveEmptyArray = function () { this._reject(this._getRangeError(0)) }, Promise.some = function (promises, howMany) { return some(promises, howMany) }, Promise.prototype.some = function (howMany) { return some(this, howMany) }, Promise._SomePromiseArray = SomePromiseArray } }, { "./errors.js": 13, "./util.js": 38 }], 34: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function PromiseInspection(promise) { void 0 !== promise ? (promise = promise._target(), this._bitField = promise._bitField, this._settledValue = promise._settledValue) : (this._bitField = 0, this._settledValue = void 0) } PromiseInspection.prototype.value = function () { if (!this.isFulfilled()) throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n"); return this._settledValue }, PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function () { if (!this.isRejected()) throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n"); return this._settledValue }, PromiseInspection.prototype.isFulfilled = Promise.prototype._isFulfilled = function () { return (268435456 & this._bitField) > 0 }, PromiseInspection.prototype.isRejected = Promise.prototype._isRejected = function () { return (134217728 & this._bitField) > 0 }, PromiseInspection.prototype.isPending = Promise.prototype._isPending = function () { return 0 === (402653184 & this._bitField) }, PromiseInspection.prototype.isResolved = Promise.prototype._isResolved = function () { return (402653184 & this._bitField) > 0 }, Promise.prototype.isPending = function () { return this._target()._isPending() }, Promise.prototype.isRejected = function () { return this._target()._isRejected() }, Promise.prototype.isFulfilled = function () { return this._target()._isFulfilled() }, Promise.prototype.isResolved = function () { return this._target()._isResolved() }, Promise.prototype._value = function () { return this._settledValue }, Promise.prototype._reason = function () { return this._unsetRejectionIsUnhandled(), this._settledValue }, Promise.prototype.value = function () { var target = this._target(); if (!target.isFulfilled()) throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n"); return target._settledValue }, Promise.prototype.reason = function () { var target = this._target(); if (!target.isRejected()) throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n"); return target._unsetRejectionIsUnhandled(), target._settledValue }, Promise.PromiseInspection = PromiseInspection } }, {}], 35: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function tryConvertToPromise(obj, context) { if (isObject(obj)) { if (obj instanceof Promise) return obj; if (isAnyBluebirdPromise(obj)) { var ret = new Promise(INTERNAL); return obj._then(ret._fulfillUnchecked, ret._rejectUncheckedCheckError, ret._progressUnchecked, ret, null), ret } var then = util.tryCatch(getThen)(obj); if (then === errorObj) { context && context._pushContext(); var ret = Promise.reject(then.e); return context && context._popContext(), ret } if ("function" == typeof then) return doThenable(obj, then, context) } return obj } function getThen(obj) { return obj.then } function isAnyBluebirdPromise(obj) { return hasProp.call(obj, "_promise0") } function doThenable(x, then, context) { function resolveFromThenable(value) { promise && (promise._resolveCallback(value), promise = null) } function rejectFromThenable(reason) { promise && (promise._rejectCallback(reason, synchronous, !0), promise = null) } function progressFromThenable(value) { promise && "function" == typeof promise._progress && promise._progress(value) } var promise = new Promise(INTERNAL), ret = promise; context && context._pushContext(), promise._captureStackTrace(), context && context._popContext(); var synchronous = !0, result = util.tryCatch(then).call(x, resolveFromThenable, rejectFromThenable, progressFromThenable); return synchronous = !1, promise && result === errorObj && (promise._rejectCallback(result.e, !0, !0), promise = null), ret } var util = _dereq_("./util.js"), errorObj = util.errorObj, isObject = util.isObject, hasProp = {}.hasOwnProperty; return tryConvertToPromise } }, { "./util.js": 38 }], 36: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function successClear(value) { var handle = this; return handle instanceof Number && (handle = +handle), clearTimeout(handle), value } function failureClear(reason) { var handle = this; throw handle instanceof Number && (handle = +handle), clearTimeout(handle), reason } var util = _dereq_("./util.js"), TimeoutError = Promise.TimeoutError, afterTimeout = function (promise, message) { if (promise.isPending()) { var err; !util.isPrimitive(message) && message instanceof Error ? err = message : ("string" != typeof message && (message = "operation timed out"), err = new TimeoutError(message)), util.markAsOriginatingFromRejection(err), promise._attachExtraTrace(err), promise._cancel(err) } }, afterValue = function (value) { return delay(+this).thenReturn(value) }, delay = Promise.delay = function (value, ms) { if (void 0 === ms) { ms = value, value = void 0; var ret = new Promise(INTERNAL); return setTimeout(function () { ret._fulfill() }, ms), ret } return ms = +ms, Promise.resolve(value)._then(afterValue, null, null, ms, void 0) }; Promise.prototype.delay = function (ms) { return delay(this, ms) }, Promise.prototype.timeout = function (ms, message) { ms = +ms; var ret = this.then().cancellable(); ret._cancellationParent = this; var handle = setTimeout(function () { afterTimeout(ret, message) }, ms); return ret._then(successClear, failureClear, void 0, handle, void 0) } } }, { "./util.js": 38 }], 37: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, apiRejection, tryConvertToPromise, createContext) { function inspectionMapper(inspections) { for (var len = inspections.length, i = 0; i < len; ++i) { var inspection = inspections[i]; if (inspection.isRejected()) return Promise.reject(inspection.error()); inspections[i] = inspection._settledValue } return inspections } function thrower(e) { setTimeout(function () { throw e }, 0) } function castPreservingDisposable(thenable) { var maybePromise = tryConvertToPromise(thenable); return maybePromise !== thenable && "function" == typeof thenable._isDisposable && "function" == typeof thenable._getDisposer && thenable._isDisposable() && maybePromise._setDisposable(thenable._getDisposer()), maybePromise } function dispose(resources, inspection) { function iterator() { if (i >= len) return ret.resolve(); var maybePromise = castPreservingDisposable(resources[i++]); if (maybePromise instanceof Promise && maybePromise._isDisposable()) { try { maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise) } catch (e) { return thrower(e) } if (maybePromise instanceof Promise) return maybePromise._then(iterator, thrower, null, null, null) } iterator() } var i = 0, len = resources.length, ret = Promise.defer(); return iterator(), ret.promise } function disposerSuccess(value) { var inspection = new PromiseInspection; return inspection._settledValue = value, inspection._bitField = 268435456, dispose(this, inspection).thenReturn(value) } function disposerFail(reason) { var inspection = new PromiseInspection; return inspection._settledValue = reason, inspection._bitField = 134217728, dispose(this, inspection).thenThrow(reason) } function Disposer(data, promise, context) { this._data = data, this._promise = promise, this._context = context } function FunctionDisposer(fn, promise, context) { this.constructor$(fn, promise, context) } function maybeUnwrapDisposer(value) { return Disposer.isDisposer(value) ? (this.resources[this.index]._setDisposable(value), value.promise()) : value } var TypeError = _dereq_("./errors.js").TypeError, inherits = _dereq_("./util.js").inherits, PromiseInspection = Promise.PromiseInspection; Disposer.prototype.data = function () { return this._data }, Disposer.prototype.promise = function () { return this._promise }, Disposer.prototype.resource = function () { return this.promise().isFulfilled() ? this.promise().value() : null }, Disposer.prototype.tryDispose = function (inspection) { var resource = this.resource(), context = this._context; void 0 !== context && context._pushContext(); var ret = null !== resource ? this.doDispose(resource, inspection) : null; return void 0 !== context && context._popContext(), this._promise._unsetDisposable(), this._data = null, ret }, Disposer.isDisposer = function (d) { return null != d && "function" == typeof d.resource && "function" == typeof d.tryDispose }, inherits(FunctionDisposer, Disposer), FunctionDisposer.prototype.doDispose = function (resource, inspection) { var fn = this.data(); return fn.call(resource, resource, inspection) }, Promise.using = function () { var len = arguments.length; if (len < 2) return apiRejection("you must pass at least 2 arguments to Promise.using"); var fn = arguments[len - 1]; if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var input, spreadArgs = !0; 2 === len && Array.isArray(arguments[0]) ? (input = arguments[0], len = input.length, spreadArgs = !1) : (input = arguments, len--); for (var resources = new Array(len), i = 0; i < len; ++i) { var resource = input[i]; if (Disposer.isDisposer(resource)) { var disposer = resource; resource = resource.promise(), resource._setDisposable(disposer) } else { var maybePromise = tryConvertToPromise(resource); maybePromise instanceof Promise && (resource = maybePromise._then(maybeUnwrapDisposer, null, null, { resources: resources, index: i }, void 0)) } resources[i] = resource } var promise = Promise.settle(resources).then(inspectionMapper).then(function (vals) { promise._pushContext(); var ret; try { ret = spreadArgs ? fn.apply(void 0, vals) : fn.call(void 0, vals) } finally { promise._popContext() } return ret })._then(disposerSuccess, disposerFail, void 0, resources, void 0); return resources.promise = promise, promise }, Promise.prototype._setDisposable = function (disposer) { this._bitField = 262144 | this._bitField, this._disposer = disposer }, Promise.prototype._isDisposable = function () { return (262144 & this._bitField) > 0 }, Promise.prototype._getDisposer = function () { return this._disposer }, Promise.prototype._unsetDisposable = function () { this._bitField = this._bitField & -262145, this._disposer = void 0 }, Promise.prototype.disposer = function (fn) { if ("function" == typeof fn) return new FunctionDisposer(fn, this, createContext()); throw new TypeError } } }, { "./errors.js": 13, "./util.js": 38 }], 38: [function (_dereq_, module, exports) { "use strict"; function tryCatcher() { try { var target = tryCatchTarget; return tryCatchTarget = null, target.apply(this, arguments) } catch (e) { return errorObj.e = e, errorObj } } function tryCatch(fn) { return tryCatchTarget = fn, tryCatcher } function isPrimitive(val) { return null == val || val === !0 || val === !1 || "string" == typeof val || "number" == typeof val } function isObject(value) { return !isPrimitive(value) } function maybeWrapAsError(maybeError) { return isPrimitive(maybeError) ? new Error(safeToString(maybeError)) : maybeError } function withAppended(target, appendee) { var i, len = target.length, ret = new Array(len + 1); for (i = 0; i < len; ++i)ret[i] = target[i]; return ret[i] = appendee, ret } function getDataPropertyOrDefault(obj, key, defaultValue) { if (!es5.isES5) return {}.hasOwnProperty.call(obj, key) ? obj[key] : void 0; var desc = Object.getOwnPropertyDescriptor(obj, key); return null != desc ? null == desc.get && null == desc.set ? desc.value : defaultValue : void 0 } function notEnumerableProp(obj, name, value) { if (isPrimitive(obj)) return obj; var descriptor = { value: value, configurable: !0, enumerable: !1, writable: !0 }; return es5.defineProperty(obj, name, descriptor), obj } function thrower(r) { throw r } function isClass(fn) { try { if ("function" == typeof fn) { var keys = es5.names(fn.prototype), hasMethods = es5.isES5 && keys.length > 1, hasMethodsOtherThanConstructor = keys.length > 0 && !(1 === keys.length && "constructor" === keys[0]), hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) return !0 } return !1 } catch (e) { return !1 } } function toFastProperties(obj) { function f() { } f.prototype = obj; for (var l = 8; l--;)new f; return obj } function isIdentifier(str) { return rident.test(str) } function filledRange(count, prefix, suffix) { for (var ret = new Array(count), i = 0; i < count; ++i)ret[i] = prefix + i + suffix; return ret } function safeToString(obj) { try { return obj + "" } catch (e) { return "[no string representation]" } } function markAsOriginatingFromRejection(e) { try { notEnumerableProp(e, "isOperational", !0) } catch (ignore) { } } function originatesFromRejection(e) { return null != e && (e instanceof Error.__BluebirdErrorTypes__.OperationalError || e.isOperational === !0) } function canAttachTrace(obj) { return obj instanceof Error && es5.propertyIsWritable(obj, "stack") } function classString(obj) { return {}.toString.call(obj) } function copyDescriptors(from, to, filter) { for (var keys = es5.names(from), i = 0; i < keys.length; ++i) { var key = keys[i]; if (filter(key)) try { es5.defineProperty(to, key, es5.getDescriptor(from, key)) } catch (ignore) { } } } var es5 = _dereq_("./es5.js"), canEvaluate = "undefined" == typeof navigator, haveGetters = function () { try { var o = {}; return es5.defineProperty(o, "f", { get: function () { return 3 } }), 3 === o.f } catch (e) { return !1 } }(), errorObj = { e: {} }, tryCatchTarget, inherits = function (Child, Parent) { function T() { this.constructor = Child, this.constructor$ = Parent; for (var propertyName in Parent.prototype) hasProp.call(Parent.prototype, propertyName) && "$" !== propertyName.charAt(propertyName.length - 1) && (this[propertyName + "$"] = Parent.prototype[propertyName]) } var hasProp = {}.hasOwnProperty; return T.prototype = Parent.prototype, Child.prototype = new T, Child.prototype }, inheritedDataKeys = function () { var excludedPrototypes = [Array.prototype, Object.prototype, Function.prototype], isExcludedProto = function (val) { for (var i = 0; i < excludedPrototypes.length; ++i)if (excludedPrototypes[i] === val) return !0; return !1 }; if (es5.isES5) { var getKeys = Object.getOwnPropertyNames; return function (obj) { for (var ret = [], visitedKeys = Object.create(null); null != obj && !isExcludedProto(obj);) { var keys; try { keys = getKeys(obj) } catch (e) { return ret } for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!visitedKeys[key]) { visitedKeys[key] = !0; var desc = Object.getOwnPropertyDescriptor(obj, key); null != desc && null == desc.get && null == desc.set && ret.push(key) } } obj = es5.getPrototypeOf(obj) } return ret } } var hasProp = {}.hasOwnProperty; return function (obj) { if (isExcludedProto(obj)) return []; var ret = []; enumeration: for (var key in obj) if (hasProp.call(obj, key)) ret.push(key); else { for (var i = 0; i < excludedPrototypes.length; ++i)if (hasProp.call(excludedPrototypes[i], key)) continue enumeration; ret.push(key) } return ret } }(), thisAssignmentPattern = /this\s*\.\s*\S+\s*=/, rident = /^[a-z$_][a-z$_0-9]*$/i, ensureErrorObject = function () { return "stack" in new Error ? function (value) { return canAttachTrace(value) ? value : new Error(safeToString(value)) } : function (value) { if (canAttachTrace(value)) return value; try { throw new Error(safeToString(value)) } catch (err) { return err } } }(), ret = { isClass: isClass, isIdentifier: isIdentifier, inheritedDataKeys: inheritedDataKeys, getDataPropertyOrDefault: getDataPropertyOrDefault, thrower: thrower, isArray: es5.isArray, haveGetters: haveGetters, notEnumerableProp: notEnumerableProp, isPrimitive: isPrimitive, isObject: isObject, canEvaluate: canEvaluate, errorObj: errorObj, tryCatch: tryCatch, inherits: inherits, withAppended: withAppended, maybeWrapAsError: maybeWrapAsError, toFastProperties: toFastProperties, filledRange: filledRange, toString: safeToString, canAttachTrace: canAttachTrace, ensureErrorObject: ensureErrorObject, originatesFromRejection: originatesFromRejection, markAsOriginatingFromRejection: markAsOriginatingFromRejection, classString: classString, copyDescriptors: copyDescriptors, hasDevTools: "undefined" != typeof chrome && chrome && "function" == typeof chrome.loadTimes, isNode: "undefined" != typeof process && "[object process]" === classString(process).toLowerCase() }; ret.isRecentNode = ret.isNode && function () { var version = process.versions.node.split(".").map(Number); return 0 === version[0] && version[1] > 10 || version[0] > 0 }(), ret.isNode && ret.toFastProperties(process); try { throw new Error } catch (e) { ret.lastLineError = e } module.exports = ret }, { "./es5.js": 14 }]}, {}, [4])(4)}), "undefined" != typeof window && null !== window ? window.P = window.Promise : "undefined" != typeof self && null !== self && (self.P = self.Promise)}).call(exports, __webpack_require__(30), function () { return this }(), __webpack_require__(31).setImmediate)}, function(module, exports) { function defaultSetTimout() { throw new Error("setTimeout has not been defined") } function defaultClearTimeout() { throw new Error("clearTimeout has not been defined") } function runTimeout(fun) { if (cachedSetTimeout === setTimeout) return setTimeout(fun, 0); if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) return cachedSetTimeout = setTimeout, setTimeout(fun, 0); try { return cachedSetTimeout(fun, 0) } catch (e) { try { return cachedSetTimeout.call(null, fun, 0) } catch (e) { return cachedSetTimeout.call(this, fun, 0) } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) return clearTimeout(marker); if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) return cachedClearTimeout = clearTimeout, clearTimeout(marker); try { return cachedClearTimeout(marker) } catch (e) { try { return cachedClearTimeout.call(null, marker) } catch (e) { return cachedClearTimeout.call(this, marker) } } } function cleanUpNextTick() { draining && currentQueue && (draining = !1, currentQueue.length ? queue = currentQueue.concat(queue) : queueIndex = -1, queue.length && drainQueue()) } function drainQueue() { if (!draining) { var timeout = runTimeout(cleanUpNextTick); draining = !0; for (var len = queue.length; len;) { for (currentQueue = queue, queue = []; ++queueIndex < len;)currentQueue && currentQueue[queueIndex].run(); queueIndex = -1, len = queue.length } currentQueue = null, draining = !1, runClearTimeout(timeout) } } function Item(fun, array) { this.fun = fun, this.array = array } function noop() { } var cachedSetTimeout, cachedClearTimeout, process = module.exports = {}; !function () { try { cachedSetTimeout = "function" == typeof setTimeout ? setTimeout : defaultSetTimout } catch (e) { cachedSetTimeout = defaultSetTimout } try { cachedClearTimeout = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout } catch (e) { cachedClearTimeout = defaultClearTimeout } }(); var currentQueue, queue = [], draining = !1, queueIndex = -1; process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) for (var i = 1; i < arguments.length; i++)args[i - 1] = arguments[i]; queue.push(new Item(fun, args)), 1 !== queue.length || draining || runTimeout(drainQueue) }, Item.prototype.run = function () { this.fun.apply(null, this.array) }, process.title = "browser", process.browser = !0, process.env = {}, process.argv = [], process.version = "", process.versions = {}, process.on = noop, process.addListener = noop, process.once = noop, process.off = noop, process.removeListener = noop, process.removeAllListeners = noop, process.emit = noop, process.prependListener = noop, process.prependOnceListener = noop, process.listeners = function (name) { return [] }, process.binding = function (name) { throw new Error("process.binding is not supported") }, process.cwd = function () { return "/" }, process.chdir = function (dir) { throw new Error("process.chdir is not supported") }, process.umask = function () { return 0 } }, function(module, exports, __webpack_require__) { (function (global) { function Timeout(id, clearFn) { this._id = id, this._clearFn = clearFn } var scope = "undefined" != typeof global && global || "undefined" != typeof self && self || window, apply = Function.prototype.apply; exports.setTimeout = function () { return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout) }, exports.setInterval = function () { return new Timeout(apply.call(setInterval, scope, arguments), clearInterval) }, exports.clearTimeout = exports.clearInterval = function (timeout) { timeout && timeout.close() }, Timeout.prototype.unref = Timeout.prototype.ref = function () { }, Timeout.prototype.close = function () { this._clearFn.call(scope, this._id) }, exports.enroll = function (item, msecs) { clearTimeout(item._idleTimeoutId), item._idleTimeout = msecs }, exports.unenroll = function (item) { clearTimeout(item._idleTimeoutId), item._idleTimeout = -1 }, exports._unrefActive = exports.active = function (item) { clearTimeout(item._idleTimeoutId); var msecs = item._idleTimeout; msecs >= 0 && (item._idleTimeoutId = setTimeout(function () { item._onTimeout && item._onTimeout() }, msecs)) }, __webpack_require__(32), exports.setImmediate = "undefined" != typeof self && self.setImmediate || "undefined" != typeof global && global.setImmediate || this && this.setImmediate, exports.clearImmediate = "undefined" != typeof self && self.clearImmediate || "undefined" != typeof global && global.clearImmediate || this && this.clearImmediate }).call(exports, function () { return this }()) }, function(module, exports, __webpack_require__) { (function (global, process) { !function (global, undefined) { "use strict"; function setImmediate(callback) { "function" != typeof callback && (callback = new Function("" + callback)); for (var args = new Array(arguments.length - 1), i = 0; i < args.length; i++)args[i] = arguments[i + 1]; var task = { callback: callback, args: args }; return tasksByHandle[nextHandle] = task, registerImmediate(nextHandle), nextHandle++ } function clearImmediate(handle) { delete tasksByHandle[handle] } function run(task) { var callback = task.callback, args = task.args; switch (args.length) { case 0: callback(); break; case 1: callback(args[0]); break; case 2: callback(args[0], args[1]); break; case 3: callback(args[0], args[1], args[2]); break; default: callback.apply(undefined, args) } } function runIfPresent(handle) { if (currentlyRunningATask) setTimeout(runIfPresent, 0, handle); else { var task = tasksByHandle[handle]; if (task) { currentlyRunningATask = !0; try { run(task) } finally { clearImmediate(handle), currentlyRunningATask = !1 } } } } function installNextTickImplementation() { registerImmediate = function (handle) { process.nextTick(function () { runIfPresent(handle) }) } } function canUsePostMessage() { if (global.postMessage && !global.importScripts) { var postMessageIsAsynchronous = !0, oldOnMessage = global.onmessage; return global.onmessage = function () { postMessageIsAsynchronous = !1 }, global.postMessage("", "*"), global.onmessage = oldOnMessage, postMessageIsAsynchronous } } function installPostMessageImplementation() { var messagePrefix = "setImmediate$" + Math.random() + "$", onGlobalMessage = function (event) { event.source === global && "string" == typeof event.data && 0 === event.data.indexOf(messagePrefix) && runIfPresent(+event.data.slice(messagePrefix.length)) }; global.addEventListener ? global.addEventListener("message", onGlobalMessage, !1) : global.attachEvent("onmessage", onGlobalMessage), registerImmediate = function (handle) { global.postMessage(messagePrefix + handle, "*") } } function installMessageChannelImplementation() { var channel = new MessageChannel; channel.port1.onmessage = function (event) { var handle = event.data; runIfPresent(handle) }, registerImmediate = function (handle) { channel.port2.postMessage(handle) } } function installReadyStateChangeImplementation() { var html = doc.documentElement; registerImmediate = function (handle) { var script = doc.createElement("script"); script.onreadystatechange = function () { runIfPresent(handle), script.onreadystatechange = null, html.removeChild(script), script = null }, html.appendChild(script) } } function installSetTimeoutImplementation() { registerImmediate = function (handle) { setTimeout(runIfPresent, 0, handle) } } if (!global.setImmediate) { var registerImmediate, nextHandle = 1, tasksByHandle = {}, currentlyRunningATask = !1, doc = global.document, attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); attachTo = attachTo && attachTo.setTimeout ? attachTo : global, "[object process]" === {}.toString.call(global.process) ? installNextTickImplementation() : canUsePostMessage() ? installPostMessageImplementation() : global.MessageChannel ? installMessageChannelImplementation() : doc && "onreadystatechange" in doc.createElement("script") ? installReadyStateChangeImplementation() : installSetTimeoutImplementation(), attachTo.setImmediate = setImmediate, attachTo.clearImmediate = clearImmediate } }("undefined" == typeof self ? "undefined" == typeof global ? this : global : self) }).call(exports, function () { return this }(), __webpack_require__(30)) }, function(module, exports, __webpack_require__) { var co = __webpack_require__(34), Bluebird = __webpack_require__(35); module.exports = co.use(Bluebird) }, function(module, exports) { function coUse(Promise) { function co(gen) { var ctx = this, args = slice.call(arguments, 1); return new Promise(function (resolve, reject) { function onFulfilled(res) { var ret; try { ret = gen.next(res) } catch (e) { return reject(e) } next(ret) } function onRejected(err) { var ret; try { ret = gen.throw(err) } catch (e) { return reject(e) } next(ret) } function next(ret) { if (ret.done) return resolve(ret.value); var value = toPromise.call(ctx, ret.value); return value && isPromise(value) ? value.then(onFulfilled, onRejected) : onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, but the following object was passed: "' + String(ret.value) + '"')) } return "function" == typeof gen && (gen = gen.apply(ctx, args)), gen && "function" == typeof gen.next ? void onFulfilled() : resolve(gen) }) } function toPromise(obj) { return obj ? isPromise(obj) ? obj : isGeneratorFunction(obj) || isGenerator(obj) ? co.call(this, obj) : "function" == typeof obj ? thunkToPromise.call(this, obj) : Array.isArray(obj) ? arrayToPromise.call(this, obj) : isObject(obj) ? objectToPromise.call(this, obj) : obj : obj } function thunkToPromise(fn) { var ctx = this; return new Promise(function (resolve, reject) { fn.call(ctx, function (err, res) { return err ? reject(err) : (arguments.length > 2 && (res = slice.call(arguments, 1)), void resolve(res)) }) }) } function arrayToPromise(obj) { return Promise.all(obj.map(toPromise, this)) } function objectToPromise(obj) { function defer(promise, key) { results[key] = void 0, promises.push(promise.then(function (res) { results[key] = res })) } for (var results = new obj.constructor, keys = Object.keys(obj), promises = [], i = 0; i < keys.length; i++) { var key = keys[i], promise = toPromise.call(this, obj[key]); promise && isPromise(promise) ? defer(promise, key) : results[key] = obj[key] } return Promise.all(promises).then(function () { return results }) } function isPromise(obj) { return "function" == typeof obj.then } function isGenerator(obj) { return "function" == typeof obj.next && "function" == typeof obj.throw } function isGeneratorFunction(obj) { var constructor = obj.constructor; return !!constructor && ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName || isGenerator(constructor.prototype)) } function isObject(val) { return Object == val.constructor } var module = {}, slice = Array.prototype.slice; return module.exports = co.default = co.co = co, co.wrap = function (fn) { function createPromise() { return co.call(this, fn.apply(this, arguments)) } return createPromise.__generatorFunction__ = fn, createPromise }, module.exports.use = coUse, module.exports } var P; try { P = Promise } catch (err) { } module.exports = coUse(P) }, function(module, exports, __webpack_require__) { (function (process, global, setImmediate) {/* @preserve * The MIT License (MIT) * * Copyright (c) 2013-2015 Petka Antonov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ !function (e) { module.exports = e() }(function () { var define, module, exports; return function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = "function" == typeof _dereq_ && _dereq_; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } for (var i = "function" == typeof _dereq_ && _dereq_, o = 0; o < r.length; o++)s(r[o]); return s }({ 1: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function any(promises) { var ret = new SomePromiseArray(promises), promise = ret.promise(); return ret.setHowMany(1), ret.setUnwrap(), ret.init(), promise } var SomePromiseArray = Promise._SomePromiseArray; Promise.any = function (promises) { return any(promises) }, Promise.prototype.any = function () { return any(this) } } }, {}], 2: [function (_dereq_, module, exports) { "use strict"; function Async() { this._isTickUsed = !1, this._lateQueue = new Queue(16), this._normalQueue = new Queue(16), this._trampolineEnabled = !0; var self = this; this.drainQueues = function () { self._drainQueues() }, this._schedule = schedule.isStatic ? schedule(this.drainQueues) : schedule } function AsyncInvokeLater(fn, receiver, arg) { this._lateQueue.push(fn, receiver, arg), this._queueTick() } function AsyncInvoke(fn, receiver, arg) { this._normalQueue.push(fn, receiver, arg), this._queueTick() } function AsyncSettlePromises(promise) { this._normalQueue._pushOne(promise), this._queueTick() } var firstLineError; try { throw new Error } catch (e) { firstLineError = e } var schedule = _dereq_("./schedule.js"), Queue = _dereq_("./queue.js"), util = _dereq_("./util.js"); Async.prototype.disableTrampolineIfNecessary = function () { util.hasDevTools && (this._trampolineEnabled = !1) }, Async.prototype.enableTrampoline = function () { this._trampolineEnabled || (this._trampolineEnabled = !0, this._schedule = function (fn) { setTimeout(fn, 0) }) }, Async.prototype.haveItemsQueued = function () { return this._normalQueue.length() > 0 }, Async.prototype.throwLater = function (fn, arg) { if (1 === arguments.length && (arg = fn, fn = function () { throw arg }), "undefined" != typeof setTimeout) setTimeout(function () { fn(arg) }, 0); else try { this._schedule(function () { fn(arg) }) } catch (e) { throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n") } }, util.hasDevTools ? (schedule.isStatic && (schedule = function (fn) { setTimeout(fn, 0) }), Async.prototype.invokeLater = function (fn, receiver, arg) { this._trampolineEnabled ? AsyncInvokeLater.call(this, fn, receiver, arg) : this._schedule(function () { setTimeout(function () { fn.call(receiver, arg) }, 100) }) }, Async.prototype.invoke = function (fn, receiver, arg) { this._trampolineEnabled ? AsyncInvoke.call(this, fn, receiver, arg) : this._schedule(function () { fn.call(receiver, arg) }) }, Async.prototype.settlePromises = function (promise) { this._trampolineEnabled ? AsyncSettlePromises.call(this, promise) : this._schedule(function () { promise._settlePromises() }) }) : (Async.prototype.invokeLater = AsyncInvokeLater, Async.prototype.invoke = AsyncInvoke, Async.prototype.settlePromises = AsyncSettlePromises), Async.prototype.invokeFirst = function (fn, receiver, arg) { this._normalQueue.unshift(fn, receiver, arg), this._queueTick() }, Async.prototype._drainQueue = function (queue) { for (; queue.length() > 0;) { var fn = queue.shift(); if ("function" == typeof fn) { var receiver = queue.shift(), arg = queue.shift(); fn.call(receiver, arg) } else fn._settlePromises() } }, Async.prototype._drainQueues = function () { this._drainQueue(this._normalQueue), this._reset(), this._drainQueue(this._lateQueue) }, Async.prototype._queueTick = function () { this._isTickUsed || (this._isTickUsed = !0, this._schedule(this.drainQueues)) }, Async.prototype._reset = function () { this._isTickUsed = !1 }, module.exports = new Async, module.exports.firstLineError = firstLineError }, { "./queue.js": 28, "./schedule.js": 31, "./util.js": 38 }], 3: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise) { var rejectThis = function (_, e) { this._reject(e) }, targetRejected = function (e, context) { context.promiseRejectionQueued = !0, context.bindingPromise._then(rejectThis, rejectThis, null, this, e) }, bindingResolved = function (thisArg, context) { this._isPending() && this._resolveCallback(context.target) }, bindingRejected = function (e, context) { context.promiseRejectionQueued || this._reject(e) }; Promise.prototype.bind = function (thisArg) { var maybePromise = tryConvertToPromise(thisArg), ret = new Promise(INTERNAL); ret._propagateFrom(this, 1); var target = this._target(); if (ret._setBoundTo(maybePromise), maybePromise instanceof Promise) { var context = { promiseRejectionQueued: !1, promise: ret, target: target, bindingPromise: maybePromise }; target._then(INTERNAL, targetRejected, ret._progress, ret, context), maybePromise._then(bindingResolved, bindingRejected, ret._progress, ret, context) } else ret._resolveCallback(target); return ret }, Promise.prototype._setBoundTo = function (obj) { void 0 !== obj ? (this._bitField = 131072 | this._bitField, this._boundTo = obj) : this._bitField = this._bitField & -131073 }, Promise.prototype._isBound = function () { return 131072 === (131072 & this._bitField) }, Promise.bind = function (thisArg, value) { var maybePromise = tryConvertToPromise(thisArg), ret = new Promise(INTERNAL); return ret._setBoundTo(maybePromise), maybePromise instanceof Promise ? maybePromise._then(function () { ret._resolveCallback(value) }, ret._reject, ret._progress, ret, null) : ret._resolveCallback(value), ret } } }, {}], 4: [function (_dereq_, module, exports) { "use strict"; function noConflict() { try { Promise === bluebird && (Promise = old) } catch (e) { } return bluebird } var old; "undefined" != typeof Promise && (old = Promise); var bluebird = _dereq_("./promise.js")(); bluebird.noConflict = noConflict, module.exports = bluebird }, { "./promise.js": 23 }], 5: [function (_dereq_, module, exports) { "use strict"; var cr = Object.create; if (cr) { var callerCache = cr(null), getterCache = cr(null); callerCache[" size"] = getterCache[" size"] = 0 } module.exports = function (Promise) { function ensureMethod(obj, methodName) { var fn; if (null != obj && (fn = obj[methodName]), "function" != typeof fn) { var message = "Object " + util.classString(obj) + " has no method '" + util.toString(methodName) + "'"; throw new Promise.TypeError(message) } return fn } function caller(obj) { var methodName = this.pop(), fn = ensureMethod(obj, methodName); return fn.apply(obj, this) } function namedGetter(obj) { return obj[this] } function indexedGetter(obj) { var index = +this; return index < 0 && (index = Math.max(0, index + obj.length)), obj[index] } var getGetter, util = _dereq_("./util.js"), canEvaluate = util.canEvaluate; util.isIdentifier; Promise.prototype.call = function (methodName) { for (var $_len = arguments.length, args = new Array($_len - 1), $_i = 1; $_i < $_len; ++$_i)args[$_i - 1] = arguments[$_i]; return args.push(methodName), this._then(caller, void 0, void 0, args, void 0) }, Promise.prototype.get = function (propertyName) { var getter, isIndex = "number" == typeof propertyName; if (isIndex) getter = indexedGetter; else if (canEvaluate) { var maybeGetter = getGetter(propertyName); getter = null !== maybeGetter ? maybeGetter : namedGetter } else getter = namedGetter; return this._then(getter, void 0, void 0, propertyName, void 0) } } }, { "./util.js": 38 }], 6: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { var errors = _dereq_("./errors.js"), async = _dereq_("./async.js"), CancellationError = errors.CancellationError; Promise.prototype._cancel = function (reason) { if (!this.isCancellable()) return this; for (var parent, promiseToReject = this; void 0 !== (parent = promiseToReject._cancellationParent) && parent.isCancellable();)promiseToReject = parent; this._unsetCancellable(), promiseToReject._target()._rejectCallback(reason, !1, !0) }, Promise.prototype.cancel = function (reason) { return this.isCancellable() ? (void 0 === reason && (reason = new CancellationError), async.invokeLater(this._cancel, this, reason), this) : this }, Promise.prototype.cancellable = function () { return this._cancellable() ? this : (async.enableTrampoline(), this._setCancellable(), this._cancellationParent = void 0, this) }, Promise.prototype.uncancellable = function () { var ret = this.then(); return ret._unsetCancellable(), ret }, Promise.prototype.fork = function (didFulfill, didReject, didProgress) { var ret = this._then(didFulfill, didReject, didProgress, void 0, void 0); return ret._setCancellable(), ret._cancellationParent = void 0, ret } } }, { "./async.js": 2, "./errors.js": 13 }], 7: [function (_dereq_, module, exports) { "use strict"; module.exports = function () { function CapturedTrace(parent) { this._parent = parent; var length = this._length = 1 + (void 0 === parent ? 0 : parent._length); captureStackTrace(this, CapturedTrace), length > 32 && this.uncycle() } function reconstructStack(message, stacks) { for (var i = 0; i < stacks.length - 1; ++i)stacks[i].push("From previous event:"), stacks[i] = stacks[i].join("\n"); return i < stacks.length && (stacks[i] = stacks[i].join("\n")), message + "\n" + stacks.join("\n") } function removeDuplicateOrEmptyJumps(stacks) { for (var i = 0; i < stacks.length; ++i)(0 === stacks[i].length || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) && (stacks.splice(i, 1), i--) } function removeCommonRoots(stacks) { for (var current = stacks[0], i = 1; i < stacks.length; ++i) { for (var prev = stacks[i], currentLastIndex = current.length - 1, currentLastLine = current[currentLastIndex], commonRootMeetPoint = -1, j = prev.length - 1; j >= 0; --j)if (prev[j] === currentLastLine) { commonRootMeetPoint = j; break } for (var j = commonRootMeetPoint; j >= 0; --j) { var line = prev[j]; if (current[currentLastIndex] !== line) break; current.pop(), currentLastIndex-- } current = prev } } function cleanStack(stack) { for (var ret = [], i = 0; i < stack.length; ++i) { var line = stack[i], isTraceLine = stackFramePattern.test(line) || " (No stack trace)" === line, isInternalFrame = isTraceLine && shouldIgnore(line); isTraceLine && !isInternalFrame && (indentStackFrames && " " !== line.charAt(0) && (line = " " + line), ret.push(line)) } return ret } function stackFramesAsArray(error) { for (var stack = error.stack.replace(/\s+$/g, "").split("\n"), i = 0; i < stack.length; ++i) { var line = stack[i]; if (" (No stack trace)" === line || stackFramePattern.test(line)) break } return i > 0 && (stack = stack.slice(i)), stack } function formatNonError(obj) { var str; if ("function" == typeof obj) str = "[function " + (obj.name || "anonymous") + "]"; else { str = obj.toString(); var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; if (ruselessToString.test(str)) try { var newStr = JSON.stringify(obj); str = newStr } catch (e) { } 0 === str.length && (str = "(empty array)") } return "(<" + snip(str) + ">, no stack trace)" } function snip(str) { var maxChars = 41; return str.length < maxChars ? str : str.substr(0, maxChars - 3) + "..." } function parseLineInfo(line) { var matches = line.match(parseLineInfoRegex); if (matches) return { fileName: matches[1], line: parseInt(matches[2], 10) } } var warn, async = _dereq_("./async.js"), util = _dereq_("./util.js"), bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/, stackFramePattern = null, formatStack = null, indentStackFrames = !1; util.inherits(CapturedTrace, Error), CapturedTrace.prototype.uncycle = function () { var length = this._length; if (!(length < 2)) { for (var nodes = [], stackToIndex = {}, i = 0, node = this; void 0 !== node; ++i)nodes.push(node), node = node._parent; length = this._length = i; for (var i = length - 1; i >= 0; --i) { var stack = nodes[i].stack; void 0 === stackToIndex[stack] && (stackToIndex[stack] = i) } for (var i = 0; i < length; ++i) { var currentStack = nodes[i].stack, index = stackToIndex[currentStack]; if (void 0 !== index && index !== i) { index > 0 && (nodes[index - 1]._parent = void 0, nodes[index - 1]._length = 1), nodes[i]._parent = void 0, nodes[i]._length = 1; var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; index < length - 1 ? (cycleEdgeNode._parent = nodes[index + 1], cycleEdgeNode._parent.uncycle(), cycleEdgeNode._length = cycleEdgeNode._parent._length + 1) : (cycleEdgeNode._parent = void 0, cycleEdgeNode._length = 1); for (var currentChildLength = cycleEdgeNode._length + 1, j = i - 2; j >= 0; --j)nodes[j]._length = currentChildLength, currentChildLength++; return } } } }, CapturedTrace.prototype.parent = function () { return this._parent }, CapturedTrace.prototype.hasParent = function () { return void 0 !== this._parent }, CapturedTrace.prototype.attachExtraTrace = function (error) { if (!error.__stackCleaned__) { this.uncycle(); for (var parsed = CapturedTrace.parseStackAndMessage(error), message = parsed.message, stacks = [parsed.stack], trace = this; void 0 !== trace;)stacks.push(cleanStack(trace.stack.split("\n"))), trace = trace._parent; removeCommonRoots(stacks), removeDuplicateOrEmptyJumps(stacks), util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)), util.notEnumerableProp(error, "__stackCleaned__", !0) } }, CapturedTrace.parseStackAndMessage = function (error) { var stack = error.stack, message = error.toString(); return stack = "string" == typeof stack && stack.length > 0 ? stackFramesAsArray(error) : [" (No stack trace)"], { message: message, stack: cleanStack(stack) } }, CapturedTrace.formatAndLogError = function (error, title) { if ("undefined" != typeof console) { var message; if ("object" == typeof error || "function" == typeof error) { var stack = error.stack; message = title + formatStack(stack, error) } else message = title + String(error); "function" == typeof warn ? warn(message) : "function" != typeof console.log && "object" != typeof console.log || console.log(message) } }, CapturedTrace.unhandledRejection = function (reason) { CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: ") }, CapturedTrace.isSupported = function () { return "function" == typeof captureStackTrace }, CapturedTrace.fireRejectionEvent = function (name, localHandler, reason, promise) { var localEventFired = !1; try { "function" == typeof localHandler && (localEventFired = !0, "rejectionHandled" === name ? localHandler(promise) : localHandler(reason, promise)) } catch (e) { async.throwLater(e) } var globalEventFired = !1; try { globalEventFired = fireGlobalEvent(name, reason, promise) } catch (e) { globalEventFired = !0, async.throwLater(e) } var domEventFired = !1; if (fireDomEvent) try { domEventFired = fireDomEvent(name.toLowerCase(), { reason: reason, promise: promise }) } catch (e) { domEventFired = !0, async.throwLater(e) } globalEventFired || localEventFired || domEventFired || "unhandledRejection" !== name || CapturedTrace.formatAndLogError(reason, "Unhandled rejection ") }; var shouldIgnore = function () { return !1 }, parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; CapturedTrace.setBounds = function (firstLineError, lastLineError) { if (CapturedTrace.isSupported()) { for (var firstFileName, lastFileName, firstStackLines = firstLineError.stack.split("\n"), lastStackLines = lastLineError.stack.split("\n"), firstIndex = -1, lastIndex = -1, i = 0; i < firstStackLines.length; ++i) { var result = parseLineInfo(firstStackLines[i]); if (result) { firstFileName = result.fileName, firstIndex = result.line; break } } for (var i = 0; i < lastStackLines.length; ++i) { var result = parseLineInfo(lastStackLines[i]); if (result) { lastFileName = result.fileName, lastIndex = result.line; break } } firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex || (shouldIgnore = function (line) { if (bluebirdFramePattern.test(line)) return !0; var info = parseLineInfo(line); return !!(info && info.fileName === firstFileName && firstIndex <= info.line && info.line <= lastIndex) }) } }; var fireDomEvent, captureStackTrace = function () { var v8stackFramePattern = /^\s*at\s*/, v8stackFormatter = function (stack, error) { return "string" == typeof stack ? stack : void 0 !== error.name && void 0 !== error.message ? error.toString() : formatNonError(error) }; if ("number" == typeof Error.stackTraceLimit && "function" == typeof Error.captureStackTrace) { Error.stackTraceLimit = Error.stackTraceLimit + 6, stackFramePattern = v8stackFramePattern, formatStack = v8stackFormatter; var captureStackTrace = Error.captureStackTrace; return shouldIgnore = function (line) { return bluebirdFramePattern.test(line) }, function (receiver, ignoreUntil) { Error.stackTraceLimit = Error.stackTraceLimit + 6, captureStackTrace(receiver, ignoreUntil), Error.stackTraceLimit = Error.stackTraceLimit - 6 } } var err = new Error; if ("string" == typeof err.stack && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) return stackFramePattern = /@/, formatStack = v8stackFormatter, indentStackFrames = !0, function (o) { o.stack = (new Error).stack }; var hasStackAfterThrow; try { throw new Error } catch (e) { hasStackAfterThrow = "stack" in e } return "stack" in err || !hasStackAfterThrow || "number" != typeof Error.stackTraceLimit ? (formatStack = function (stack, error) { return "string" == typeof stack ? stack : "object" != typeof error && "function" != typeof error || void 0 === error.name || void 0 === error.message ? formatNonError(error) : error.toString() },null): (stackFramePattern = v8stackFramePattern, formatStack = v8stackFormatter,function(o){ Error.stackTraceLimit = Error.stackTraceLimit + 6; try { throw new Error } catch (e) { o.stack = e.stack } Error.stackTraceLimit = Error.stackTraceLimit - 6 }) }([]), fireGlobalEvent = function () { if (util.isNode) return function (name, reason, promise) { return "rejectionHandled" === name ? process.emit(name, promise) : process.emit(name, reason, promise) }; var customEventWorks = !1, anyEventWorks = !0; try { var ev = new self.CustomEvent("test"); customEventWorks = ev instanceof CustomEvent } catch (e) { } if (!customEventWorks) try { var event = document.createEvent("CustomEvent"); event.initCustomEvent("testingtheevent", !1, !0, {}), self.dispatchEvent(event) } catch (e) { anyEventWorks = !1 } anyEventWorks && (fireDomEvent = function (type, detail) { var event; return customEventWorks ? event = new self.CustomEvent(type, { detail: detail, bubbles: !1, cancelable: !0 }) : self.dispatchEvent && (event = document.createEvent("CustomEvent"), event.initCustomEvent(type, !1, !0, detail)), !!event && !self.dispatchEvent(event) }); var toWindowMethodNameMap = {}; return toWindowMethodNameMap.unhandledRejection = "onunhandledRejection".toLowerCase(), toWindowMethodNameMap.rejectionHandled = "onrejectionHandled".toLowerCase(), function (name, reason, promise) { var methodName = toWindowMethodNameMap[name], method = self[methodName]; return !!method && ("rejectionHandled" === name ? method.call(self, promise) : method.call(self, reason, promise), !0) } }(); return "undefined" != typeof console && "undefined" != typeof console.warn && (warn = function (message) { console.warn(message) }, util.isNode && process.stderr.isTTY ? warn = function (message) { process.stderr.write("" + message + "\n") } : util.isNode || "string" != typeof (new Error).stack || (warn = function (message) { console.warn("%c" + message, "color: red") })), CapturedTrace }}, { "./async.js": 2, "./util.js": 38 }], 8: [function (_dereq_, module, exports) { "use strict"; module.exports = function (NEXT_FILTER) { function CatchFilter(instances, callback, promise) { this._instances = instances, this._callback = callback, this._promise = promise } function safePredicate(predicate, e) { var safeObject = {}, retfilter = tryCatch(predicate).call(safeObject, e); if (retfilter === errorObj) return retfilter; var safeKeys = keys(safeObject); return safeKeys.length ? (errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"), errorObj) : retfilter } var util = _dereq_("./util.js"), errors = _dereq_("./errors.js"), tryCatch = util.tryCatch, errorObj = util.errorObj, keys = _dereq_("./es5.js").keys, TypeError = errors.TypeError; return CatchFilter.prototype.doFilter = function (e) { for (var cb = this._callback, promise = this._promise, boundTo = promise._boundValue(), i = 0, len = this._instances.length; i < len; ++i) { var item = this._instances[i], itemIsErrorType = item === Error || null != item && item.prototype instanceof Error; if (itemIsErrorType && e instanceof item) { var ret = tryCatch(cb).call(boundTo, e); return ret === errorObj ? (NEXT_FILTER.e = ret.e, NEXT_FILTER) : ret } if ("function" == typeof item && !itemIsErrorType) { var shouldHandle = safePredicate(item, e); if (shouldHandle === errorObj) { e = errorObj.e; break } if (shouldHandle) { var ret = tryCatch(cb).call(boundTo, e); return ret === errorObj ? (NEXT_FILTER.e = ret.e, NEXT_FILTER) : ret } } } return NEXT_FILTER.e = e, NEXT_FILTER }, CatchFilter } }, { "./errors.js": 13, "./es5.js": 14, "./util.js": 38 }], 9: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, CapturedTrace, isDebugging) { function Context() { this._trace = new CapturedTrace(peekContext()) } function createContext() { if (isDebugging()) return new Context } function peekContext() { var lastIndex = contextStack.length - 1; if (lastIndex >= 0) return contextStack[lastIndex] } var contextStack = []; return Context.prototype._pushContext = function () { isDebugging() && void 0 !== this._trace && contextStack.push(this._trace) }, Context.prototype._popContext = function () { isDebugging() && void 0 !== this._trace && contextStack.pop() }, Promise.prototype._peekContext = peekContext, Promise.prototype._pushContext = Context.prototype._pushContext, Promise.prototype._popContext = Context.prototype._popContext, createContext } }, {}], 10: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, CapturedTrace) { var unhandledRejectionHandled, possiblyUnhandledRejection, getDomain = Promise._getDomain, async = _dereq_("./async.js"), Warning = _dereq_("./errors.js").Warning, util = _dereq_("./util.js"), canAttachTrace = util.canAttachTrace, debugging = util.isNode && (!!process.env.BLUEBIRD_DEBUG || "development" === process.env.NODE_ENV); return util.isNode && 0 == process.env.BLUEBIRD_DEBUG && (debugging = !1), debugging && async.disableTrampolineIfNecessary(), Promise.prototype._ignoreRejections = function () { this._unsetRejectionIsUnhandled(), this._bitField = 16777216 | this._bitField }, Promise.prototype._ensurePossibleRejectionHandled = function () { 0 === (16777216 & this._bitField) && (this._setRejectionIsUnhandled(), async.invokeLater(this._notifyUnhandledRejection, this, void 0)) }, Promise.prototype._notifyUnhandledRejectionIsHandled = function () { CapturedTrace.fireRejectionEvent("rejectionHandled", unhandledRejectionHandled, void 0, this) }, Promise.prototype._notifyUnhandledRejection = function () { if (this._isRejectionUnhandled()) { var reason = this._getCarriedStackTrace() || this._settledValue; this._setUnhandledRejectionIsNotified(), CapturedTrace.fireRejectionEvent("unhandledRejection", possiblyUnhandledRejection, reason, this) } }, Promise.prototype._setUnhandledRejectionIsNotified = function () { this._bitField = 524288 | this._bitField }, Promise.prototype._unsetUnhandledRejectionIsNotified = function () { this._bitField = this._bitField & -524289 }, Promise.prototype._isUnhandledRejectionNotified = function () { return (524288 & this._bitField) > 0 }, Promise.prototype._setRejectionIsUnhandled = function () { this._bitField = 2097152 | this._bitField }, Promise.prototype._unsetRejectionIsUnhandled = function () { this._bitField = this._bitField & -2097153, this._isUnhandledRejectionNotified() && (this._unsetUnhandledRejectionIsNotified(), this._notifyUnhandledRejectionIsHandled()) }, Promise.prototype._isRejectionUnhandled = function () { return (2097152 & this._bitField) > 0 }, Promise.prototype._setCarriedStackTrace = function (capturedTrace) { this._bitField = 1048576 | this._bitField, this._fulfillmentHandler0 = capturedTrace }, Promise.prototype._isCarryingStackTrace = function () { return (1048576 & this._bitField) > 0 }, Promise.prototype._getCarriedStackTrace = function () { return this._isCarryingStackTrace() ? this._fulfillmentHandler0 : void 0 }, Promise.prototype._captureStackTrace = function () { return debugging && (this._trace = new CapturedTrace(this._peekContext())), this }, Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { if (debugging && canAttachTrace(error)) { var trace = this._trace; if (void 0 !== trace && ignoreSelf && (trace = trace._parent), void 0 !== trace) trace.attachExtraTrace(error); else if (!error.__stackCleaned__) { var parsed = CapturedTrace.parseStackAndMessage(error); util.notEnumerableProp(error, "stack", parsed.message + "\n" + parsed.stack.join("\n")), util.notEnumerableProp(error, "__stackCleaned__", !0) } } }, Promise.prototype._warn = function (message) { var warning = new Warning(message), ctx = this._peekContext(); if (ctx) ctx.attachExtraTrace(warning); else { var parsed = CapturedTrace.parseStackAndMessage(warning); warning.stack = parsed.message + "\n" + parsed.stack.join("\n") } CapturedTrace.formatAndLogError(warning, "") }, Promise.onPossiblyUnhandledRejection = function (fn) { var domain = getDomain(); possiblyUnhandledRejection = "function" == typeof fn ? null === domain ? fn : domain.bind(fn) : void 0 }, Promise.onUnhandledRejectionHandled = function (fn) { var domain = getDomain(); unhandledRejectionHandled = "function" == typeof fn ? null === domain ? fn : domain.bind(fn) : void 0 }, Promise.longStackTraces = function () { if (async.haveItemsQueued() && debugging === !1) throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/DT1qyG\n"); debugging = CapturedTrace.isSupported(), debugging && async.disableTrampolineIfNecessary() }, Promise.hasLongStackTraces = function () { return debugging && CapturedTrace.isSupported() }, CapturedTrace.isSupported() || (Promise.longStackTraces = function () { }, debugging = !1), function () { return debugging } } }, { "./async.js": 2, "./errors.js": 13, "./util.js": 38 }], 11: [function (_dereq_, module, exports) { "use strict"; var util = _dereq_("./util.js"), isPrimitive = util.isPrimitive; module.exports = function (Promise) { var returner = function () { return this }, thrower = function () { throw this }, returnUndefined = function () { }, throwUndefined = function () { throw void 0 }, wrapper = function (value, action) { return 1 === action ? function () { throw value } : 2 === action ? function () { return value } : void 0 }; Promise.prototype.return = Promise.prototype.thenReturn = function (value) { return void 0 === value ? this.then(returnUndefined) : isPrimitive(value) ? this._then(wrapper(value, 2), void 0, void 0, void 0, void 0) : (value instanceof Promise && value._ignoreRejections(), this._then(returner, void 0, void 0, value, void 0)) }, Promise.prototype.throw = Promise.prototype.thenThrow = function (reason) { return void 0 === reason ? this.then(throwUndefined) : isPrimitive(reason) ? this._then(wrapper(reason, 1), void 0, void 0, void 0, void 0) : this._then(thrower, void 0, void 0, reason, void 0) } } }, { "./util.js": 38 }], 12: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { var PromiseReduce = Promise.reduce; Promise.prototype.each = function (fn) { return PromiseReduce(this, fn, null, INTERNAL) }, Promise.each = function (promises, fn) { return PromiseReduce(promises, fn, null, INTERNAL) } } }, {}], 13: [function (_dereq_, module, exports) { "use strict"; function subError(nameProperty, defaultMessage) { function SubError(message) { return this instanceof SubError ? (notEnumerableProp(this, "message", "string" == typeof message ? message : defaultMessage), notEnumerableProp(this, "name", nameProperty), void (Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : Error.call(this))) : new SubError(message) } return inherits(SubError, Error), SubError } function OperationalError(message) { return this instanceof OperationalError ? (notEnumerableProp(this, "name", "OperationalError"), notEnumerableProp(this, "message", message), this.cause = message, this.isOperational = !0, void (message instanceof Error ? (notEnumerableProp(this, "message", message.message), notEnumerableProp(this, "stack", message.stack)) : Error.captureStackTrace && Error.captureStackTrace(this, this.constructor))) : new OperationalError(message) } var _TypeError, _RangeError, es5 = _dereq_("./es5.js"), Objectfreeze = es5.freeze, util = _dereq_("./util.js"), inherits = util.inherits, notEnumerableProp = util.notEnumerableProp, Warning = subError("Warning", "warning"), CancellationError = subError("CancellationError", "cancellation error"), TimeoutError = subError("TimeoutError", "timeout error"), AggregateError = subError("AggregateError", "aggregate error"); try { _TypeError = TypeError, _RangeError = RangeError } catch (e) { _TypeError = subError("TypeError", "type error"), _RangeError = subError("RangeError", "range error") } for (var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "), i = 0; i < methods.length; ++i)"function" == typeof Array.prototype[methods[i]] && (AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]); es5.defineProperty(AggregateError.prototype, "length", { value: 0, configurable: !1, writable: !0, enumerable: !0 }), AggregateError.prototype.isOperational = !0; var level = 0; AggregateError.prototype.toString = function () { var indent = Array(4 * level + 1).join(" "), ret = "\n" + indent + "AggregateError of:\n"; level++ , indent = Array(4 * level + 1).join(" "); for (var i = 0; i < this.length; ++i) { for (var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "", lines = str.split("\n"), j = 0; j < lines.length; ++j)lines[j] = indent + lines[j]; str = lines.join("\n"), ret += str + "\n" } return level-- , ret }, inherits(OperationalError, Error); var errorTypes = Error.__BluebirdErrorTypes__; errorTypes || (errorTypes = Objectfreeze({ CancellationError: CancellationError, TimeoutError: TimeoutError, OperationalError: OperationalError, RejectionError: OperationalError, AggregateError: AggregateError }), notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes)), module.exports = { Error: Error, TypeError: _TypeError, RangeError: _RangeError, CancellationError: errorTypes.CancellationError, OperationalError: errorTypes.OperationalError, TimeoutError: errorTypes.TimeoutError, AggregateError: errorTypes.AggregateError, Warning: Warning } }, { "./es5.js": 14, "./util.js": 38 }], 14: [function (_dereq_, module, exports) { var isES5 = function () { "use strict"; return void 0 === this }(); if (isES5) module.exports = { freeze: Object.freeze, defineProperty: Object.defineProperty, getDescriptor: Object.getOwnPropertyDescriptor, keys: Object.keys, names: Object.getOwnPropertyNames, getPrototypeOf: Object.getPrototypeOf, isArray: Array.isArray, isES5: isES5, propertyIsWritable: function (obj, prop) { var descriptor = Object.getOwnPropertyDescriptor(obj, prop); return !(descriptor && !descriptor.writable && !descriptor.set) } }; else { var has = {}.hasOwnProperty, str = {}.toString, proto = {}.constructor.prototype, ObjectKeys = function (o) { var ret = []; for (var key in o) has.call(o, key) && ret.push(key); return ret }, ObjectGetDescriptor = function (o, key) { return { value: o[key] } }, ObjectDefineProperty = function (o, key, desc) { return o[key] = desc.value, o }, ObjectFreeze = function (obj) { return obj }, ObjectGetPrototypeOf = function (obj) { try { return Object(obj).constructor.prototype } catch (e) { return proto } }, ArrayIsArray = function (obj) { try { return "[object Array]" === str.call(obj) } catch (e) { return !1 } }; module.exports = { isArray: ArrayIsArray, keys: ObjectKeys, names: ObjectKeys, defineProperty: ObjectDefineProperty, getDescriptor: ObjectGetDescriptor, freeze: ObjectFreeze, getPrototypeOf: ObjectGetPrototypeOf, isES5: isES5, propertyIsWritable: function () { return !0 } } } }, {}], 15: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { var PromiseMap = Promise.map; Promise.prototype.filter = function (fn, options) { return PromiseMap(this, fn, options, INTERNAL) }, Promise.filter = function (promises, fn, options) { return PromiseMap(promises, fn, options, INTERNAL) } } }, {}], 16: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, NEXT_FILTER, tryConvertToPromise) { function returnThis() { return this } function throwThis() { throw this } function return$(r) { return function () { return r } } function throw$(r) { return function () { throw r } } function promisedFinally(ret, reasonOrValue, isFulfilled) { var then; return then = isPrimitive(reasonOrValue) ? isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue) : isFulfilled ? returnThis : throwThis, ret._then(then, thrower, void 0, reasonOrValue, void 0) } function finallyHandler(reasonOrValue) { var promise = this.promise, handler = this.handler, ret = promise._isBound() ? handler.call(promise._boundValue()) : handler(); if (void 0 !== ret) { var maybePromise = tryConvertToPromise(ret, promise); if (maybePromise instanceof Promise) return maybePromise = maybePromise._target(), promisedFinally(maybePromise, reasonOrValue, promise.isFulfilled()) } return promise.isRejected() ? (NEXT_FILTER.e = reasonOrValue, NEXT_FILTER) : reasonOrValue } function tapHandler(value) { var promise = this.promise, handler = this.handler, ret = promise._isBound() ? handler.call(promise._boundValue(), value) : handler(value); if (void 0 !== ret) { var maybePromise = tryConvertToPromise(ret, promise); if (maybePromise instanceof Promise) return maybePromise = maybePromise._target(), promisedFinally(maybePromise, value, !0) } return value } var util = _dereq_("./util.js"), isPrimitive = util.isPrimitive, thrower = util.thrower; Promise.prototype._passThroughHandler = function (handler, isFinally) { if ("function" != typeof handler) return this.then(); var promiseAndHandler = { promise: this, handler: handler }; return this._then(isFinally ? finallyHandler : tapHandler, isFinally ? finallyHandler : void 0, void 0, promiseAndHandler, void 0) }, Promise.prototype.lastly = Promise.prototype.finally = function (handler) { return this._passThroughHandler(handler, !0) }, Promise.prototype.tap = function (handler) { return this._passThroughHandler(handler, !1) } } }, { "./util.js": 38 }], 17: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, apiRejection, INTERNAL, tryConvertToPromise) { function promiseFromYieldHandler(value, yieldHandlers, traceParent) { for (var i = 0; i < yieldHandlers.length; ++i) { traceParent._pushContext(); var result = tryCatch(yieldHandlers[i])(value); if (traceParent._popContext(), result === errorObj) { traceParent._pushContext(); var ret = Promise.reject(errorObj.e); return traceParent._popContext(), ret } var maybePromise = tryConvertToPromise(result, traceParent); if (maybePromise instanceof Promise) return maybePromise } return null } function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { var promise = this._promise = new Promise(INTERNAL); promise._captureStackTrace(), this._stack = stack, this._generatorFunction = generatorFunction, this._receiver = receiver, this._generator = void 0, this._yieldHandlers = "function" == typeof yieldHandler ? [yieldHandler].concat(yieldHandlers) : yieldHandlers } var errors = _dereq_("./errors.js"), TypeError = errors.TypeError, util = _dereq_("./util.js"), errorObj = util.errorObj, tryCatch = util.tryCatch, yieldHandlers = []; PromiseSpawn.prototype.promise = function () { return this._promise }, PromiseSpawn.prototype._run = function () { this._generator = this._generatorFunction.call(this._receiver), this._receiver = this._generatorFunction = void 0, this._next(void 0) }, PromiseSpawn.prototype._continue = function (result) { if (result === errorObj) return this._promise._rejectCallback(result.e, !1, !0); var value = result.value; if (result.done === !0) this._promise._resolveCallback(value); else { var maybePromise = tryConvertToPromise(value, this._promise); if (!(maybePromise instanceof Promise) && (maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise), null === maybePromise)) return void this._throw(new TypeError("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/4Y4pDk\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n"))); maybePromise._then(this._next, this._throw, void 0, this, null) } }, PromiseSpawn.prototype._throw = function (reason) { this._promise._attachExtraTrace(reason), this._promise._pushContext(); var result = tryCatch(this._generator.throw).call(this._generator, reason); this._promise._popContext(), this._continue(result) }, PromiseSpawn.prototype._next = function (value) { this._promise._pushContext(); var result = tryCatch(this._generator.next).call(this._generator, value); this._promise._popContext(), this._continue(result) }, Promise.coroutine = function (generatorFunction, options) { if ("function" != typeof generatorFunction) throw new TypeError("generatorFunction must be a function\n\n See http://goo.gl/6Vqhm0\n"); var yieldHandler = Object(options).yieldHandler, PromiseSpawn$ = PromiseSpawn, stack = (new Error).stack; return function () { var generator = generatorFunction.apply(this, arguments), spawn = new PromiseSpawn$(void 0, void 0, yieldHandler, stack); return spawn._generator = generator, spawn._next(void 0), spawn.promise() } }, Promise.coroutine.addYieldHandler = function (fn) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); yieldHandlers.push(fn) }, Promise.spawn = function (generatorFunction) { if ("function" != typeof generatorFunction) return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/6Vqhm0\n"); var spawn = new PromiseSpawn(generatorFunction, this), ret = spawn.promise(); return spawn._run(Promise.spawn), ret } } }, { "./errors.js": 13, "./util.js": 38 }], 18: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, tryConvertToPromise, INTERNAL) { var util = _dereq_("./util.js"); util.canEvaluate, util.tryCatch, util.errorObj; Promise.join = function () { var fn, last = arguments.length - 1; if (last > 0 && "function" == typeof arguments[last]) { fn = arguments[last]; var ret } for (var $_len = arguments.length, args = new Array($_len), $_i = 0; $_i < $_len; ++$_i)args[$_i] = arguments[$_i]; fn && args.pop(); var ret = new PromiseArray(args).promise(); return void 0 !== fn ? ret.spread(fn) : ret } } }, { "./util.js": 38 }], 19: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL) { function MappingPromiseArray(promises, fn, limit, _filter) { this.constructor$(promises), this._promise._captureStackTrace(); var domain = getDomain(); this._callback = null === domain ? fn : domain.bind(fn), this._preservedValues = _filter === INTERNAL ? new Array(this.length()) : null, this._limit = limit, this._inFlight = 0, this._queue = limit >= 1 ? [] : EMPTY_ARRAY, async.invoke(init, this, void 0) } function init() { this._init$(void 0, -2) } function map(promises, fn, options, _filter) { var limit = "object" == typeof options && null !== options ? options.concurrency : 0; return limit = "number" == typeof limit && isFinite(limit) && limit >= 1 ? limit : 0, new MappingPromiseArray(promises, fn, limit, _filter) } var getDomain = Promise._getDomain, async = _dereq_("./async.js"), util = _dereq_("./util.js"), tryCatch = util.tryCatch, errorObj = util.errorObj, PENDING = {}, EMPTY_ARRAY = []; util.inherits(MappingPromiseArray, PromiseArray), MappingPromiseArray.prototype._init = function () { }, MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { var values = this._values, length = this.length(), preservedValues = this._preservedValues, limit = this._limit; if (values[index] === PENDING) { if (values[index] = value, limit >= 1 && (this._inFlight-- , this._drainQueue(), this._isResolved())) return } else { if (limit >= 1 && this._inFlight >= limit) return values[index] = value, void this._queue.push(index); null !== preservedValues && (preservedValues[index] = value); var callback = this._callback, receiver = this._promise._boundValue(); this._promise._pushContext(); var ret = tryCatch(callback).call(receiver, value, index, length); if (this._promise._popContext(), ret === errorObj) return this._reject(ret.e); var maybePromise = tryConvertToPromise(ret, this._promise); if (maybePromise instanceof Promise) { if (maybePromise = maybePromise._target(), maybePromise._isPending()) return limit >= 1 && this._inFlight++ , values[index] = PENDING, maybePromise._proxyPromiseArray(this, index); if (!maybePromise._isFulfilled()) return this._reject(maybePromise._reason()); ret = maybePromise._value() } values[index] = ret } var totalResolved = ++this._totalResolved; totalResolved >= length && (null !== preservedValues ? this._filter(values, preservedValues) : this._resolve(values)) }, MappingPromiseArray.prototype._drainQueue = function () { for (var queue = this._queue, limit = this._limit, values = this._values; queue.length > 0 && this._inFlight < limit;) { if (this._isResolved()) return; var index = queue.pop(); this._promiseFulfilled(values[index], index) } }, MappingPromiseArray.prototype._filter = function (booleans, values) { for (var len = values.length, ret = new Array(len), j = 0, i = 0; i < len; ++i)booleans[i] && (ret[j++] = values[i]); ret.length = j, this._resolve(ret) }, MappingPromiseArray.prototype.preservedValues = function () { return this._preservedValues }, Promise.prototype.map = function (fn, options) { return "function" != typeof fn ? apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n") : map(this, fn, options, null).promise() }, Promise.map = function (promises, fn, options, _filter) { return "function" != typeof fn ? apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n") : map(promises, fn, options, _filter).promise() } } }, { "./async.js": 2, "./util.js": 38 }], 20: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { var util = _dereq_("./util.js"), tryCatch = util.tryCatch; Promise.method = function (fn) { if ("function" != typeof fn) throw new Promise.TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); return function () { var ret = new Promise(INTERNAL); ret._captureStackTrace(), ret._pushContext(); var value = tryCatch(fn).apply(this, arguments); return ret._popContext(), ret._resolveFromSyncValue(value), ret } }, Promise.attempt = Promise.try = function (fn, args, ctx) { if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var ret = new Promise(INTERNAL); ret._captureStackTrace(), ret._pushContext(); var value = util.isArray(args) ? tryCatch(fn).apply(ctx, args) : tryCatch(fn).call(ctx, args); return ret._popContext(), ret._resolveFromSyncValue(value), ret }, Promise.prototype._resolveFromSyncValue = function (value) { value === util.errorObj ? this._rejectCallback(value.e, !1, !0) : this._resolveCallback(value, !0) } } }, { "./util.js": 38 }], 21: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function spreadAdapter(val, nodeback) { var promise = this; if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); var ret = tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); ret === errorObj && async.throwLater(ret.e) } function successAdapter(val, nodeback) { var promise = this, receiver = promise._boundValue(), ret = void 0 === val ? tryCatch(nodeback).call(receiver, null) : tryCatch(nodeback).call(receiver, null, val); ret === errorObj && async.throwLater(ret.e) } function errorAdapter(reason, nodeback) { var promise = this; if (!reason) { var target = promise._target(), newReason = target._getCarriedStackTrace(); newReason.cause = reason, reason = newReason } var ret = tryCatch(nodeback).call(promise._boundValue(), reason); ret === errorObj && async.throwLater(ret.e) } var util = _dereq_("./util.js"), async = _dereq_("./async.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, options) { if ("function" == typeof nodeback) { var adapter = successAdapter; void 0 !== options && Object(options).spread && (adapter = spreadAdapter), this._then(adapter, errorAdapter, void 0, this, nodeback) } return this } } }, { "./async.js": 2, "./util.js": 38 }], 22: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray) { var util = _dereq_("./util.js"), async = _dereq_("./async.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; Promise.prototype.progressed = function (handler) { return this._then(void 0, void 0, handler, void 0, void 0) }, Promise.prototype._progress = function (progressValue) { this._isFollowingOrFulfilledOrRejected() || this._target()._progressUnchecked(progressValue) }, Promise.prototype._progressHandlerAt = function (index) { return 0 === index ? this._progressHandler0 : this[(index << 2) + index - 5 + 2] }, Promise.prototype._doProgressWith = function (progression) { var progressValue = progression.value, handler = progression.handler, promise = progression.promise, receiver = progression.receiver, ret = tryCatch(handler).call(receiver, progressValue); if (ret === errorObj) { if (null != ret.e && "StopProgressPropagation" !== ret.e.name) { var trace = util.canAttachTrace(ret.e) ? ret.e : new Error(util.toString(ret.e)); promise._attachExtraTrace(trace), promise._progress(ret.e) } } else ret instanceof Promise ? ret._then(promise._progress, null, null, promise, void 0) : promise._progress(ret) }, Promise.prototype._progressUnchecked = function (progressValue) { for (var len = this._length(), progress = this._progress, i = 0; i < len; i++) { var handler = this._progressHandlerAt(i), promise = this._promiseAt(i); if (promise instanceof Promise) "function" == typeof handler ? async.invoke(this._doProgressWith, this, { handler: handler, promise: promise, receiver: this._receiverAt(i), value: progressValue }) : async.invoke(progress, promise, progressValue); else { var receiver = this._receiverAt(i); "function" == typeof handler ? handler.call(receiver, progressValue, promise) : receiver instanceof PromiseArray && !receiver._isResolved() && receiver._promiseProgressed(progressValue, promise) } } } } }, { "./async.js": 2, "./util.js": 38 }], 23: [function (_dereq_, module, exports) { "use strict"; module.exports = function () { function Promise(resolver) { if ("function" != typeof resolver) throw new TypeError("the promise constructor requires a resolver function\n\n See http://goo.gl/EC22Yn\n"); if (this.constructor !== Promise) throw new TypeError("the promise constructor cannot be invoked directly\n\n See http://goo.gl/KsIlge\n"); this._bitField = 0, this._fulfillmentHandler0 = void 0, this._rejectionHandler0 = void 0, this._progressHandler0 = void 0, this._promise0 = void 0, this._receiver0 = void 0, this._settledValue = void 0, resolver !== INTERNAL && this._resolveFromResolver(resolver) } function fillTypes(value) { var p = new Promise(INTERNAL); p._fulfillmentHandler0 = value, p._rejectionHandler0 = value, p._progressHandler0 = value, p._promise0 = value, p._receiver0 = value, p._settledValue = value } var getDomain, makeSelfResolutionError = function () { return new TypeError("circular promise resolution chain\n\n See http://goo.gl/LhFpo0\n") }, reflect = function () { return new Promise.PromiseInspection(this._target()) }, apiRejection = function (msg) { return Promise.reject(new TypeError(msg)) }, util = _dereq_("./util.js"); getDomain = util.isNode ? function () { var ret = process.domain; return void 0 === ret && (ret = null), ret } : function () { return null }, util.notEnumerableProp(Promise, "_getDomain", getDomain); var UNDEFINED_BINDING = {}, async = _dereq_("./async.js"), errors = _dereq_("./errors.js"), TypeError = Promise.TypeError = errors.TypeError; Promise.RangeError = errors.RangeError, Promise.CancellationError = errors.CancellationError, Promise.TimeoutError = errors.TimeoutError, Promise.OperationalError = errors.OperationalError, Promise.RejectionError = errors.OperationalError, Promise.AggregateError = errors.AggregateError; var INTERNAL = function () { }, APPLY = {}, NEXT_FILTER = { e: null }, tryConvertToPromise = _dereq_("./thenables.js")(Promise, INTERNAL), PromiseArray = _dereq_("./promise_array.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), CapturedTrace = _dereq_("./captured_trace.js")(), isDebugging = _dereq_("./debuggability.js")(Promise, CapturedTrace), createContext = _dereq_("./context.js")(Promise, CapturedTrace, isDebugging), CatchFilter = _dereq_("./catch_filter.js")(NEXT_FILTER), PromiseResolver = _dereq_("./promise_resolver.js"), nodebackForPromise = PromiseResolver._nodebackForPromise, errorObj = util.errorObj, tryCatch = util.tryCatch; return Promise.prototype.toString = function () { return "[object Promise]" }, Promise.prototype.caught = Promise.prototype.catch = function (fn) { var len = arguments.length; if (len > 1) { var i, catchInstances = new Array(len - 1), j = 0; for (i = 0; i < len - 1; ++i) { var item = arguments[i]; if ("function" != typeof item) return Promise.reject(new TypeError("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n")); catchInstances[j++] = item } catchInstances.length = j, fn = arguments[i]; var catchFilter = new CatchFilter(catchInstances, fn, this); return this._then(void 0, catchFilter.doFilter, void 0, catchFilter, void 0) } return this._then(void 0, fn, void 0, void 0, void 0) }, Promise.prototype.reflect = function () { return this._then(reflect, reflect, void 0, this, void 0) }, Promise.prototype.then = function (didFulfill, didReject, didProgress) { if (isDebugging() && arguments.length > 0 && "function" != typeof didFulfill && "function" != typeof didReject) { var msg = ".then() only accepts functions but was passed: " + util.classString(didFulfill); arguments.length > 1 && (msg += ", " + util.classString(didReject)), this._warn(msg) } return this._then(didFulfill, didReject, didProgress, void 0, void 0) }, Promise.prototype.done = function (didFulfill, didReject, didProgress) { var promise = this._then(didFulfill, didReject, didProgress, void 0, void 0); promise._setIsFinal() }, Promise.prototype.spread = function (didFulfill, didReject) { return this.all()._then(didFulfill, didReject, void 0, APPLY, void 0) }, Promise.prototype.isCancellable = function () { return !this.isResolved() && this._cancellable() }, Promise.prototype.toJSON = function () { var ret = { isFulfilled: !1, isRejected: !1, fulfillmentValue: void 0, rejectionReason: void 0 }; return this.isFulfilled() ? (ret.fulfillmentValue = this.value(), ret.isFulfilled = !0) : this.isRejected() && (ret.rejectionReason = this.reason(), ret.isRejected = !0), ret }, Promise.prototype.all = function () { return new PromiseArray(this).promise() }, Promise.prototype.error = function (fn) { return this.caught(util.originatesFromRejection, fn) }, Promise.getNewLibraryCopy = module.exports, Promise.is = function (val) { return val instanceof Promise }, Promise.fromNode = function (fn) { var ret = new Promise(INTERNAL), result = tryCatch(fn)(nodebackForPromise(ret)); return result === errorObj && ret._rejectCallback(result.e, !0, !0), ret }, Promise.all = function (promises) { return new PromiseArray(promises).promise() }, Promise.defer = Promise.pending = function () { var promise = new Promise(INTERNAL); return new PromiseResolver(promise) }, Promise.cast = function (obj) { var ret = tryConvertToPromise(obj); if (!(ret instanceof Promise)) { var val = ret; ret = new Promise(INTERNAL), ret._fulfillUnchecked(val) } return ret }, Promise.resolve = Promise.fulfilled = Promise.cast, Promise.reject = Promise.rejected = function (reason) { var ret = new Promise(INTERNAL); return ret._captureStackTrace(), ret._rejectCallback(reason, !0), ret }, Promise.setScheduler = function (fn) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var prev = async._schedule; return async._schedule = fn, prev }, Promise.prototype._then = function (didFulfill, didReject, didProgress, receiver, internalData) { var haveInternalData = void 0 !== internalData, ret = haveInternalData ? internalData : new Promise(INTERNAL); haveInternalData || (ret._propagateFrom(this, 5), ret._captureStackTrace()); var target = this._target(); target !== this && (void 0 === receiver && (receiver = this._boundTo), haveInternalData || ret._setIsMigrated()); var callbackIndex = target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver, getDomain()); return target._isResolved() && !target._isSettlePromisesQueued() && async.invoke(target._settlePromiseAtPostResolution, target, callbackIndex), ret }, Promise.prototype._settlePromiseAtPostResolution = function (index) { this._isRejectionUnhandled() && this._unsetRejectionIsUnhandled(), this._settlePromiseAt(index) }, Promise.prototype._length = function () { return 131071 & this._bitField }, Promise.prototype._isFollowingOrFulfilledOrRejected = function () { return (939524096 & this._bitField) > 0 }, Promise.prototype._isFollowing = function () { return 536870912 === (536870912 & this._bitField) }, Promise.prototype._setLength = function (len) { this._bitField = this._bitField & -131072 | 131071 & len }, Promise.prototype._setFulfilled = function () { this._bitField = 268435456 | this._bitField }, Promise.prototype._setRejected = function () { this._bitField = 134217728 | this._bitField }, Promise.prototype._setFollowing = function () { this._bitField = 536870912 | this._bitField }, Promise.prototype._setIsFinal = function () { this._bitField = 33554432 | this._bitField }, Promise.prototype._isFinal = function () { return (33554432 & this._bitField) > 0 }, Promise.prototype._cancellable = function () { return (67108864 & this._bitField) > 0 }, Promise.prototype._setCancellable = function () { this._bitField = 67108864 | this._bitField }, Promise.prototype._unsetCancellable = function () { this._bitField = this._bitField & -67108865 }, Promise.prototype._setIsMigrated = function () { this._bitField = 4194304 | this._bitField }, Promise.prototype._unsetIsMigrated = function () { this._bitField = this._bitField & -4194305 }, Promise.prototype._isMigrated = function () { return (4194304 & this._bitField) > 0 }, Promise.prototype._receiverAt = function (index) { var ret = 0 === index ? this._receiver0 : this[5 * index - 5 + 4]; if (ret !== UNDEFINED_BINDING) return void 0 === ret && this._isBound() ? this._boundValue() : ret }, Promise.prototype._promiseAt = function (index) { return 0 === index ? this._promise0 : this[5 * index - 5 + 3] }, Promise.prototype._fulfillmentHandlerAt = function (index) { return 0 === index ? this._fulfillmentHandler0 : this[5 * index - 5 + 0] }, Promise.prototype._rejectionHandlerAt = function (index) { return 0 === index ? this._rejectionHandler0 : this[5 * index - 5 + 1] }, Promise.prototype._boundValue = function () { var ret = this._boundTo; return void 0 !== ret && ret instanceof Promise ? ret.isFulfilled() ? ret.value() : void 0 : ret }, Promise.prototype._migrateCallbacks = function (follower, index) { var fulfill = follower._fulfillmentHandlerAt(index), reject = follower._rejectionHandlerAt(index), progress = follower._progressHandlerAt(index), promise = follower._promiseAt(index), receiver = follower._receiverAt(index); promise instanceof Promise && promise._setIsMigrated(), void 0 === receiver && (receiver = UNDEFINED_BINDING), this._addCallbacks(fulfill, reject, progress, promise, receiver, null) }, Promise.prototype._addCallbacks = function (fulfill, reject, progress, promise, receiver, domain) { var index = this._length(); if (index >= 131066 && (index = 0, this._setLength(0)), 0 === index) this._promise0 = promise, void 0 !== receiver && (this._receiver0 = receiver), "function" != typeof fulfill || this._isCarryingStackTrace() || (this._fulfillmentHandler0 = null === domain ? fulfill : domain.bind(fulfill)), "function" == typeof reject && (this._rejectionHandler0 = null === domain ? reject : domain.bind(reject)), "function" == typeof progress && (this._progressHandler0 = null === domain ? progress : domain.bind(progress)); else { var base = 5 * index - 5; this[base + 3] = promise, this[base + 4] = receiver, "function" == typeof fulfill && (this[base + 0] = null === domain ? fulfill : domain.bind(fulfill)), "function" == typeof reject && (this[base + 1] = null === domain ? reject : domain.bind(reject)), "function" == typeof progress && (this[base + 2] = null === domain ? progress : domain.bind(progress)) } return this._setLength(index + 1), index }, Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { var index = this._length(); if (index >= 131066 && (index = 0, this._setLength(0)), 0 === index) this._promise0 = promiseSlotValue, this._receiver0 = receiver; else { var base = 5 * index - 5; this[base + 3] = promiseSlotValue, this[base + 4] = receiver } this._setLength(index + 1) }, Promise.prototype._proxyPromiseArray = function (promiseArray, index) { this._setProxyHandlers(promiseArray, index) }, Promise.prototype._resolveCallback = function (value, shouldBind) { if (!this._isFollowingOrFulfilledOrRejected()) { if (value === this) return this._rejectCallback(makeSelfResolutionError(), !1, !0); var maybePromise = tryConvertToPromise(value, this); if (!(maybePromise instanceof Promise)) return this._fulfill(value); var propagationFlags = 1 | (shouldBind ? 4 : 0); this._propagateFrom(maybePromise, propagationFlags); var promise = maybePromise._target(); if (promise._isPending()) { for (var len = this._length(), i = 0; i < len; ++i)promise._migrateCallbacks(this, i); this._setFollowing(), this._setLength(0), this._setFollowee(promise) } else promise._isFulfilled() ? this._fulfillUnchecked(promise._value()) : this._rejectUnchecked(promise._reason(), promise._getCarriedStackTrace()) } }, Promise.prototype._rejectCallback = function (reason, synchronous, shouldNotMarkOriginatingFromRejection) { shouldNotMarkOriginatingFromRejection || util.markAsOriginatingFromRejection(reason); var trace = util.ensureErrorObject(reason), hasStack = trace === reason; this._attachExtraTrace(trace, !!synchronous && hasStack), this._reject(reason, hasStack ? void 0 : trace) }, Promise.prototype._resolveFromResolver = function (resolver) { var promise = this; this._captureStackTrace(), this._pushContext(); var synchronous = !0, r = tryCatch(resolver)(function (value) { null !== promise && (promise._resolveCallback(value), promise = null) }, function (reason) { null !== promise && (promise._rejectCallback(reason, synchronous), promise = null) }); synchronous = !1, this._popContext(), void 0 !== r && r === errorObj && null !== promise && (promise._rejectCallback(r.e, !0, !0), promise = null) }, Promise.prototype._settlePromiseFromHandler = function (handler, receiver, value, promise) { if (!promise._isRejected()) { promise._pushContext(); var x; if (x = receiver !== APPLY || this._isRejected() ? tryCatch(handler).call(receiver, value) : tryCatch(handler).apply(this._boundValue(), value), promise._popContext(), x === errorObj || x === promise || x === NEXT_FILTER) { var err = x === promise ? makeSelfResolutionError() : x.e; promise._rejectCallback(err, !1, !0) } else promise._resolveCallback(x) } }, Promise.prototype._target = function () { for (var ret = this; ret._isFollowing();)ret = ret._followee(); return ret }, Promise.prototype._followee = function () { return this._rejectionHandler0 }, Promise.prototype._setFollowee = function (promise) { this._rejectionHandler0 = promise }, Promise.prototype._cleanValues = function () { this._cancellable() && (this._cancellationParent = void 0) }, Promise.prototype._propagateFrom = function (parent, flags) { (1 & flags) > 0 && parent._cancellable() && (this._setCancellable(), this._cancellationParent = parent), (4 & flags) > 0 && parent._isBound() && this._setBoundTo(parent._boundTo) }, Promise.prototype._fulfill = function (value) { this._isFollowingOrFulfilledOrRejected() || this._fulfillUnchecked(value) }, Promise.prototype._reject = function (reason, carriedStackTrace) { this._isFollowingOrFulfilledOrRejected() || this._rejectUnchecked(reason, carriedStackTrace) }, Promise.prototype._settlePromiseAt = function (index) { var promise = this._promiseAt(index), isPromise = promise instanceof Promise; if (isPromise && promise._isMigrated()) return promise._unsetIsMigrated(), async.invoke(this._settlePromiseAt, this, index); var handler = this._isFulfilled() ? this._fulfillmentHandlerAt(index) : this._rejectionHandlerAt(index), carriedStackTrace = this._isCarryingStackTrace() ? this._getCarriedStackTrace() : void 0, value = this._settledValue, receiver = this._receiverAt(index); this._clearCallbackDataAtIndex(index), "function" == typeof handler ? isPromise ? this._settlePromiseFromHandler(handler, receiver, value, promise) : handler.call(receiver, value, promise) : receiver instanceof PromiseArray ? receiver._isResolved() || (this._isFulfilled() ? receiver._promiseFulfilled(value, promise) : receiver._promiseRejected(value, promise)) : isPromise && (this._isFulfilled() ? promise._fulfill(value) : promise._reject(value, carriedStackTrace)), index >= 4 && 4 === (31 & index) && async.invokeLater(this._setLength, this, 0) }, Promise.prototype._clearCallbackDataAtIndex = function (index) { if (0 === index) this._isCarryingStackTrace() || (this._fulfillmentHandler0 = void 0), this._rejectionHandler0 = this._progressHandler0 = this._receiver0 = this._promise0 = void 0; else { var base = 5 * index - 5; this[base + 3] = this[base + 4] = this[base + 0] = this[base + 1] = this[base + 2] = void 0 } }, Promise.prototype._isSettlePromisesQueued = function () { return (this._bitField & -1073741824) === -1073741824 }, Promise.prototype._setSettlePromisesQueued = function () { this._bitField = this._bitField | -1073741824 }, Promise.prototype._unsetSettlePromisesQueued = function () { this._bitField = 1073741823 & this._bitField }, Promise.prototype._queueSettlePromises = function () { async.settlePromises(this), this._setSettlePromisesQueued() }, Promise.prototype._fulfillUnchecked = function (value) { if (value === this) { var err = makeSelfResolutionError(); return this._attachExtraTrace(err), this._rejectUnchecked(err, void 0) } this._setFulfilled(), this._settledValue = value, this._cleanValues(), this._length() > 0 && this._queueSettlePromises() }, Promise.prototype._rejectUncheckedCheckError = function (reason) { var trace = util.ensureErrorObject(reason); this._rejectUnchecked(reason, trace === reason ? void 0 : trace) }, Promise.prototype._rejectUnchecked = function (reason, trace) { if (reason === this) { var err = makeSelfResolutionError(); return this._attachExtraTrace(err), this._rejectUnchecked(err) } return this._setRejected(), this._settledValue = reason, this._cleanValues(), this._isFinal() ? void async.throwLater(function (e) { throw "stack" in e && async.invokeFirst(CapturedTrace.unhandledRejection, void 0, e), e }, void 0 === trace ? reason : trace) : (void 0 !== trace && trace !== reason && this._setCarriedStackTrace(trace), void (this._length() > 0 ? this._queueSettlePromises() : this._ensurePossibleRejectionHandled())) }, Promise.prototype._settlePromises = function () { this._unsetSettlePromisesQueued(); for (var len = this._length(), i = 0; i < len; i++)this._settlePromiseAt(i) }, util.notEnumerableProp(Promise, "_makeSelfResolutionError", makeSelfResolutionError), _dereq_("./progress.js")(Promise, PromiseArray), _dereq_("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), _dereq_("./bind.js")(Promise, INTERNAL, tryConvertToPromise), _dereq_("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise), _dereq_("./direct_resolve.js")(Promise), _dereq_("./synchronous_inspection.js")(Promise), _dereq_("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL), Promise.version = "2.11.0", Promise.Promise = Promise, _dereq_("./map.js")(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL), _dereq_("./cancel.js")(Promise), _dereq_("./using.js")(Promise, apiRejection, tryConvertToPromise, createContext), _dereq_("./generators.js")(Promise, apiRejection, INTERNAL, tryConvertToPromise), _dereq_("./nodeify.js")(Promise), _dereq_("./call_get.js")(Promise), _dereq_("./props.js")(Promise, PromiseArray, tryConvertToPromise, apiRejection), _dereq_("./race.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), _dereq_("./reduce.js")(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL), _dereq_("./settle.js")(Promise, PromiseArray), _dereq_("./some.js")(Promise, PromiseArray, apiRejection), _dereq_("./promisify.js")(Promise, INTERNAL), _dereq_("./any.js")(Promise), _dereq_("./each.js")(Promise, INTERNAL), _dereq_("./timers.js")(Promise, INTERNAL), _dereq_("./filter.js")(Promise, INTERNAL), util.toFastProperties(Promise), util.toFastProperties(Promise.prototype), fillTypes({ a: 1 }), fillTypes({ b: 2 }), fillTypes({ c: 3 }), fillTypes(1), fillTypes(function () { }), fillTypes(void 0), fillTypes(!1), fillTypes(new Promise(INTERNAL)), CapturedTrace.setBounds(async.firstLineError, util.lastLineError), Promise } }, { "./any.js": 1, "./async.js": 2, "./bind.js": 3, "./call_get.js": 5, "./cancel.js": 6, "./captured_trace.js": 7, "./catch_filter.js": 8, "./context.js": 9, "./debuggability.js": 10, "./direct_resolve.js": 11, "./each.js": 12, "./errors.js": 13, "./filter.js": 15, "./finally.js": 16, "./generators.js": 17, "./join.js": 18, "./map.js": 19, "./method.js": 20, "./nodeify.js": 21, "./progress.js": 22, "./promise_array.js": 24, "./promise_resolver.js": 25, "./promisify.js": 26, "./props.js": 27, "./race.js": 29, "./reduce.js": 30, "./settle.js": 32, "./some.js": 33, "./synchronous_inspection.js": 34, "./thenables.js": 35, "./timers.js": 36, "./using.js": 37, "./util.js": 38 }], 24: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { function toResolutionValue(val) { switch (val) { case -2: return []; case -3: return {} } } function PromiseArray(values) { var parent, promise = this._promise = new Promise(INTERNAL); values instanceof Promise && (parent = values, promise._propagateFrom(parent, 5)), this._values = values, this._length = 0, this._totalResolved = 0, this._init(void 0, -2) } var util = _dereq_("./util.js"), isArray = util.isArray; return PromiseArray.prototype.length = function () { return this._length }, PromiseArray.prototype.promise = function () { return this._promise }, PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { var values = tryConvertToPromise(this._values, this._promise); if (values instanceof Promise) { if (values = values._target(), this._values = values, !values._isFulfilled()) return values._isPending() ? void values._then(init, this._reject, void 0, this, resolveValueIfEmpty) : void this._reject(values._reason()); if (values = values._value(), !isArray(values)) { var err = new Promise.TypeError("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n"); return void this.__hardReject__(err) } } else if (!isArray(values)) return void this._promise._reject(apiRejection("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n")._reason()); if (0 === values.length) return void (resolveValueIfEmpty === -5 ? this._resolveEmptyArray() : this._resolve(toResolutionValue(resolveValueIfEmpty))); var len = this.getActualLength(values.length); this._length = len, this._values = this.shouldCopyValues() ? new Array(len) : this._values; for (var promise = this._promise, i = 0; i < len; ++i) { var isResolved = this._isResolved(), maybePromise = tryConvertToPromise(values[i], promise); maybePromise instanceof Promise ? (maybePromise = maybePromise._target(), isResolved ? maybePromise._ignoreRejections() : maybePromise._isPending() ? maybePromise._proxyPromiseArray(this, i) : maybePromise._isFulfilled() ? this._promiseFulfilled(maybePromise._value(), i) : this._promiseRejected(maybePromise._reason(), i)) : isResolved || this._promiseFulfilled(maybePromise, i) } }, PromiseArray.prototype._isResolved = function () { return null === this._values }, PromiseArray.prototype._resolve = function (value) { this._values = null, this._promise._fulfill(value) }, PromiseArray.prototype.__hardReject__ = PromiseArray.prototype._reject = function (reason) { this._values = null, this._promise._rejectCallback(reason, !1, !0) }, PromiseArray.prototype._promiseProgressed = function (progressValue, index) { this._promise._progress({ index: index, value: progressValue }) }, PromiseArray.prototype._promiseFulfilled = function (value, index) { this._values[index] = value; var totalResolved = ++this._totalResolved; totalResolved >= this._length && this._resolve(this._values) }, PromiseArray.prototype._promiseRejected = function (reason, index) { this._totalResolved++ , this._reject(reason) }, PromiseArray.prototype.shouldCopyValues = function () { return !0 }, PromiseArray.prototype.getActualLength = function (len) { return len }, PromiseArray } }, { "./util.js": 38 }], 25: [function (_dereq_, module, exports) { "use strict"; function isUntypedError(obj) { return obj instanceof Error && es5.getPrototypeOf(obj) === Error.prototype } function wrapAsOperationalError(obj) { var ret; if (isUntypedError(obj)) { ret = new OperationalError(obj), ret.name = obj.name, ret.message = obj.message, ret.stack = obj.stack; for (var keys = es5.keys(obj), i = 0; i < keys.length; ++i) { var key = keys[i]; rErrorKey.test(key) || (ret[key] = obj[key]) } return ret } return util.markAsOriginatingFromRejection(obj), obj } function nodebackForPromise(promise) { return function (err, value) { if (null !== promise) { if (err) { var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); promise._attachExtraTrace(wrapped), promise._reject(wrapped) } else if (arguments.length > 2) { for (var $_len = arguments.length, args = new Array($_len - 1), $_i = 1; $_i < $_len; ++$_i)args[$_i - 1] = arguments[$_i]; promise._fulfill(args) } else promise._fulfill(value); promise = null } } } var PromiseResolver, util = _dereq_("./util.js"), maybeWrapAsError = util.maybeWrapAsError, errors = _dereq_("./errors.js"), TimeoutError = errors.TimeoutError, OperationalError = errors.OperationalError, haveGetters = util.haveGetters, es5 = _dereq_("./es5.js"), rErrorKey = /^(?:name|message|stack|cause)$/; if (PromiseResolver = haveGetters ? function (promise) { this.promise = promise } : function (promise) { this.promise = promise, this.asCallback = nodebackForPromise(promise), this.callback = this.asCallback }, haveGetters) { var prop = { get: function () { return nodebackForPromise(this.promise) } }; es5.defineProperty(PromiseResolver.prototype, "asCallback", prop), es5.defineProperty(PromiseResolver.prototype, "callback", prop) } PromiseResolver._nodebackForPromise = nodebackForPromise, PromiseResolver.prototype.toString = function () { return "[object PromiseResolver]" }, PromiseResolver.prototype.resolve = PromiseResolver.prototype.fulfill = function (value) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._resolveCallback(value) }, PromiseResolver.prototype.reject = function (reason) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._rejectCallback(reason) }, PromiseResolver.prototype.progress = function (value) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._progress(value) }, PromiseResolver.prototype.cancel = function (err) { this.promise.cancel(err) }, PromiseResolver.prototype.timeout = function () { this.reject(new TimeoutError("timeout")) }, PromiseResolver.prototype.isResolved = function () { return this.promise.isResolved() }, PromiseResolver.prototype.toJSON = function () { return this.promise.toJSON() }, module.exports = PromiseResolver }, { "./errors.js": 13, "./es5.js": 14, "./util.js": 38 }], 26: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function propsFilter(key) { return !noCopyPropsPattern.test(key) } function isPromisified(fn) { try { return fn.__isPromisified__ === !0 } catch (e) { return !1 } } function hasPromisified(obj, key, suffix) { var val = util.getDataPropertyOrDefault(obj, key + suffix, defaultPromisified); return !!val && isPromisified(val) } function checkValid(ret, suffix, suffixRegexp) { for (var i = 0; i < ret.length; i += 2) { var key = ret[i]; if (suffixRegexp.test(key)) for (var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""), j = 0; j < ret.length; j += 2)if (ret[j] === keyWithoutAsyncSuffix) throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/iWrZbw\n".replace("%s", suffix)) } } function promisifiableMethods(obj, suffix, suffixRegexp, filter) { for (var keys = util.inheritedDataKeys(obj), ret = [], i = 0; i < keys.length; ++i) { var key = keys[i], value = obj[key], passesDefaultFilter = filter === defaultFilter || defaultFilter(key, value, obj); "function" != typeof value || isPromisified(value) || hasPromisified(obj, key, suffix) || !filter(key, value, obj, passesDefaultFilter) || ret.push(key, value) } return checkValid(ret, suffix, suffixRegexp), ret } function makeNodePromisifiedClosure(callback, receiver, _, fn) { function promisified() { var _receiver = receiver; receiver === THIS && (_receiver = this); var promise = new Promise(INTERNAL); promise._captureStackTrace(); var cb = "string" == typeof method && this !== defaultThis ? this[method] : callback, fn = nodebackForPromise(promise); try { cb.apply(_receiver, withAppended(arguments, fn)) } catch (e) { promise._rejectCallback(maybeWrapAsError(e), !0, !0) } return promise } var defaultThis = function () { return this }(), method = callback; return "string" == typeof method && (callback = fn), util.notEnumerableProp(promisified, "__isPromisified__", !0), promisified } function promisifyAll(obj, suffix, filter, promisifier) { for (var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"), methods = promisifiableMethods(obj, suffix, suffixRegexp, filter), i = 0, len = methods.length; i < len; i += 2) { var key = methods[i], fn = methods[i + 1], promisifiedKey = key + suffix; if (promisifier === makeNodePromisified) obj[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix); else { var promisified = promisifier(fn, function () { return makeNodePromisified(key, THIS, key, fn, suffix) }); util.notEnumerableProp(promisified, "__isPromisified__", !0), obj[promisifiedKey] = promisified } } return util.toFastProperties(obj), obj } function promisify(callback, receiver) { return makeNodePromisified(callback, receiver, void 0, callback) } var makeNodePromisifiedEval, THIS = {}, util = _dereq_("./util.js"), nodebackForPromise = _dereq_("./promise_resolver.js")._nodebackForPromise, withAppended = util.withAppended, maybeWrapAsError = util.maybeWrapAsError, canEvaluate = util.canEvaluate, TypeError = _dereq_("./errors").TypeError, defaultSuffix = "Async", defaultPromisified = { __isPromisified__: !0 }, noCopyProps = ["arity", "length", "name", "arguments", "caller", "callee", "prototype", "__isPromisified__"], noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"), defaultFilter = function (name) { return util.isIdentifier(name) && "_" !== name.charAt(0) && "constructor" !== name }, escapeIdentRegex = function (str) { return str.replace(/([$])/, "\\$") }, makeNodePromisified = canEvaluate ? makeNodePromisifiedEval : makeNodePromisifiedClosure; Promise.promisify = function (fn, receiver) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); if (isPromisified(fn)) return fn; var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); return util.copyDescriptors(fn, ret, propsFilter), ret }, Promise.promisifyAll = function (target, options) { if ("function" != typeof target && "object" != typeof target) throw new TypeError("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/9ITlV0\n"); options = Object(options); var suffix = options.suffix; "string" != typeof suffix && (suffix = defaultSuffix); var filter = options.filter; "function" != typeof filter && (filter = defaultFilter); var promisifier = options.promisifier; if ("function" != typeof promisifier && (promisifier = makeNodePromisified), !util.isIdentifier(suffix)) throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/8FZo5V\n"); for (var keys = util.inheritedDataKeys(target), i = 0; i < keys.length; ++i) { var value = target[keys[i]]; "constructor" !== keys[i] && util.isClass(value) && (promisifyAll(value.prototype, suffix, filter, promisifier), promisifyAll(value, suffix, filter, promisifier)) } return promisifyAll(target, suffix, filter, promisifier) } } }, { "./errors": 13, "./promise_resolver.js": 25, "./util.js": 38 }], 27: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, tryConvertToPromise, apiRejection) { function PropertiesPromiseArray(obj) { for (var keys = es5.keys(obj), len = keys.length, values = new Array(2 * len), i = 0; i < len; ++i) { var key = keys[i]; values[i] = obj[key], values[i + len] = key } this.constructor$(values) } function props(promises) { var ret, castValue = tryConvertToPromise(promises); return isObject(castValue) ? (ret = castValue instanceof Promise ? castValue._then(Promise.props, void 0, void 0, void 0, void 0) : new PropertiesPromiseArray(castValue).promise(), castValue instanceof Promise && ret._propagateFrom(castValue, 4), ret) : apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/OsFKC8\n") } var util = _dereq_("./util.js"), isObject = util.isObject, es5 = _dereq_("./es5.js"); util.inherits(PropertiesPromiseArray, PromiseArray), PropertiesPromiseArray.prototype._init = function () { this._init$(void 0, -3) }, PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { this._values[index] = value; var totalResolved = ++this._totalResolved; if (totalResolved >= this._length) { for (var val = {}, keyOffset = this.length(), i = 0, len = this.length(); i < len; ++i)val[this._values[i + keyOffset]] = this._values[i]; this._resolve(val) } }, PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { this._promise._progress({ key: this._values[index + this.length()], value: value }) }, PropertiesPromiseArray.prototype.shouldCopyValues = function () { return !1 }, PropertiesPromiseArray.prototype.getActualLength = function (len) { return len >> 1 }, Promise.prototype.props = function () { return props(this) }, Promise.props = function (promises) { return props(promises) } } }, { "./es5.js": 14, "./util.js": 38 }], 28: [function (_dereq_, module, exports) { "use strict"; function arrayMove(src, srcIndex, dst, dstIndex, len) { for (var j = 0; j < len; ++j)dst[j + dstIndex] = src[j + srcIndex], src[j + srcIndex] = void 0 } function Queue(capacity) { this._capacity = capacity, this._length = 0, this._front = 0 } Queue.prototype._willBeOverCapacity = function (size) { return this._capacity < size }, Queue.prototype._pushOne = function (arg) { var length = this.length(); this._checkCapacity(length + 1); var i = this._front + length & this._capacity - 1; this[i] = arg, this._length = length + 1 }, Queue.prototype._unshiftOne = function (value) { var capacity = this._capacity; this._checkCapacity(this.length() + 1); var front = this._front, i = (front - 1 & capacity - 1 ^ capacity) - capacity; this[i] = value, this._front = i, this._length = this.length() + 1 }, Queue.prototype.unshift = function (fn, receiver, arg) { this._unshiftOne(arg), this._unshiftOne(receiver), this._unshiftOne(fn) }, Queue.prototype.push = function (fn, receiver, arg) { var length = this.length() + 3; if (this._willBeOverCapacity(length)) return this._pushOne(fn), this._pushOne(receiver), void this._pushOne(arg); var j = this._front + length - 3; this._checkCapacity(length); var wrapMask = this._capacity - 1; this[j + 0 & wrapMask] = fn, this[j + 1 & wrapMask] = receiver, this[j + 2 & wrapMask] = arg, this._length = length }, Queue.prototype.shift = function () { var front = this._front, ret = this[front]; return this[front] = void 0, this._front = front + 1 & this._capacity - 1, this._length-- , ret }, Queue.prototype.length = function () { return this._length }, Queue.prototype._checkCapacity = function (size) { this._capacity < size && this._resizeTo(this._capacity << 1) }, Queue.prototype._resizeTo = function (capacity) { var oldCapacity = this._capacity; this._capacity = capacity; var front = this._front, length = this._length, moveItemsCount = front + length & oldCapacity - 1; arrayMove(this, 0, this, oldCapacity, moveItemsCount) }, module.exports = Queue }, {}], 29: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { function race(promises, parent) { var maybePromise = tryConvertToPromise(promises); if (maybePromise instanceof Promise) return raceLater(maybePromise); if (!isArray(promises)) return apiRejection("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n"); var ret = new Promise(INTERNAL); void 0 !== parent && ret._propagateFrom(parent, 5); for (var fulfill = ret._fulfill, reject = ret._reject, i = 0, len = promises.length; i < len; ++i) { var val = promises[i]; (void 0 !== val || i in promises) && Promise.cast(val)._then(fulfill, reject, void 0, ret, null) } return ret } var isArray = _dereq_("./util.js").isArray, raceLater = function (promise) { return promise.then(function (array) { return race(array, promise) }) }; Promise.race = function (promises) { return race(promises, void 0) }, Promise.prototype.race = function () { return race(this, void 0) } } }, { "./util.js": 38 }], 30: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL) { function ReductionPromiseArray(promises, fn, accum, _each) { this.constructor$(promises), this._promise._captureStackTrace(), this._preservedValues = _each === INTERNAL ? [] : null, this._zerothIsAccum = void 0 === accum, this._gotAccum = !1, this._reducingIndex = this._zerothIsAccum ? 1 : 0, this._valuesPhase = void 0; var maybePromise = tryConvertToPromise(accum, this._promise), rejected = !1, isPromise = maybePromise instanceof Promise; isPromise && (maybePromise = maybePromise._target(), maybePromise._isPending() ? maybePromise._proxyPromiseArray(this, -1) : maybePromise._isFulfilled() ? (accum = maybePromise._value(), this._gotAccum = !0) : (this._reject(maybePromise._reason()), rejected = !0)), isPromise || this._zerothIsAccum || (this._gotAccum = !0); var domain = getDomain(); this._callback = null === domain ? fn : domain.bind(fn), this._accum = accum, rejected || async.invoke(init, this, void 0) } function init() { this._init$(void 0, -5) } function reduce(promises, fn, initialValue, _each) { if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var array = new ReductionPromiseArray(promises, fn, initialValue, _each); return array.promise() } var getDomain = Promise._getDomain, async = _dereq_("./async.js"), util = _dereq_("./util.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; util.inherits(ReductionPromiseArray, PromiseArray), ReductionPromiseArray.prototype._init = function () { }, ReductionPromiseArray.prototype._resolveEmptyArray = function () { (this._gotAccum || this._zerothIsAccum) && this._resolve(null !== this._preservedValues ? [] : this._accum) }, ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { var values = this._values; values[index] = value; var valuesPhaseIndex, length = this.length(), preservedValues = this._preservedValues, isEach = null !== preservedValues, gotAccum = this._gotAccum, valuesPhase = this._valuesPhase; if (!valuesPhase) for (valuesPhase = this._valuesPhase = new Array(length), valuesPhaseIndex = 0; valuesPhaseIndex < length; ++valuesPhaseIndex)valuesPhase[valuesPhaseIndex] = 0; if (valuesPhaseIndex = valuesPhase[index], 0 === index && this._zerothIsAccum ? (this._accum = value, this._gotAccum = gotAccum = !0, valuesPhase[index] = 0 === valuesPhaseIndex ? 1 : 2) : index === -1 ? (this._accum = value, this._gotAccum = gotAccum = !0) : 0 === valuesPhaseIndex ? valuesPhase[index] = 1 : (valuesPhase[index] = 2, this._accum = value), gotAccum) { for (var ret, callback = this._callback, receiver = this._promise._boundValue(), i = this._reducingIndex; i < length; ++i)if (valuesPhaseIndex = valuesPhase[i], 2 !== valuesPhaseIndex) { if (1 !== valuesPhaseIndex) return; if (value = values[i], this._promise._pushContext(), isEach ? (preservedValues.push(value), ret = tryCatch(callback).call(receiver, value, i, length)) : ret = tryCatch(callback).call(receiver, this._accum, value, i, length), this._promise._popContext(), ret === errorObj) return this._reject(ret.e); var maybePromise = tryConvertToPromise(ret, this._promise); if (maybePromise instanceof Promise) { if (maybePromise = maybePromise._target(), maybePromise._isPending()) return valuesPhase[i] = 4, maybePromise._proxyPromiseArray(this, i); if (!maybePromise._isFulfilled()) return this._reject(maybePromise._reason()); ret = maybePromise._value() } this._reducingIndex = i + 1, this._accum = ret } else this._reducingIndex = i + 1; this._resolve(isEach ? preservedValues : this._accum) } }, Promise.prototype.reduce = function (fn, initialValue) { return reduce(this, fn, initialValue, null) }, Promise.reduce = function (promises, fn, initialValue, _each) { return reduce(promises, fn, initialValue, _each) } } }, { "./async.js": 2, "./util.js": 38 }], 31: [function (_dereq_, module, exports) { "use strict"; var schedule, util = _dereq_("./util"), noAsyncScheduler = function () { throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n") }; if (util.isNode && "undefined" == typeof MutationObserver) { var GlobalSetImmediate = global.setImmediate, ProcessNextTick = process.nextTick; schedule = util.isRecentNode ? function (fn) { GlobalSetImmediate.call(global, fn) } : function (fn) { ProcessNextTick.call(process, fn) } } else "undefined" == typeof MutationObserver || "undefined" != typeof window && window.navigator && window.navigator.standalone ? schedule = "undefined" != typeof setImmediate ? function (fn) { setImmediate(fn) } : "undefined" != typeof setTimeout ? function (fn) { setTimeout(fn, 0) } : noAsyncScheduler : (schedule = function (fn) { var div = document.createElement("div"), observer = new MutationObserver(fn); return observer.observe(div, { attributes: !0 }), function () { div.classList.toggle("foo") } }, schedule.isStatic = !0); module.exports = schedule }, { "./util": 38 }], 32: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray) { function SettledPromiseArray(values) { this.constructor$(values) } var PromiseInspection = Promise.PromiseInspection, util = _dereq_("./util.js"); util.inherits(SettledPromiseArray, PromiseArray), SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { this._values[index] = inspection; var totalResolved = ++this._totalResolved; totalResolved >= this._length && this._resolve(this._values) }, SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { var ret = new PromiseInspection; ret._bitField = 268435456, ret._settledValue = value, this._promiseResolved(index, ret) }, SettledPromiseArray.prototype._promiseRejected = function (reason, index) { var ret = new PromiseInspection; ret._bitField = 134217728, ret._settledValue = reason, this._promiseResolved(index, ret) }, Promise.settle = function (promises) { return new SettledPromiseArray(promises).promise() }, Promise.prototype.settle = function () { return new SettledPromiseArray(this).promise() } } }, { "./util.js": 38 }], 33: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection) { function SomePromiseArray(values) { this.constructor$(values), this._howMany = 0, this._unwrap = !1, this._initialized = !1 } function some(promises, howMany) { if ((0 | howMany) !== howMany || howMany < 0) return apiRejection("expecting a positive integer\n\n See http://goo.gl/1wAmHx\n"); var ret = new SomePromiseArray(promises), promise = ret.promise(); return ret.setHowMany(howMany), ret.init(), promise } var util = _dereq_("./util.js"), RangeError = _dereq_("./errors.js").RangeError, AggregateError = _dereq_("./errors.js").AggregateError, isArray = util.isArray; util.inherits(SomePromiseArray, PromiseArray), SomePromiseArray.prototype._init = function () { if (this._initialized) { if (0 === this._howMany) return void this._resolve([]); this._init$(void 0, -5); var isArrayResolved = isArray(this._values); !this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill() && this._reject(this._getRangeError(this.length())) } }, SomePromiseArray.prototype.init = function () { this._initialized = !0, this._init() }, SomePromiseArray.prototype.setUnwrap = function () { this._unwrap = !0 }, SomePromiseArray.prototype.howMany = function () { return this._howMany }, SomePromiseArray.prototype.setHowMany = function (count) { this._howMany = count }, SomePromiseArray.prototype._promiseFulfilled = function (value) { this._addFulfilled(value), this._fulfilled() === this.howMany() && (this._values.length = this.howMany(), 1 === this.howMany() && this._unwrap ? this._resolve(this._values[0]) : this._resolve(this._values)) }, SomePromiseArray.prototype._promiseRejected = function (reason) { if (this._addRejected(reason), this.howMany() > this._canPossiblyFulfill()) { for (var e = new AggregateError, i = this.length(); i < this._values.length; ++i)e.push(this._values[i]); this._reject(e) } }, SomePromiseArray.prototype._fulfilled = function () { return this._totalResolved }, SomePromiseArray.prototype._rejected = function () { return this._values.length - this.length() }, SomePromiseArray.prototype._addRejected = function (reason) { this._values.push(reason) }, SomePromiseArray.prototype._addFulfilled = function (value) { this._values[this._totalResolved++] = value }, SomePromiseArray.prototype._canPossiblyFulfill = function () { return this.length() - this._rejected() }, SomePromiseArray.prototype._getRangeError = function (count) { var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items"; return new RangeError(message) }, SomePromiseArray.prototype._resolveEmptyArray = function () { this._reject(this._getRangeError(0)) }, Promise.some = function (promises, howMany) { return some(promises, howMany) }, Promise.prototype.some = function (howMany) { return some(this, howMany) }, Promise._SomePromiseArray = SomePromiseArray } }, { "./errors.js": 13, "./util.js": 38 }], 34: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function PromiseInspection(promise) { void 0 !== promise ? (promise = promise._target(), this._bitField = promise._bitField, this._settledValue = promise._settledValue) : (this._bitField = 0, this._settledValue = void 0) } PromiseInspection.prototype.value = function () { if (!this.isFulfilled()) throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n"); return this._settledValue }, PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function () { if (!this.isRejected()) throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n"); return this._settledValue }, PromiseInspection.prototype.isFulfilled = Promise.prototype._isFulfilled = function () { return (268435456 & this._bitField) > 0 }, PromiseInspection.prototype.isRejected = Promise.prototype._isRejected = function () { return (134217728 & this._bitField) > 0 }, PromiseInspection.prototype.isPending = Promise.prototype._isPending = function () { return 0 === (402653184 & this._bitField) }, PromiseInspection.prototype.isResolved = Promise.prototype._isResolved = function () { return (402653184 & this._bitField) > 0 }, Promise.prototype.isPending = function () { return this._target()._isPending() }, Promise.prototype.isRejected = function () { return this._target()._isRejected() }, Promise.prototype.isFulfilled = function () { return this._target()._isFulfilled() }, Promise.prototype.isResolved = function () { return this._target()._isResolved() }, Promise.prototype._value = function () { return this._settledValue }, Promise.prototype._reason = function () { return this._unsetRejectionIsUnhandled(), this._settledValue }, Promise.prototype.value = function () { var target = this._target(); if (!target.isFulfilled()) throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n"); return target._settledValue }, Promise.prototype.reason = function () { var target = this._target(); if (!target.isRejected()) throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n"); return target._unsetRejectionIsUnhandled(), target._settledValue }, Promise.PromiseInspection = PromiseInspection } }, {}], 35: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function tryConvertToPromise(obj, context) { if (isObject(obj)) { if (obj instanceof Promise) return obj; if (isAnyBluebirdPromise(obj)) { var ret = new Promise(INTERNAL); return obj._then(ret._fulfillUnchecked, ret._rejectUncheckedCheckError, ret._progressUnchecked, ret, null), ret } var then = util.tryCatch(getThen)(obj); if (then === errorObj) { context && context._pushContext(); var ret = Promise.reject(then.e); return context && context._popContext(), ret } if ("function" == typeof then) return doThenable(obj, then, context) } return obj } function getThen(obj) { return obj.then } function isAnyBluebirdPromise(obj) { return hasProp.call(obj, "_promise0") } function doThenable(x, then, context) { function resolveFromThenable(value) { promise && (promise._resolveCallback(value), promise = null) } function rejectFromThenable(reason) { promise && (promise._rejectCallback(reason, synchronous, !0), promise = null) } function progressFromThenable(value) { promise && "function" == typeof promise._progress && promise._progress(value) } var promise = new Promise(INTERNAL), ret = promise; context && context._pushContext(), promise._captureStackTrace(), context && context._popContext(); var synchronous = !0, result = util.tryCatch(then).call(x, resolveFromThenable, rejectFromThenable, progressFromThenable); return synchronous = !1, promise && result === errorObj && (promise._rejectCallback(result.e, !0, !0), promise = null), ret } var util = _dereq_("./util.js"), errorObj = util.errorObj, isObject = util.isObject, hasProp = {}.hasOwnProperty; return tryConvertToPromise } }, { "./util.js": 38 }], 36: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function successClear(value) { var handle = this; return handle instanceof Number && (handle = +handle), clearTimeout(handle), value } function failureClear(reason) { var handle = this; throw handle instanceof Number && (handle = +handle), clearTimeout(handle), reason } var util = _dereq_("./util.js"), TimeoutError = Promise.TimeoutError, afterTimeout = function (promise, message) { if (promise.isPending()) { var err; !util.isPrimitive(message) && message instanceof Error ? err = message : ("string" != typeof message && (message = "operation timed out"), err = new TimeoutError(message)), util.markAsOriginatingFromRejection(err), promise._attachExtraTrace(err), promise._cancel(err) } }, afterValue = function (value) { return delay(+this).thenReturn(value) }, delay = Promise.delay = function (value, ms) { if (void 0 === ms) { ms = value, value = void 0; var ret = new Promise(INTERNAL); return setTimeout(function () { ret._fulfill() }, ms), ret } return ms = +ms, Promise.resolve(value)._then(afterValue, null, null, ms, void 0) }; Promise.prototype.delay = function (ms) { return delay(this, ms) }, Promise.prototype.timeout = function (ms, message) { ms = +ms; var ret = this.then().cancellable(); ret._cancellationParent = this; var handle = setTimeout(function () { afterTimeout(ret, message) }, ms); return ret._then(successClear, failureClear, void 0, handle, void 0) } } }, { "./util.js": 38 }], 37: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, apiRejection, tryConvertToPromise, createContext) { function inspectionMapper(inspections) { for (var len = inspections.length, i = 0; i < len; ++i) { var inspection = inspections[i]; if (inspection.isRejected()) return Promise.reject(inspection.error()); inspections[i] = inspection._settledValue } return inspections } function thrower(e) { setTimeout(function () { throw e }, 0) } function castPreservingDisposable(thenable) { var maybePromise = tryConvertToPromise(thenable); return maybePromise !== thenable && "function" == typeof thenable._isDisposable && "function" == typeof thenable._getDisposer && thenable._isDisposable() && maybePromise._setDisposable(thenable._getDisposer()), maybePromise } function dispose(resources, inspection) { function iterator() { if (i >= len) return ret.resolve(); var maybePromise = castPreservingDisposable(resources[i++]); if (maybePromise instanceof Promise && maybePromise._isDisposable()) { try { maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise) } catch (e) { return thrower(e) } if (maybePromise instanceof Promise) return maybePromise._then(iterator, thrower, null, null, null) } iterator() } var i = 0, len = resources.length, ret = Promise.defer(); return iterator(), ret.promise } function disposerSuccess(value) { var inspection = new PromiseInspection; return inspection._settledValue = value, inspection._bitField = 268435456, dispose(this, inspection).thenReturn(value) } function disposerFail(reason) { var inspection = new PromiseInspection; return inspection._settledValue = reason, inspection._bitField = 134217728, dispose(this, inspection).thenThrow(reason) } function Disposer(data, promise, context) { this._data = data, this._promise = promise, this._context = context } function FunctionDisposer(fn, promise, context) { this.constructor$(fn, promise, context) } function maybeUnwrapDisposer(value) { return Disposer.isDisposer(value) ? (this.resources[this.index]._setDisposable(value), value.promise()) : value } var TypeError = _dereq_("./errors.js").TypeError, inherits = _dereq_("./util.js").inherits, PromiseInspection = Promise.PromiseInspection; Disposer.prototype.data = function () { return this._data }, Disposer.prototype.promise = function () { return this._promise }, Disposer.prototype.resource = function () { return this.promise().isFulfilled() ? this.promise().value() : null }, Disposer.prototype.tryDispose = function (inspection) { var resource = this.resource(), context = this._context; void 0 !== context && context._pushContext(); var ret = null !== resource ? this.doDispose(resource, inspection) : null; return void 0 !== context && context._popContext(), this._promise._unsetDisposable(), this._data = null, ret }, Disposer.isDisposer = function (d) { return null != d && "function" == typeof d.resource && "function" == typeof d.tryDispose }, inherits(FunctionDisposer, Disposer), FunctionDisposer.prototype.doDispose = function (resource, inspection) { var fn = this.data(); return fn.call(resource, resource, inspection) }, Promise.using = function () { var len = arguments.length; if (len < 2) return apiRejection("you must pass at least 2 arguments to Promise.using"); var fn = arguments[len - 1]; if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var input, spreadArgs = !0; 2 === len && Array.isArray(arguments[0]) ? (input = arguments[0], len = input.length, spreadArgs = !1) : (input = arguments, len--); for (var resources = new Array(len), i = 0; i < len; ++i) { var resource = input[i]; if (Disposer.isDisposer(resource)) { var disposer = resource; resource = resource.promise(), resource._setDisposable(disposer) } else { var maybePromise = tryConvertToPromise(resource); maybePromise instanceof Promise && (resource = maybePromise._then(maybeUnwrapDisposer, null, null, { resources: resources, index: i }, void 0)) } resources[i] = resource } var promise = Promise.settle(resources).then(inspectionMapper).then(function (vals) { promise._pushContext(); var ret; try { ret = spreadArgs ? fn.apply(void 0, vals) : fn.call(void 0, vals) } finally { promise._popContext() } return ret })._then(disposerSuccess, disposerFail, void 0, resources, void 0); return resources.promise = promise, promise }, Promise.prototype._setDisposable = function (disposer) { this._bitField = 262144 | this._bitField, this._disposer = disposer }, Promise.prototype._isDisposable = function () { return (262144 & this._bitField) > 0 }, Promise.prototype._getDisposer = function () { return this._disposer }, Promise.prototype._unsetDisposable = function () { this._bitField = this._bitField & -262145, this._disposer = void 0 }, Promise.prototype.disposer = function (fn) { if ("function" == typeof fn) return new FunctionDisposer(fn, this, createContext()); throw new TypeError } } }, { "./errors.js": 13, "./util.js": 38 }], 38: [function (_dereq_, module, exports) { "use strict"; function tryCatcher() { try { var target = tryCatchTarget; return tryCatchTarget = null, target.apply(this, arguments) } catch (e) { return errorObj.e = e, errorObj } } function tryCatch(fn) { return tryCatchTarget = fn, tryCatcher } function isPrimitive(val) { return null == val || val === !0 || val === !1 || "string" == typeof val || "number" == typeof val } function isObject(value) { return !isPrimitive(value) } function maybeWrapAsError(maybeError) { return isPrimitive(maybeError) ? new Error(safeToString(maybeError)) : maybeError } function withAppended(target, appendee) { var i, len = target.length, ret = new Array(len + 1); for (i = 0; i < len; ++i)ret[i] = target[i]; return ret[i] = appendee, ret } function getDataPropertyOrDefault(obj, key, defaultValue) { if (!es5.isES5) return {}.hasOwnProperty.call(obj, key) ? obj[key] : void 0; var desc = Object.getOwnPropertyDescriptor(obj, key); return null != desc ? null == desc.get && null == desc.set ? desc.value : defaultValue : void 0 } function notEnumerableProp(obj, name, value) { if (isPrimitive(obj)) return obj; var descriptor = { value: value, configurable: !0, enumerable: !1, writable: !0 }; return es5.defineProperty(obj, name, descriptor), obj } function thrower(r) { throw r } function isClass(fn) { try { if ("function" == typeof fn) { var keys = es5.names(fn.prototype), hasMethods = es5.isES5 && keys.length > 1, hasMethodsOtherThanConstructor = keys.length > 0 && !(1 === keys.length && "constructor" === keys[0]), hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) return !0 } return !1 } catch (e) { return !1 } } function toFastProperties(obj) { function f() { } f.prototype = obj; for (var l = 8; l--;)new f; return obj } function isIdentifier(str) { return rident.test(str) } function filledRange(count, prefix, suffix) { for (var ret = new Array(count), i = 0; i < count; ++i)ret[i] = prefix + i + suffix; return ret } function safeToString(obj) { try { return obj + "" } catch (e) { return "[no string representation]" } } function markAsOriginatingFromRejection(e) { try { notEnumerableProp(e, "isOperational", !0) } catch (ignore) { } } function originatesFromRejection(e) { return null != e && (e instanceof Error.__BluebirdErrorTypes__.OperationalError || e.isOperational === !0) } function canAttachTrace(obj) { return obj instanceof Error && es5.propertyIsWritable(obj, "stack") } function classString(obj) { return {}.toString.call(obj) } function copyDescriptors(from, to, filter) { for (var keys = es5.names(from), i = 0; i < keys.length; ++i) { var key = keys[i]; if (filter(key)) try { es5.defineProperty(to, key, es5.getDescriptor(from, key)) } catch (ignore) { } } } var es5 = _dereq_("./es5.js"), canEvaluate = "undefined" == typeof navigator, haveGetters = function () { try { var o = {}; return es5.defineProperty(o, "f", { get: function () { return 3 } }), 3 === o.f } catch (e) { return !1 } }(), errorObj = { e: {} }, tryCatchTarget, inherits = function (Child, Parent) { function T() { this.constructor = Child, this.constructor$ = Parent; for (var propertyName in Parent.prototype) hasProp.call(Parent.prototype, propertyName) && "$" !== propertyName.charAt(propertyName.length - 1) && (this[propertyName + "$"] = Parent.prototype[propertyName]) } var hasProp = {}.hasOwnProperty; return T.prototype = Parent.prototype, Child.prototype = new T, Child.prototype }, inheritedDataKeys = function () { var excludedPrototypes = [Array.prototype, Object.prototype, Function.prototype], isExcludedProto = function (val) { for (var i = 0; i < excludedPrototypes.length; ++i)if (excludedPrototypes[i] === val) return !0; return !1 }; if (es5.isES5) { var getKeys = Object.getOwnPropertyNames; return function (obj) { for (var ret = [], visitedKeys = Object.create(null); null != obj && !isExcludedProto(obj);) { var keys; try { keys = getKeys(obj) } catch (e) { return ret } for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!visitedKeys[key]) { visitedKeys[key] = !0; var desc = Object.getOwnPropertyDescriptor(obj, key); null != desc && null == desc.get && null == desc.set && ret.push(key) } } obj = es5.getPrototypeOf(obj) } return ret } } var hasProp = {}.hasOwnProperty; return function (obj) { if (isExcludedProto(obj)) return []; var ret = []; enumeration: for (var key in obj) if (hasProp.call(obj, key)) ret.push(key); else { for (var i = 0; i < excludedPrototypes.length; ++i)if (hasProp.call(excludedPrototypes[i], key)) continue enumeration; ret.push(key) } return ret } }(), thisAssignmentPattern = /this\s*\.\s*\S+\s*=/, rident = /^[a-z$_][a-z$_0-9]*$/i, ensureErrorObject = function () { return "stack" in new Error ? function (value) { return canAttachTrace(value) ? value : new Error(safeToString(value)) } : function (value) { if (canAttachTrace(value)) return value; try { throw new Error(safeToString(value)) } catch (err) { return err } } }(), ret = { isClass: isClass, isIdentifier: isIdentifier, inheritedDataKeys: inheritedDataKeys, getDataPropertyOrDefault: getDataPropertyOrDefault, thrower: thrower, isArray: es5.isArray, haveGetters: haveGetters, notEnumerableProp: notEnumerableProp, isPrimitive: isPrimitive, isObject: isObject, canEvaluate: canEvaluate, errorObj: errorObj, tryCatch: tryCatch, inherits: inherits, withAppended: withAppended, maybeWrapAsError: maybeWrapAsError, toFastProperties: toFastProperties, filledRange: filledRange, toString: safeToString, canAttachTrace: canAttachTrace, ensureErrorObject: ensureErrorObject, originatesFromRejection: originatesFromRejection, markAsOriginatingFromRejection: markAsOriginatingFromRejection, classString: classString, copyDescriptors: copyDescriptors, hasDevTools: "undefined" != typeof chrome && chrome && "function" == typeof chrome.loadTimes, isNode: "undefined" != typeof process && "[object process]" === classString(process).toLowerCase() }; ret.isRecentNode = ret.isNode && function () { var version = process.versions.node.split(".").map(Number); return 0 === version[0] && version[1] > 10 || version[0] > 0 }(), ret.isNode && ret.toFastProperties(process); try { throw new Error } catch (e) { ret.lastLineError = e } module.exports = ret }, { "./es5.js": 14 }]}, { }, [4]) (4)}), "undefined" != typeof window && null !== window ? window.P = window.Promise : "undefined" != typeof self && null !== self && (self.P = self.Promise)}).call(exports, __webpack_require__(30), function () { return this }(), __webpack_require__(31).setImmediate)}, function(module, exports) { function isGenerator(obj) { return obj && "function" == typeof obj.next && "function" == typeof obj.throw } function isGeneratorFunction(fn) { return "function" == typeof fn && fn.constructor && "GeneratorFunction" === fn.constructor.name } module.exports = isGenerator, module.exports.fn = isGeneratorFunction }, function(module, exports, __webpack_require__) { var Promise = __webpack_require__(38); module.exports = function () { var deferred = {}; return deferred.promise = new Promise(function (resolve, reject) { deferred.resolve = resolve, deferred.reject = reject }), deferred } }, function(module, exports, __webpack_require__) { (function (process, global, setImmediate) {/* @preserve * The MIT License (MIT) * * Copyright (c) 2013-2015 Petka Antonov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ !function (e) { module.exports = e() }(function () { var define, module, exports; return function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = "function" == typeof _dereq_ && _dereq_; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } for (var i = "function" == typeof _dereq_ && _dereq_, o = 0; o < r.length; o++)s(r[o]); return s }({ 1: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function any(promises) { var ret = new SomePromiseArray(promises), promise = ret.promise(); return ret.setHowMany(1), ret.setUnwrap(), ret.init(), promise } var SomePromiseArray = Promise._SomePromiseArray; Promise.any = function (promises) { return any(promises) }, Promise.prototype.any = function () { return any(this) } } }, {}], 2: [function (_dereq_, module, exports) { "use strict"; function Async() { this._isTickUsed = !1, this._lateQueue = new Queue(16), this._normalQueue = new Queue(16), this._trampolineEnabled = !0; var self = this; this.drainQueues = function () { self._drainQueues() }, this._schedule = schedule.isStatic ? schedule(this.drainQueues) : schedule } function AsyncInvokeLater(fn, receiver, arg) { this._lateQueue.push(fn, receiver, arg), this._queueTick() } function AsyncInvoke(fn, receiver, arg) { this._normalQueue.push(fn, receiver, arg), this._queueTick() } function AsyncSettlePromises(promise) { this._normalQueue._pushOne(promise), this._queueTick() } var firstLineError; try { throw new Error } catch (e) { firstLineError = e } var schedule = _dereq_("./schedule.js"), Queue = _dereq_("./queue.js"), util = _dereq_("./util.js"); Async.prototype.disableTrampolineIfNecessary = function () { util.hasDevTools && (this._trampolineEnabled = !1) }, Async.prototype.enableTrampoline = function () { this._trampolineEnabled || (this._trampolineEnabled = !0, this._schedule = function (fn) { setTimeout(fn, 0) }) }, Async.prototype.haveItemsQueued = function () { return this._normalQueue.length() > 0 }, Async.prototype.throwLater = function (fn, arg) { if (1 === arguments.length && (arg = fn, fn = function () { throw arg }), "undefined" != typeof setTimeout) setTimeout(function () { fn(arg) }, 0); else try { this._schedule(function () { fn(arg) }) } catch (e) { throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n") } }, util.hasDevTools ? (schedule.isStatic && (schedule = function (fn) { setTimeout(fn, 0) }), Async.prototype.invokeLater = function (fn, receiver, arg) { this._trampolineEnabled ? AsyncInvokeLater.call(this, fn, receiver, arg) : this._schedule(function () { setTimeout(function () { fn.call(receiver, arg) }, 100) }) }, Async.prototype.invoke = function (fn, receiver, arg) { this._trampolineEnabled ? AsyncInvoke.call(this, fn, receiver, arg) : this._schedule(function () { fn.call(receiver, arg) }) }, Async.prototype.settlePromises = function (promise) { this._trampolineEnabled ? AsyncSettlePromises.call(this, promise) : this._schedule(function () { promise._settlePromises() }) }) : (Async.prototype.invokeLater = AsyncInvokeLater, Async.prototype.invoke = AsyncInvoke, Async.prototype.settlePromises = AsyncSettlePromises), Async.prototype.invokeFirst = function (fn, receiver, arg) { this._normalQueue.unshift(fn, receiver, arg), this._queueTick() }, Async.prototype._drainQueue = function (queue) { for (; queue.length() > 0;) { var fn = queue.shift(); if ("function" == typeof fn) { var receiver = queue.shift(), arg = queue.shift(); fn.call(receiver, arg) } else fn._settlePromises() } }, Async.prototype._drainQueues = function () { this._drainQueue(this._normalQueue), this._reset(), this._drainQueue(this._lateQueue) }, Async.prototype._queueTick = function () { this._isTickUsed || (this._isTickUsed = !0, this._schedule(this.drainQueues)) }, Async.prototype._reset = function () { this._isTickUsed = !1 }, module.exports = new Async, module.exports.firstLineError = firstLineError }, { "./queue.js": 28, "./schedule.js": 31, "./util.js": 38 }], 3: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise) { var rejectThis = function (_, e) { this._reject(e) }, targetRejected = function (e, context) { context.promiseRejectionQueued = !0, context.bindingPromise._then(rejectThis, rejectThis, null, this, e) }, bindingResolved = function (thisArg, context) { this._isPending() && this._resolveCallback(context.target) }, bindingRejected = function (e, context) { context.promiseRejectionQueued || this._reject(e) }; Promise.prototype.bind = function (thisArg) { var maybePromise = tryConvertToPromise(thisArg), ret = new Promise(INTERNAL); ret._propagateFrom(this, 1); var target = this._target(); if (ret._setBoundTo(maybePromise), maybePromise instanceof Promise) { var context = { promiseRejectionQueued: !1, promise: ret, target: target, bindingPromise: maybePromise }; target._then(INTERNAL, targetRejected, ret._progress, ret, context), maybePromise._then(bindingResolved, bindingRejected, ret._progress, ret, context) } else ret._resolveCallback(target); return ret }, Promise.prototype._setBoundTo = function (obj) { void 0 !== obj ? (this._bitField = 131072 | this._bitField, this._boundTo = obj) : this._bitField = this._bitField & -131073 }, Promise.prototype._isBound = function () { return 131072 === (131072 & this._bitField) }, Promise.bind = function (thisArg, value) { var maybePromise = tryConvertToPromise(thisArg), ret = new Promise(INTERNAL); return ret._setBoundTo(maybePromise), maybePromise instanceof Promise ? maybePromise._then(function () { ret._resolveCallback(value) }, ret._reject, ret._progress, ret, null) : ret._resolveCallback(value), ret } } }, {}], 4: [function (_dereq_, module, exports) { "use strict"; function noConflict() { try { Promise === bluebird && (Promise = old) } catch (e) { } return bluebird } var old; "undefined" != typeof Promise && (old = Promise); var bluebird = _dereq_("./promise.js")(); bluebird.noConflict = noConflict, module.exports = bluebird }, { "./promise.js": 23 }], 5: [function (_dereq_, module, exports) { "use strict"; var cr = Object.create; if (cr) { var callerCache = cr(null), getterCache = cr(null); callerCache[" size"] = getterCache[" size"] = 0 } module.exports = function (Promise) { function ensureMethod(obj, methodName) { var fn; if (null != obj && (fn = obj[methodName]), "function" != typeof fn) { var message = "Object " + util.classString(obj) + " has no method '" + util.toString(methodName) + "'"; throw new Promise.TypeError(message) } return fn } function caller(obj) { var methodName = this.pop(), fn = ensureMethod(obj, methodName); return fn.apply(obj, this) } function namedGetter(obj) { return obj[this] } function indexedGetter(obj) { var index = +this; return index < 0 && (index = Math.max(0, index + obj.length)), obj[index] } var getGetter, util = _dereq_("./util.js"), canEvaluate = util.canEvaluate; util.isIdentifier; Promise.prototype.call = function (methodName) { for (var $_len = arguments.length, args = new Array($_len - 1), $_i = 1; $_i < $_len; ++$_i)args[$_i - 1] = arguments[$_i]; return args.push(methodName), this._then(caller, void 0, void 0, args, void 0) }, Promise.prototype.get = function (propertyName) { var getter, isIndex = "number" == typeof propertyName; if (isIndex) getter = indexedGetter; else if (canEvaluate) { var maybeGetter = getGetter(propertyName); getter = null !== maybeGetter ? maybeGetter : namedGetter } else getter = namedGetter; return this._then(getter, void 0, void 0, propertyName, void 0) } } }, { "./util.js": 38 }], 6: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { var errors = _dereq_("./errors.js"), async = _dereq_("./async.js"), CancellationError = errors.CancellationError; Promise.prototype._cancel = function (reason) { if (!this.isCancellable()) return this; for (var parent, promiseToReject = this; void 0 !== (parent = promiseToReject._cancellationParent) && parent.isCancellable();)promiseToReject = parent; this._unsetCancellable(), promiseToReject._target()._rejectCallback(reason, !1, !0) }, Promise.prototype.cancel = function (reason) { return this.isCancellable() ? (void 0 === reason && (reason = new CancellationError), async.invokeLater(this._cancel, this, reason), this) : this }, Promise.prototype.cancellable = function () { return this._cancellable() ? this : (async.enableTrampoline(), this._setCancellable(), this._cancellationParent = void 0, this) }, Promise.prototype.uncancellable = function () { var ret = this.then(); return ret._unsetCancellable(), ret }, Promise.prototype.fork = function (didFulfill, didReject, didProgress) { var ret = this._then(didFulfill, didReject, didProgress, void 0, void 0); return ret._setCancellable(), ret._cancellationParent = void 0, ret } } }, { "./async.js": 2, "./errors.js": 13 }], 7: [function (_dereq_, module, exports) { "use strict"; module.exports = function () { function CapturedTrace(parent) { this._parent = parent; var length = this._length = 1 + (void 0 === parent ? 0 : parent._length); captureStackTrace(this, CapturedTrace), length > 32 && this.uncycle() } function reconstructStack(message, stacks) { for (var i = 0; i < stacks.length - 1; ++i)stacks[i].push("From previous event:"), stacks[i] = stacks[i].join("\n"); return i < stacks.length && (stacks[i] = stacks[i].join("\n")), message + "\n" + stacks.join("\n") } function removeDuplicateOrEmptyJumps(stacks) { for (var i = 0; i < stacks.length; ++i)(0 === stacks[i].length || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) && (stacks.splice(i, 1), i--) } function removeCommonRoots(stacks) { for (var current = stacks[0], i = 1; i < stacks.length; ++i) { for (var prev = stacks[i], currentLastIndex = current.length - 1, currentLastLine = current[currentLastIndex], commonRootMeetPoint = -1, j = prev.length - 1; j >= 0; --j)if (prev[j] === currentLastLine) { commonRootMeetPoint = j; break } for (var j = commonRootMeetPoint; j >= 0; --j) { var line = prev[j]; if (current[currentLastIndex] !== line) break; current.pop(), currentLastIndex-- } current = prev } } function cleanStack(stack) { for (var ret = [], i = 0; i < stack.length; ++i) { var line = stack[i], isTraceLine = stackFramePattern.test(line) || " (No stack trace)" === line, isInternalFrame = isTraceLine && shouldIgnore(line); isTraceLine && !isInternalFrame && (indentStackFrames && " " !== line.charAt(0) && (line = " " + line), ret.push(line)) } return ret } function stackFramesAsArray(error) { for (var stack = error.stack.replace(/\s+$/g, "").split("\n"), i = 0; i < stack.length; ++i) { var line = stack[i]; if (" (No stack trace)" === line || stackFramePattern.test(line)) break } return i > 0 && (stack = stack.slice(i)), stack } function formatNonError(obj) { var str; if ("function" == typeof obj) str = "[function " + (obj.name || "anonymous") + "]"; else { str = obj.toString(); var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; if (ruselessToString.test(str)) try { var newStr = JSON.stringify(obj); str = newStr } catch (e) { } 0 === str.length && (str = "(empty array)") } return "(<" + snip(str) + ">, no stack trace)" } function snip(str) { var maxChars = 41; return str.length < maxChars ? str : str.substr(0, maxChars - 3) + "..." } function parseLineInfo(line) { var matches = line.match(parseLineInfoRegex); if (matches) return { fileName: matches[1], line: parseInt(matches[2], 10) } } var warn, async = _dereq_("./async.js"), util = _dereq_("./util.js"), bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/, stackFramePattern = null, formatStack = null, indentStackFrames = !1; util.inherits(CapturedTrace, Error), CapturedTrace.prototype.uncycle = function () { var length = this._length; if (!(length < 2)) { for (var nodes = [], stackToIndex = {}, i = 0, node = this; void 0 !== node; ++i)nodes.push(node), node = node._parent; length = this._length = i; for (var i = length - 1; i >= 0; --i) { var stack = nodes[i].stack; void 0 === stackToIndex[stack] && (stackToIndex[stack] = i) } for (var i = 0; i < length; ++i) { var currentStack = nodes[i].stack, index = stackToIndex[currentStack]; if (void 0 !== index && index !== i) { index > 0 && (nodes[index - 1]._parent = void 0, nodes[index - 1]._length = 1), nodes[i]._parent = void 0, nodes[i]._length = 1; var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; index < length - 1 ? (cycleEdgeNode._parent = nodes[index + 1], cycleEdgeNode._parent.uncycle(), cycleEdgeNode._length = cycleEdgeNode._parent._length + 1) : (cycleEdgeNode._parent = void 0, cycleEdgeNode._length = 1); for (var currentChildLength = cycleEdgeNode._length + 1, j = i - 2; j >= 0; --j)nodes[j]._length = currentChildLength, currentChildLength++; return } } } }, CapturedTrace.prototype.parent = function () { return this._parent }, CapturedTrace.prototype.hasParent = function () { return void 0 !== this._parent }, CapturedTrace.prototype.attachExtraTrace = function (error) { if (!error.__stackCleaned__) { this.uncycle(); for (var parsed = CapturedTrace.parseStackAndMessage(error), message = parsed.message, stacks = [parsed.stack], trace = this; void 0 !== trace;)stacks.push(cleanStack(trace.stack.split("\n"))), trace = trace._parent; removeCommonRoots(stacks), removeDuplicateOrEmptyJumps(stacks), util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)), util.notEnumerableProp(error, "__stackCleaned__", !0) } }, CapturedTrace.parseStackAndMessage = function (error) { var stack = error.stack, message = error.toString(); return stack = "string" == typeof stack && stack.length > 0 ? stackFramesAsArray(error) : [" (No stack trace)"], { message: message, stack: cleanStack(stack) } }, CapturedTrace.formatAndLogError = function (error, title) { if ("undefined" != typeof console) { var message; if ("object" == typeof error || "function" == typeof error) { var stack = error.stack; message = title + formatStack(stack, error) } else message = title + String(error); "function" == typeof warn ? warn(message) : "function" != typeof console.log && "object" != typeof console.log || console.log(message) } }, CapturedTrace.unhandledRejection = function (reason) { CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: ") }, CapturedTrace.isSupported = function () { return "function" == typeof captureStackTrace }, CapturedTrace.fireRejectionEvent = function (name, localHandler, reason, promise) { var localEventFired = !1; try { "function" == typeof localHandler && (localEventFired = !0, "rejectionHandled" === name ? localHandler(promise) : localHandler(reason, promise)) } catch (e) { async.throwLater(e) } var globalEventFired = !1; try { globalEventFired = fireGlobalEvent(name, reason, promise) } catch (e) { globalEventFired = !0, async.throwLater(e) } var domEventFired = !1; if (fireDomEvent) try { domEventFired = fireDomEvent(name.toLowerCase(), { reason: reason, promise: promise }) } catch (e) { domEventFired = !0, async.throwLater(e) } globalEventFired || localEventFired || domEventFired || "unhandledRejection" !== name || CapturedTrace.formatAndLogError(reason, "Unhandled rejection ") }; var shouldIgnore = function () { return !1 }, parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; CapturedTrace.setBounds = function (firstLineError, lastLineError) { if (CapturedTrace.isSupported()) { for (var firstFileName, lastFileName, firstStackLines = firstLineError.stack.split("\n"), lastStackLines = lastLineError.stack.split("\n"), firstIndex = -1, lastIndex = -1, i = 0; i < firstStackLines.length; ++i) { var result = parseLineInfo(firstStackLines[i]); if (result) { firstFileName = result.fileName, firstIndex = result.line; break } } for (var i = 0; i < lastStackLines.length; ++i) { var result = parseLineInfo(lastStackLines[i]); if (result) { lastFileName = result.fileName, lastIndex = result.line; break } } firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex || (shouldIgnore = function (line) { if (bluebirdFramePattern.test(line)) return !0; var info = parseLineInfo(line); return !!(info && info.fileName === firstFileName && firstIndex <= info.line && info.line <= lastIndex) }) } }; var fireDomEvent, captureStackTrace = function () { var v8stackFramePattern = /^\s*at\s*/, v8stackFormatter = function (stack, error) { return "string" == typeof stack ? stack : void 0 !== error.name && void 0 !== error.message ? error.toString() : formatNonError(error) }; if ("number" == typeof Error.stackTraceLimit && "function" == typeof Error.captureStackTrace) { Error.stackTraceLimit = Error.stackTraceLimit + 6, stackFramePattern = v8stackFramePattern, formatStack = v8stackFormatter; var captureStackTrace = Error.captureStackTrace; return shouldIgnore = function (line) { return bluebirdFramePattern.test(line) }, function (receiver, ignoreUntil) { Error.stackTraceLimit = Error.stackTraceLimit + 6, captureStackTrace(receiver, ignoreUntil), Error.stackTraceLimit = Error.stackTraceLimit - 6 } } var err = new Error; if ("string" == typeof err.stack && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) return stackFramePattern = /@/, formatStack = v8stackFormatter, indentStackFrames = !0, function (o) { o.stack = (new Error).stack }; var hasStackAfterThrow; try { throw new Error } catch (e) { hasStackAfterThrow = "stack" in e } return "stack" in err || !hasStackAfterThrow || "number" != typeof Error.stackTraceLimit ? (formatStack = function (stack, error) { return "string" == typeof stack ? stack : "object" != typeof error && "function" != typeof error || void 0 === error.name || void 0 === error.message ? formatNonError(error) : error.toString() },null): (stackFramePattern = v8stackFramePattern, formatStack = v8stackFormatter,function(o){ Error.stackTraceLimit = Error.stackTraceLimit + 6; try { throw new Error } catch (e) { o.stack = e.stack } Error.stackTraceLimit = Error.stackTraceLimit - 6 }) }([]), fireGlobalEvent = function () { if (util.isNode) return function (name, reason, promise) { return "rejectionHandled" === name ? process.emit(name, promise) : process.emit(name, reason, promise) }; var customEventWorks = !1, anyEventWorks = !0; try { var ev = new self.CustomEvent("test"); customEventWorks = ev instanceof CustomEvent } catch (e) { } if (!customEventWorks) try { var event = document.createEvent("CustomEvent"); event.initCustomEvent("testingtheevent", !1, !0, {}), self.dispatchEvent(event) } catch (e) { anyEventWorks = !1 } anyEventWorks && (fireDomEvent = function (type, detail) { var event; return customEventWorks ? event = new self.CustomEvent(type, { detail: detail, bubbles: !1, cancelable: !0 }) : self.dispatchEvent && (event = document.createEvent("CustomEvent"), event.initCustomEvent(type, !1, !0, detail)), !!event && !self.dispatchEvent(event) }); var toWindowMethodNameMap = {}; return toWindowMethodNameMap.unhandledRejection = "onunhandledRejection".toLowerCase(), toWindowMethodNameMap.rejectionHandled = "onrejectionHandled".toLowerCase(), function (name, reason, promise) { var methodName = toWindowMethodNameMap[name], method = self[methodName]; return !!method && ("rejectionHandled" === name ? method.call(self, promise) : method.call(self, reason, promise), !0) } }(); return "undefined" != typeof console && "undefined" != typeof console.warn && (warn = function (message) { console.warn(message) }, util.isNode && process.stderr.isTTY ? warn = function (message) { process.stderr.write("" + message + "\n") } : util.isNode || "string" != typeof (new Error).stack || (warn = function (message) { console.warn("%c" + message, "color: red") })), CapturedTrace }}, { "./async.js": 2, "./util.js": 38 }], 8: [function (_dereq_, module, exports) { "use strict"; module.exports = function (NEXT_FILTER) { function CatchFilter(instances, callback, promise) { this._instances = instances, this._callback = callback, this._promise = promise } function safePredicate(predicate, e) { var safeObject = {}, retfilter = tryCatch(predicate).call(safeObject, e); if (retfilter === errorObj) return retfilter; var safeKeys = keys(safeObject); return safeKeys.length ? (errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"), errorObj) : retfilter } var util = _dereq_("./util.js"), errors = _dereq_("./errors.js"), tryCatch = util.tryCatch, errorObj = util.errorObj, keys = _dereq_("./es5.js").keys, TypeError = errors.TypeError; return CatchFilter.prototype.doFilter = function (e) { for (var cb = this._callback, promise = this._promise, boundTo = promise._boundValue(), i = 0, len = this._instances.length; i < len; ++i) { var item = this._instances[i], itemIsErrorType = item === Error || null != item && item.prototype instanceof Error; if (itemIsErrorType && e instanceof item) { var ret = tryCatch(cb).call(boundTo, e); return ret === errorObj ? (NEXT_FILTER.e = ret.e, NEXT_FILTER) : ret } if ("function" == typeof item && !itemIsErrorType) { var shouldHandle = safePredicate(item, e); if (shouldHandle === errorObj) { e = errorObj.e; break } if (shouldHandle) { var ret = tryCatch(cb).call(boundTo, e); return ret === errorObj ? (NEXT_FILTER.e = ret.e, NEXT_FILTER) : ret } } } return NEXT_FILTER.e = e, NEXT_FILTER }, CatchFilter } }, { "./errors.js": 13, "./es5.js": 14, "./util.js": 38 }], 9: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, CapturedTrace, isDebugging) { function Context() { this._trace = new CapturedTrace(peekContext()) } function createContext() { if (isDebugging()) return new Context } function peekContext() { var lastIndex = contextStack.length - 1; if (lastIndex >= 0) return contextStack[lastIndex] } var contextStack = []; return Context.prototype._pushContext = function () { isDebugging() && void 0 !== this._trace && contextStack.push(this._trace) }, Context.prototype._popContext = function () { isDebugging() && void 0 !== this._trace && contextStack.pop() }, Promise.prototype._peekContext = peekContext, Promise.prototype._pushContext = Context.prototype._pushContext, Promise.prototype._popContext = Context.prototype._popContext, createContext } }, {}], 10: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, CapturedTrace) { var unhandledRejectionHandled, possiblyUnhandledRejection, getDomain = Promise._getDomain, async = _dereq_("./async.js"), Warning = _dereq_("./errors.js").Warning, util = _dereq_("./util.js"), canAttachTrace = util.canAttachTrace, debugging = util.isNode && (!!process.env.BLUEBIRD_DEBUG || "development" === process.env.NODE_ENV); return util.isNode && 0 == process.env.BLUEBIRD_DEBUG && (debugging = !1), debugging && async.disableTrampolineIfNecessary(), Promise.prototype._ignoreRejections = function () { this._unsetRejectionIsUnhandled(), this._bitField = 16777216 | this._bitField }, Promise.prototype._ensurePossibleRejectionHandled = function () { 0 === (16777216 & this._bitField) && (this._setRejectionIsUnhandled(), async.invokeLater(this._notifyUnhandledRejection, this, void 0)) }, Promise.prototype._notifyUnhandledRejectionIsHandled = function () { CapturedTrace.fireRejectionEvent("rejectionHandled", unhandledRejectionHandled, void 0, this) }, Promise.prototype._notifyUnhandledRejection = function () { if (this._isRejectionUnhandled()) { var reason = this._getCarriedStackTrace() || this._settledValue; this._setUnhandledRejectionIsNotified(), CapturedTrace.fireRejectionEvent("unhandledRejection", possiblyUnhandledRejection, reason, this) } }, Promise.prototype._setUnhandledRejectionIsNotified = function () { this._bitField = 524288 | this._bitField }, Promise.prototype._unsetUnhandledRejectionIsNotified = function () { this._bitField = this._bitField & -524289 }, Promise.prototype._isUnhandledRejectionNotified = function () { return (524288 & this._bitField) > 0 }, Promise.prototype._setRejectionIsUnhandled = function () { this._bitField = 2097152 | this._bitField }, Promise.prototype._unsetRejectionIsUnhandled = function () { this._bitField = this._bitField & -2097153, this._isUnhandledRejectionNotified() && (this._unsetUnhandledRejectionIsNotified(), this._notifyUnhandledRejectionIsHandled()) }, Promise.prototype._isRejectionUnhandled = function () { return (2097152 & this._bitField) > 0 }, Promise.prototype._setCarriedStackTrace = function (capturedTrace) { this._bitField = 1048576 | this._bitField, this._fulfillmentHandler0 = capturedTrace }, Promise.prototype._isCarryingStackTrace = function () { return (1048576 & this._bitField) > 0 }, Promise.prototype._getCarriedStackTrace = function () { return this._isCarryingStackTrace() ? this._fulfillmentHandler0 : void 0 }, Promise.prototype._captureStackTrace = function () { return debugging && (this._trace = new CapturedTrace(this._peekContext())), this }, Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { if (debugging && canAttachTrace(error)) { var trace = this._trace; if (void 0 !== trace && ignoreSelf && (trace = trace._parent), void 0 !== trace) trace.attachExtraTrace(error); else if (!error.__stackCleaned__) { var parsed = CapturedTrace.parseStackAndMessage(error); util.notEnumerableProp(error, "stack", parsed.message + "\n" + parsed.stack.join("\n")), util.notEnumerableProp(error, "__stackCleaned__", !0) } } }, Promise.prototype._warn = function (message) { var warning = new Warning(message), ctx = this._peekContext(); if (ctx) ctx.attachExtraTrace(warning); else { var parsed = CapturedTrace.parseStackAndMessage(warning); warning.stack = parsed.message + "\n" + parsed.stack.join("\n") } CapturedTrace.formatAndLogError(warning, "") }, Promise.onPossiblyUnhandledRejection = function (fn) { var domain = getDomain(); possiblyUnhandledRejection = "function" == typeof fn ? null === domain ? fn : domain.bind(fn) : void 0 }, Promise.onUnhandledRejectionHandled = function (fn) { var domain = getDomain(); unhandledRejectionHandled = "function" == typeof fn ? null === domain ? fn : domain.bind(fn) : void 0 }, Promise.longStackTraces = function () { if (async.haveItemsQueued() && debugging === !1) throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/DT1qyG\n"); debugging = CapturedTrace.isSupported(), debugging && async.disableTrampolineIfNecessary() }, Promise.hasLongStackTraces = function () { return debugging && CapturedTrace.isSupported() }, CapturedTrace.isSupported() || (Promise.longStackTraces = function () { }, debugging = !1), function () { return debugging } } }, { "./async.js": 2, "./errors.js": 13, "./util.js": 38 }], 11: [function (_dereq_, module, exports) { "use strict"; var util = _dereq_("./util.js"), isPrimitive = util.isPrimitive; module.exports = function (Promise) { var returner = function () { return this }, thrower = function () { throw this }, returnUndefined = function () { }, throwUndefined = function () { throw void 0 }, wrapper = function (value, action) { return 1 === action ? function () { throw value } : 2 === action ? function () { return value } : void 0 }; Promise.prototype.return = Promise.prototype.thenReturn = function (value) { return void 0 === value ? this.then(returnUndefined) : isPrimitive(value) ? this._then(wrapper(value, 2), void 0, void 0, void 0, void 0) : (value instanceof Promise && value._ignoreRejections(), this._then(returner, void 0, void 0, value, void 0)) }, Promise.prototype.throw = Promise.prototype.thenThrow = function (reason) { return void 0 === reason ? this.then(throwUndefined) : isPrimitive(reason) ? this._then(wrapper(reason, 1), void 0, void 0, void 0, void 0) : this._then(thrower, void 0, void 0, reason, void 0) } } }, { "./util.js": 38 }], 12: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { var PromiseReduce = Promise.reduce; Promise.prototype.each = function (fn) { return PromiseReduce(this, fn, null, INTERNAL) }, Promise.each = function (promises, fn) { return PromiseReduce(promises, fn, null, INTERNAL) } } }, {}], 13: [function (_dereq_, module, exports) { "use strict"; function subError(nameProperty, defaultMessage) { function SubError(message) { return this instanceof SubError ? (notEnumerableProp(this, "message", "string" == typeof message ? message : defaultMessage), notEnumerableProp(this, "name", nameProperty), void (Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : Error.call(this))) : new SubError(message) } return inherits(SubError, Error), SubError } function OperationalError(message) { return this instanceof OperationalError ? (notEnumerableProp(this, "name", "OperationalError"), notEnumerableProp(this, "message", message), this.cause = message, this.isOperational = !0, void (message instanceof Error ? (notEnumerableProp(this, "message", message.message), notEnumerableProp(this, "stack", message.stack)) : Error.captureStackTrace && Error.captureStackTrace(this, this.constructor))) : new OperationalError(message) } var _TypeError, _RangeError, es5 = _dereq_("./es5.js"), Objectfreeze = es5.freeze, util = _dereq_("./util.js"), inherits = util.inherits, notEnumerableProp = util.notEnumerableProp, Warning = subError("Warning", "warning"), CancellationError = subError("CancellationError", "cancellation error"), TimeoutError = subError("TimeoutError", "timeout error"), AggregateError = subError("AggregateError", "aggregate error"); try { _TypeError = TypeError, _RangeError = RangeError } catch (e) { _TypeError = subError("TypeError", "type error"), _RangeError = subError("RangeError", "range error") } for (var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "), i = 0; i < methods.length; ++i)"function" == typeof Array.prototype[methods[i]] && (AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]); es5.defineProperty(AggregateError.prototype, "length", { value: 0, configurable: !1, writable: !0, enumerable: !0 }), AggregateError.prototype.isOperational = !0; var level = 0; AggregateError.prototype.toString = function () { var indent = Array(4 * level + 1).join(" "), ret = "\n" + indent + "AggregateError of:\n"; level++ , indent = Array(4 * level + 1).join(" "); for (var i = 0; i < this.length; ++i) { for (var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "", lines = str.split("\n"), j = 0; j < lines.length; ++j)lines[j] = indent + lines[j]; str = lines.join("\n"), ret += str + "\n" } return level-- , ret }, inherits(OperationalError, Error); var errorTypes = Error.__BluebirdErrorTypes__; errorTypes || (errorTypes = Objectfreeze({ CancellationError: CancellationError, TimeoutError: TimeoutError, OperationalError: OperationalError, RejectionError: OperationalError, AggregateError: AggregateError }), notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes)), module.exports = { Error: Error, TypeError: _TypeError, RangeError: _RangeError, CancellationError: errorTypes.CancellationError, OperationalError: errorTypes.OperationalError, TimeoutError: errorTypes.TimeoutError, AggregateError: errorTypes.AggregateError, Warning: Warning } }, { "./es5.js": 14, "./util.js": 38 }], 14: [function (_dereq_, module, exports) { var isES5 = function () { "use strict"; return void 0 === this }(); if (isES5) module.exports = { freeze: Object.freeze, defineProperty: Object.defineProperty, getDescriptor: Object.getOwnPropertyDescriptor, keys: Object.keys, names: Object.getOwnPropertyNames, getPrototypeOf: Object.getPrototypeOf, isArray: Array.isArray, isES5: isES5, propertyIsWritable: function (obj, prop) { var descriptor = Object.getOwnPropertyDescriptor(obj, prop); return !(descriptor && !descriptor.writable && !descriptor.set) } }; else { var has = {}.hasOwnProperty, str = {}.toString, proto = {}.constructor.prototype, ObjectKeys = function (o) { var ret = []; for (var key in o) has.call(o, key) && ret.push(key); return ret }, ObjectGetDescriptor = function (o, key) { return { value: o[key] } }, ObjectDefineProperty = function (o, key, desc) { return o[key] = desc.value, o }, ObjectFreeze = function (obj) { return obj }, ObjectGetPrototypeOf = function (obj) { try { return Object(obj).constructor.prototype } catch (e) { return proto } }, ArrayIsArray = function (obj) { try { return "[object Array]" === str.call(obj) } catch (e) { return !1 } }; module.exports = { isArray: ArrayIsArray, keys: ObjectKeys, names: ObjectKeys, defineProperty: ObjectDefineProperty, getDescriptor: ObjectGetDescriptor, freeze: ObjectFreeze, getPrototypeOf: ObjectGetPrototypeOf, isES5: isES5, propertyIsWritable: function () { return !0 } } } }, {}], 15: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { var PromiseMap = Promise.map; Promise.prototype.filter = function (fn, options) { return PromiseMap(this, fn, options, INTERNAL) }, Promise.filter = function (promises, fn, options) { return PromiseMap(promises, fn, options, INTERNAL) } } }, {}], 16: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, NEXT_FILTER, tryConvertToPromise) { function returnThis() { return this } function throwThis() { throw this } function return$(r) { return function () { return r } } function throw$(r) { return function () { throw r } } function promisedFinally(ret, reasonOrValue, isFulfilled) { var then; return then = isPrimitive(reasonOrValue) ? isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue) : isFulfilled ? returnThis : throwThis, ret._then(then, thrower, void 0, reasonOrValue, void 0) } function finallyHandler(reasonOrValue) { var promise = this.promise, handler = this.handler, ret = promise._isBound() ? handler.call(promise._boundValue()) : handler(); if (void 0 !== ret) { var maybePromise = tryConvertToPromise(ret, promise); if (maybePromise instanceof Promise) return maybePromise = maybePromise._target(), promisedFinally(maybePromise, reasonOrValue, promise.isFulfilled()) } return promise.isRejected() ? (NEXT_FILTER.e = reasonOrValue, NEXT_FILTER) : reasonOrValue } function tapHandler(value) { var promise = this.promise, handler = this.handler, ret = promise._isBound() ? handler.call(promise._boundValue(), value) : handler(value); if (void 0 !== ret) { var maybePromise = tryConvertToPromise(ret, promise); if (maybePromise instanceof Promise) return maybePromise = maybePromise._target(), promisedFinally(maybePromise, value, !0) } return value } var util = _dereq_("./util.js"), isPrimitive = util.isPrimitive, thrower = util.thrower; Promise.prototype._passThroughHandler = function (handler, isFinally) { if ("function" != typeof handler) return this.then(); var promiseAndHandler = { promise: this, handler: handler }; return this._then(isFinally ? finallyHandler : tapHandler, isFinally ? finallyHandler : void 0, void 0, promiseAndHandler, void 0) }, Promise.prototype.lastly = Promise.prototype.finally = function (handler) { return this._passThroughHandler(handler, !0) }, Promise.prototype.tap = function (handler) { return this._passThroughHandler(handler, !1) } } }, { "./util.js": 38 }], 17: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, apiRejection, INTERNAL, tryConvertToPromise) { function promiseFromYieldHandler(value, yieldHandlers, traceParent) { for (var i = 0; i < yieldHandlers.length; ++i) { traceParent._pushContext(); var result = tryCatch(yieldHandlers[i])(value); if (traceParent._popContext(), result === errorObj) { traceParent._pushContext(); var ret = Promise.reject(errorObj.e); return traceParent._popContext(), ret } var maybePromise = tryConvertToPromise(result, traceParent); if (maybePromise instanceof Promise) return maybePromise } return null } function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { var promise = this._promise = new Promise(INTERNAL); promise._captureStackTrace(), this._stack = stack, this._generatorFunction = generatorFunction, this._receiver = receiver, this._generator = void 0, this._yieldHandlers = "function" == typeof yieldHandler ? [yieldHandler].concat(yieldHandlers) : yieldHandlers } var errors = _dereq_("./errors.js"), TypeError = errors.TypeError, util = _dereq_("./util.js"), errorObj = util.errorObj, tryCatch = util.tryCatch, yieldHandlers = []; PromiseSpawn.prototype.promise = function () { return this._promise }, PromiseSpawn.prototype._run = function () { this._generator = this._generatorFunction.call(this._receiver), this._receiver = this._generatorFunction = void 0, this._next(void 0) }, PromiseSpawn.prototype._continue = function (result) { if (result === errorObj) return this._promise._rejectCallback(result.e, !1, !0); var value = result.value; if (result.done === !0) this._promise._resolveCallback(value); else { var maybePromise = tryConvertToPromise(value, this._promise); if (!(maybePromise instanceof Promise) && (maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise), null === maybePromise)) return void this._throw(new TypeError("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/4Y4pDk\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n"))); maybePromise._then(this._next, this._throw, void 0, this, null) } }, PromiseSpawn.prototype._throw = function (reason) { this._promise._attachExtraTrace(reason), this._promise._pushContext(); var result = tryCatch(this._generator.throw).call(this._generator, reason); this._promise._popContext(), this._continue(result) }, PromiseSpawn.prototype._next = function (value) { this._promise._pushContext(); var result = tryCatch(this._generator.next).call(this._generator, value); this._promise._popContext(), this._continue(result) }, Promise.coroutine = function (generatorFunction, options) { if ("function" != typeof generatorFunction) throw new TypeError("generatorFunction must be a function\n\n See http://goo.gl/6Vqhm0\n"); var yieldHandler = Object(options).yieldHandler, PromiseSpawn$ = PromiseSpawn, stack = (new Error).stack; return function () { var generator = generatorFunction.apply(this, arguments), spawn = new PromiseSpawn$(void 0, void 0, yieldHandler, stack); return spawn._generator = generator, spawn._next(void 0), spawn.promise() } }, Promise.coroutine.addYieldHandler = function (fn) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); yieldHandlers.push(fn) }, Promise.spawn = function (generatorFunction) { if ("function" != typeof generatorFunction) return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/6Vqhm0\n"); var spawn = new PromiseSpawn(generatorFunction, this), ret = spawn.promise(); return spawn._run(Promise.spawn), ret } } }, { "./errors.js": 13, "./util.js": 38 }], 18: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, tryConvertToPromise, INTERNAL) { var util = _dereq_("./util.js"); util.canEvaluate, util.tryCatch, util.errorObj; Promise.join = function () { var fn, last = arguments.length - 1; if (last > 0 && "function" == typeof arguments[last]) { fn = arguments[last]; var ret } for (var $_len = arguments.length, args = new Array($_len), $_i = 0; $_i < $_len; ++$_i)args[$_i] = arguments[$_i]; fn && args.pop(); var ret = new PromiseArray(args).promise(); return void 0 !== fn ? ret.spread(fn) : ret } } }, { "./util.js": 38 }], 19: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL) { function MappingPromiseArray(promises, fn, limit, _filter) { this.constructor$(promises), this._promise._captureStackTrace(); var domain = getDomain(); this._callback = null === domain ? fn : domain.bind(fn), this._preservedValues = _filter === INTERNAL ? new Array(this.length()) : null, this._limit = limit, this._inFlight = 0, this._queue = limit >= 1 ? [] : EMPTY_ARRAY, async.invoke(init, this, void 0) } function init() { this._init$(void 0, -2) } function map(promises, fn, options, _filter) { var limit = "object" == typeof options && null !== options ? options.concurrency : 0; return limit = "number" == typeof limit && isFinite(limit) && limit >= 1 ? limit : 0, new MappingPromiseArray(promises, fn, limit, _filter) } var getDomain = Promise._getDomain, async = _dereq_("./async.js"), util = _dereq_("./util.js"), tryCatch = util.tryCatch, errorObj = util.errorObj, PENDING = {}, EMPTY_ARRAY = []; util.inherits(MappingPromiseArray, PromiseArray), MappingPromiseArray.prototype._init = function () { }, MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { var values = this._values, length = this.length(), preservedValues = this._preservedValues, limit = this._limit; if (values[index] === PENDING) { if (values[index] = value, limit >= 1 && (this._inFlight-- , this._drainQueue(), this._isResolved())) return } else { if (limit >= 1 && this._inFlight >= limit) return values[index] = value, void this._queue.push(index); null !== preservedValues && (preservedValues[index] = value); var callback = this._callback, receiver = this._promise._boundValue(); this._promise._pushContext(); var ret = tryCatch(callback).call(receiver, value, index, length); if (this._promise._popContext(), ret === errorObj) return this._reject(ret.e); var maybePromise = tryConvertToPromise(ret, this._promise); if (maybePromise instanceof Promise) { if (maybePromise = maybePromise._target(), maybePromise._isPending()) return limit >= 1 && this._inFlight++ , values[index] = PENDING, maybePromise._proxyPromiseArray(this, index); if (!maybePromise._isFulfilled()) return this._reject(maybePromise._reason()); ret = maybePromise._value() } values[index] = ret } var totalResolved = ++this._totalResolved; totalResolved >= length && (null !== preservedValues ? this._filter(values, preservedValues) : this._resolve(values)) }, MappingPromiseArray.prototype._drainQueue = function () { for (var queue = this._queue, limit = this._limit, values = this._values; queue.length > 0 && this._inFlight < limit;) { if (this._isResolved()) return; var index = queue.pop(); this._promiseFulfilled(values[index], index) } }, MappingPromiseArray.prototype._filter = function (booleans, values) { for (var len = values.length, ret = new Array(len), j = 0, i = 0; i < len; ++i)booleans[i] && (ret[j++] = values[i]); ret.length = j, this._resolve(ret) }, MappingPromiseArray.prototype.preservedValues = function () { return this._preservedValues }, Promise.prototype.map = function (fn, options) { return "function" != typeof fn ? apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n") : map(this, fn, options, null).promise() }, Promise.map = function (promises, fn, options, _filter) { return "function" != typeof fn ? apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n") : map(promises, fn, options, _filter).promise() } } }, { "./async.js": 2, "./util.js": 38 }], 20: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { var util = _dereq_("./util.js"), tryCatch = util.tryCatch; Promise.method = function (fn) { if ("function" != typeof fn) throw new Promise.TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); return function () { var ret = new Promise(INTERNAL); ret._captureStackTrace(), ret._pushContext(); var value = tryCatch(fn).apply(this, arguments); return ret._popContext(), ret._resolveFromSyncValue(value), ret } }, Promise.attempt = Promise.try = function (fn, args, ctx) { if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var ret = new Promise(INTERNAL); ret._captureStackTrace(), ret._pushContext(); var value = util.isArray(args) ? tryCatch(fn).apply(ctx, args) : tryCatch(fn).call(ctx, args); return ret._popContext(), ret._resolveFromSyncValue(value), ret }, Promise.prototype._resolveFromSyncValue = function (value) { value === util.errorObj ? this._rejectCallback(value.e, !1, !0) : this._resolveCallback(value, !0) } } }, { "./util.js": 38 }], 21: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function spreadAdapter(val, nodeback) { var promise = this; if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); var ret = tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); ret === errorObj && async.throwLater(ret.e) } function successAdapter(val, nodeback) { var promise = this, receiver = promise._boundValue(), ret = void 0 === val ? tryCatch(nodeback).call(receiver, null) : tryCatch(nodeback).call(receiver, null, val); ret === errorObj && async.throwLater(ret.e) } function errorAdapter(reason, nodeback) { var promise = this; if (!reason) { var target = promise._target(), newReason = target._getCarriedStackTrace(); newReason.cause = reason, reason = newReason } var ret = tryCatch(nodeback).call(promise._boundValue(), reason); ret === errorObj && async.throwLater(ret.e) } var util = _dereq_("./util.js"), async = _dereq_("./async.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, options) { if ("function" == typeof nodeback) { var adapter = successAdapter; void 0 !== options && Object(options).spread && (adapter = spreadAdapter), this._then(adapter, errorAdapter, void 0, this, nodeback) } return this } } }, { "./async.js": 2, "./util.js": 38 }], 22: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray) { var util = _dereq_("./util.js"), async = _dereq_("./async.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; Promise.prototype.progressed = function (handler) { return this._then(void 0, void 0, handler, void 0, void 0) }, Promise.prototype._progress = function (progressValue) { this._isFollowingOrFulfilledOrRejected() || this._target()._progressUnchecked(progressValue) }, Promise.prototype._progressHandlerAt = function (index) { return 0 === index ? this._progressHandler0 : this[(index << 2) + index - 5 + 2] }, Promise.prototype._doProgressWith = function (progression) { var progressValue = progression.value, handler = progression.handler, promise = progression.promise, receiver = progression.receiver, ret = tryCatch(handler).call(receiver, progressValue); if (ret === errorObj) { if (null != ret.e && "StopProgressPropagation" !== ret.e.name) { var trace = util.canAttachTrace(ret.e) ? ret.e : new Error(util.toString(ret.e)); promise._attachExtraTrace(trace), promise._progress(ret.e) } } else ret instanceof Promise ? ret._then(promise._progress, null, null, promise, void 0) : promise._progress(ret) }, Promise.prototype._progressUnchecked = function (progressValue) { for (var len = this._length(), progress = this._progress, i = 0; i < len; i++) { var handler = this._progressHandlerAt(i), promise = this._promiseAt(i); if (promise instanceof Promise) "function" == typeof handler ? async.invoke(this._doProgressWith, this, { handler: handler, promise: promise, receiver: this._receiverAt(i), value: progressValue }) : async.invoke(progress, promise, progressValue); else { var receiver = this._receiverAt(i); "function" == typeof handler ? handler.call(receiver, progressValue, promise) : receiver instanceof PromiseArray && !receiver._isResolved() && receiver._promiseProgressed(progressValue, promise) } } } } }, { "./async.js": 2, "./util.js": 38 }], 23: [function (_dereq_, module, exports) { "use strict"; module.exports = function () { function Promise(resolver) { if ("function" != typeof resolver) throw new TypeError("the promise constructor requires a resolver function\n\n See http://goo.gl/EC22Yn\n"); if (this.constructor !== Promise) throw new TypeError("the promise constructor cannot be invoked directly\n\n See http://goo.gl/KsIlge\n"); this._bitField = 0, this._fulfillmentHandler0 = void 0, this._rejectionHandler0 = void 0, this._progressHandler0 = void 0, this._promise0 = void 0, this._receiver0 = void 0, this._settledValue = void 0, resolver !== INTERNAL && this._resolveFromResolver(resolver) } function fillTypes(value) { var p = new Promise(INTERNAL); p._fulfillmentHandler0 = value, p._rejectionHandler0 = value, p._progressHandler0 = value, p._promise0 = value, p._receiver0 = value, p._settledValue = value } var getDomain, makeSelfResolutionError = function () { return new TypeError("circular promise resolution chain\n\n See http://goo.gl/LhFpo0\n") }, reflect = function () { return new Promise.PromiseInspection(this._target()) }, apiRejection = function (msg) { return Promise.reject(new TypeError(msg)) }, util = _dereq_("./util.js"); getDomain = util.isNode ? function () { var ret = process.domain; return void 0 === ret && (ret = null), ret } : function () { return null }, util.notEnumerableProp(Promise, "_getDomain", getDomain); var UNDEFINED_BINDING = {}, async = _dereq_("./async.js"), errors = _dereq_("./errors.js"), TypeError = Promise.TypeError = errors.TypeError; Promise.RangeError = errors.RangeError, Promise.CancellationError = errors.CancellationError, Promise.TimeoutError = errors.TimeoutError, Promise.OperationalError = errors.OperationalError, Promise.RejectionError = errors.OperationalError, Promise.AggregateError = errors.AggregateError; var INTERNAL = function () { }, APPLY = {}, NEXT_FILTER = { e: null }, tryConvertToPromise = _dereq_("./thenables.js")(Promise, INTERNAL), PromiseArray = _dereq_("./promise_array.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), CapturedTrace = _dereq_("./captured_trace.js")(), isDebugging = _dereq_("./debuggability.js")(Promise, CapturedTrace), createContext = _dereq_("./context.js")(Promise, CapturedTrace, isDebugging), CatchFilter = _dereq_("./catch_filter.js")(NEXT_FILTER), PromiseResolver = _dereq_("./promise_resolver.js"), nodebackForPromise = PromiseResolver._nodebackForPromise, errorObj = util.errorObj, tryCatch = util.tryCatch; return Promise.prototype.toString = function () { return "[object Promise]" }, Promise.prototype.caught = Promise.prototype.catch = function (fn) { var len = arguments.length; if (len > 1) { var i, catchInstances = new Array(len - 1), j = 0; for (i = 0; i < len - 1; ++i) { var item = arguments[i]; if ("function" != typeof item) return Promise.reject(new TypeError("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n")); catchInstances[j++] = item } catchInstances.length = j, fn = arguments[i]; var catchFilter = new CatchFilter(catchInstances, fn, this); return this._then(void 0, catchFilter.doFilter, void 0, catchFilter, void 0) } return this._then(void 0, fn, void 0, void 0, void 0) }, Promise.prototype.reflect = function () { return this._then(reflect, reflect, void 0, this, void 0) }, Promise.prototype.then = function (didFulfill, didReject, didProgress) { if (isDebugging() && arguments.length > 0 && "function" != typeof didFulfill && "function" != typeof didReject) { var msg = ".then() only accepts functions but was passed: " + util.classString(didFulfill); arguments.length > 1 && (msg += ", " + util.classString(didReject)), this._warn(msg) } return this._then(didFulfill, didReject, didProgress, void 0, void 0) }, Promise.prototype.done = function (didFulfill, didReject, didProgress) { var promise = this._then(didFulfill, didReject, didProgress, void 0, void 0); promise._setIsFinal() }, Promise.prototype.spread = function (didFulfill, didReject) { return this.all()._then(didFulfill, didReject, void 0, APPLY, void 0) }, Promise.prototype.isCancellable = function () { return !this.isResolved() && this._cancellable() }, Promise.prototype.toJSON = function () { var ret = { isFulfilled: !1, isRejected: !1, fulfillmentValue: void 0, rejectionReason: void 0 }; return this.isFulfilled() ? (ret.fulfillmentValue = this.value(), ret.isFulfilled = !0) : this.isRejected() && (ret.rejectionReason = this.reason(), ret.isRejected = !0), ret }, Promise.prototype.all = function () { return new PromiseArray(this).promise() }, Promise.prototype.error = function (fn) { return this.caught(util.originatesFromRejection, fn) }, Promise.getNewLibraryCopy = module.exports, Promise.is = function (val) { return val instanceof Promise }, Promise.fromNode = function (fn) { var ret = new Promise(INTERNAL), result = tryCatch(fn)(nodebackForPromise(ret)); return result === errorObj && ret._rejectCallback(result.e, !0, !0), ret }, Promise.all = function (promises) { return new PromiseArray(promises).promise() }, Promise.defer = Promise.pending = function () { var promise = new Promise(INTERNAL); return new PromiseResolver(promise) }, Promise.cast = function (obj) { var ret = tryConvertToPromise(obj); if (!(ret instanceof Promise)) { var val = ret; ret = new Promise(INTERNAL), ret._fulfillUnchecked(val) } return ret }, Promise.resolve = Promise.fulfilled = Promise.cast, Promise.reject = Promise.rejected = function (reason) { var ret = new Promise(INTERNAL); return ret._captureStackTrace(), ret._rejectCallback(reason, !0), ret }, Promise.setScheduler = function (fn) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var prev = async._schedule; return async._schedule = fn, prev }, Promise.prototype._then = function (didFulfill, didReject, didProgress, receiver, internalData) { var haveInternalData = void 0 !== internalData, ret = haveInternalData ? internalData : new Promise(INTERNAL); haveInternalData || (ret._propagateFrom(this, 5), ret._captureStackTrace()); var target = this._target(); target !== this && (void 0 === receiver && (receiver = this._boundTo), haveInternalData || ret._setIsMigrated()); var callbackIndex = target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver, getDomain()); return target._isResolved() && !target._isSettlePromisesQueued() && async.invoke(target._settlePromiseAtPostResolution, target, callbackIndex), ret }, Promise.prototype._settlePromiseAtPostResolution = function (index) { this._isRejectionUnhandled() && this._unsetRejectionIsUnhandled(), this._settlePromiseAt(index) }, Promise.prototype._length = function () { return 131071 & this._bitField }, Promise.prototype._isFollowingOrFulfilledOrRejected = function () { return (939524096 & this._bitField) > 0 }, Promise.prototype._isFollowing = function () { return 536870912 === (536870912 & this._bitField) }, Promise.prototype._setLength = function (len) { this._bitField = this._bitField & -131072 | 131071 & len }, Promise.prototype._setFulfilled = function () { this._bitField = 268435456 | this._bitField }, Promise.prototype._setRejected = function () { this._bitField = 134217728 | this._bitField }, Promise.prototype._setFollowing = function () { this._bitField = 536870912 | this._bitField }, Promise.prototype._setIsFinal = function () { this._bitField = 33554432 | this._bitField }, Promise.prototype._isFinal = function () { return (33554432 & this._bitField) > 0 }, Promise.prototype._cancellable = function () { return (67108864 & this._bitField) > 0 }, Promise.prototype._setCancellable = function () { this._bitField = 67108864 | this._bitField }, Promise.prototype._unsetCancellable = function () { this._bitField = this._bitField & -67108865 }, Promise.prototype._setIsMigrated = function () { this._bitField = 4194304 | this._bitField }, Promise.prototype._unsetIsMigrated = function () { this._bitField = this._bitField & -4194305 }, Promise.prototype._isMigrated = function () { return (4194304 & this._bitField) > 0 }, Promise.prototype._receiverAt = function (index) { var ret = 0 === index ? this._receiver0 : this[5 * index - 5 + 4]; if (ret !== UNDEFINED_BINDING) return void 0 === ret && this._isBound() ? this._boundValue() : ret }, Promise.prototype._promiseAt = function (index) { return 0 === index ? this._promise0 : this[5 * index - 5 + 3] }, Promise.prototype._fulfillmentHandlerAt = function (index) { return 0 === index ? this._fulfillmentHandler0 : this[5 * index - 5 + 0] }, Promise.prototype._rejectionHandlerAt = function (index) { return 0 === index ? this._rejectionHandler0 : this[5 * index - 5 + 1] }, Promise.prototype._boundValue = function () { var ret = this._boundTo; return void 0 !== ret && ret instanceof Promise ? ret.isFulfilled() ? ret.value() : void 0 : ret }, Promise.prototype._migrateCallbacks = function (follower, index) { var fulfill = follower._fulfillmentHandlerAt(index), reject = follower._rejectionHandlerAt(index), progress = follower._progressHandlerAt(index), promise = follower._promiseAt(index), receiver = follower._receiverAt(index); promise instanceof Promise && promise._setIsMigrated(), void 0 === receiver && (receiver = UNDEFINED_BINDING), this._addCallbacks(fulfill, reject, progress, promise, receiver, null) }, Promise.prototype._addCallbacks = function (fulfill, reject, progress, promise, receiver, domain) { var index = this._length(); if (index >= 131066 && (index = 0, this._setLength(0)), 0 === index) this._promise0 = promise, void 0 !== receiver && (this._receiver0 = receiver), "function" != typeof fulfill || this._isCarryingStackTrace() || (this._fulfillmentHandler0 = null === domain ? fulfill : domain.bind(fulfill)), "function" == typeof reject && (this._rejectionHandler0 = null === domain ? reject : domain.bind(reject)), "function" == typeof progress && (this._progressHandler0 = null === domain ? progress : domain.bind(progress)); else { var base = 5 * index - 5; this[base + 3] = promise, this[base + 4] = receiver, "function" == typeof fulfill && (this[base + 0] = null === domain ? fulfill : domain.bind(fulfill)), "function" == typeof reject && (this[base + 1] = null === domain ? reject : domain.bind(reject)), "function" == typeof progress && (this[base + 2] = null === domain ? progress : domain.bind(progress)) } return this._setLength(index + 1), index }, Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { var index = this._length(); if (index >= 131066 && (index = 0, this._setLength(0)), 0 === index) this._promise0 = promiseSlotValue, this._receiver0 = receiver; else { var base = 5 * index - 5; this[base + 3] = promiseSlotValue, this[base + 4] = receiver } this._setLength(index + 1) }, Promise.prototype._proxyPromiseArray = function (promiseArray, index) { this._setProxyHandlers(promiseArray, index) }, Promise.prototype._resolveCallback = function (value, shouldBind) { if (!this._isFollowingOrFulfilledOrRejected()) { if (value === this) return this._rejectCallback(makeSelfResolutionError(), !1, !0); var maybePromise = tryConvertToPromise(value, this); if (!(maybePromise instanceof Promise)) return this._fulfill(value); var propagationFlags = 1 | (shouldBind ? 4 : 0); this._propagateFrom(maybePromise, propagationFlags); var promise = maybePromise._target(); if (promise._isPending()) { for (var len = this._length(), i = 0; i < len; ++i)promise._migrateCallbacks(this, i); this._setFollowing(), this._setLength(0), this._setFollowee(promise) } else promise._isFulfilled() ? this._fulfillUnchecked(promise._value()) : this._rejectUnchecked(promise._reason(), promise._getCarriedStackTrace()) } }, Promise.prototype._rejectCallback = function (reason, synchronous, shouldNotMarkOriginatingFromRejection) { shouldNotMarkOriginatingFromRejection || util.markAsOriginatingFromRejection(reason); var trace = util.ensureErrorObject(reason), hasStack = trace === reason; this._attachExtraTrace(trace, !!synchronous && hasStack), this._reject(reason, hasStack ? void 0 : trace) }, Promise.prototype._resolveFromResolver = function (resolver) { var promise = this; this._captureStackTrace(), this._pushContext(); var synchronous = !0, r = tryCatch(resolver)(function (value) { null !== promise && (promise._resolveCallback(value), promise = null) }, function (reason) { null !== promise && (promise._rejectCallback(reason, synchronous), promise = null) }); synchronous = !1, this._popContext(), void 0 !== r && r === errorObj && null !== promise && (promise._rejectCallback(r.e, !0, !0), promise = null) }, Promise.prototype._settlePromiseFromHandler = function (handler, receiver, value, promise) { if (!promise._isRejected()) { promise._pushContext(); var x; if (x = receiver !== APPLY || this._isRejected() ? tryCatch(handler).call(receiver, value) : tryCatch(handler).apply(this._boundValue(), value), promise._popContext(), x === errorObj || x === promise || x === NEXT_FILTER) { var err = x === promise ? makeSelfResolutionError() : x.e; promise._rejectCallback(err, !1, !0) } else promise._resolveCallback(x) } }, Promise.prototype._target = function () { for (var ret = this; ret._isFollowing();)ret = ret._followee(); return ret }, Promise.prototype._followee = function () { return this._rejectionHandler0 }, Promise.prototype._setFollowee = function (promise) { this._rejectionHandler0 = promise }, Promise.prototype._cleanValues = function () { this._cancellable() && (this._cancellationParent = void 0) }, Promise.prototype._propagateFrom = function (parent, flags) { (1 & flags) > 0 && parent._cancellable() && (this._setCancellable(), this._cancellationParent = parent), (4 & flags) > 0 && parent._isBound() && this._setBoundTo(parent._boundTo) }, Promise.prototype._fulfill = function (value) { this._isFollowingOrFulfilledOrRejected() || this._fulfillUnchecked(value) }, Promise.prototype._reject = function (reason, carriedStackTrace) { this._isFollowingOrFulfilledOrRejected() || this._rejectUnchecked(reason, carriedStackTrace) }, Promise.prototype._settlePromiseAt = function (index) { var promise = this._promiseAt(index), isPromise = promise instanceof Promise; if (isPromise && promise._isMigrated()) return promise._unsetIsMigrated(), async.invoke(this._settlePromiseAt, this, index); var handler = this._isFulfilled() ? this._fulfillmentHandlerAt(index) : this._rejectionHandlerAt(index), carriedStackTrace = this._isCarryingStackTrace() ? this._getCarriedStackTrace() : void 0, value = this._settledValue, receiver = this._receiverAt(index); this._clearCallbackDataAtIndex(index), "function" == typeof handler ? isPromise ? this._settlePromiseFromHandler(handler, receiver, value, promise) : handler.call(receiver, value, promise) : receiver instanceof PromiseArray ? receiver._isResolved() || (this._isFulfilled() ? receiver._promiseFulfilled(value, promise) : receiver._promiseRejected(value, promise)) : isPromise && (this._isFulfilled() ? promise._fulfill(value) : promise._reject(value, carriedStackTrace)), index >= 4 && 4 === (31 & index) && async.invokeLater(this._setLength, this, 0) }, Promise.prototype._clearCallbackDataAtIndex = function (index) { if (0 === index) this._isCarryingStackTrace() || (this._fulfillmentHandler0 = void 0), this._rejectionHandler0 = this._progressHandler0 = this._receiver0 = this._promise0 = void 0; else { var base = 5 * index - 5; this[base + 3] = this[base + 4] = this[base + 0] = this[base + 1] = this[base + 2] = void 0 } }, Promise.prototype._isSettlePromisesQueued = function () { return (this._bitField & -1073741824) === -1073741824 }, Promise.prototype._setSettlePromisesQueued = function () { this._bitField = this._bitField | -1073741824 }, Promise.prototype._unsetSettlePromisesQueued = function () { this._bitField = 1073741823 & this._bitField }, Promise.prototype._queueSettlePromises = function () { async.settlePromises(this), this._setSettlePromisesQueued() }, Promise.prototype._fulfillUnchecked = function (value) { if (value === this) { var err = makeSelfResolutionError(); return this._attachExtraTrace(err), this._rejectUnchecked(err, void 0) } this._setFulfilled(), this._settledValue = value, this._cleanValues(), this._length() > 0 && this._queueSettlePromises() }, Promise.prototype._rejectUncheckedCheckError = function (reason) { var trace = util.ensureErrorObject(reason); this._rejectUnchecked(reason, trace === reason ? void 0 : trace) }, Promise.prototype._rejectUnchecked = function (reason, trace) { if (reason === this) { var err = makeSelfResolutionError(); return this._attachExtraTrace(err), this._rejectUnchecked(err) } return this._setRejected(), this._settledValue = reason, this._cleanValues(), this._isFinal() ? void async.throwLater(function (e) { throw "stack" in e && async.invokeFirst(CapturedTrace.unhandledRejection, void 0, e), e }, void 0 === trace ? reason : trace) : (void 0 !== trace && trace !== reason && this._setCarriedStackTrace(trace), void (this._length() > 0 ? this._queueSettlePromises() : this._ensurePossibleRejectionHandled())) }, Promise.prototype._settlePromises = function () { this._unsetSettlePromisesQueued(); for (var len = this._length(), i = 0; i < len; i++)this._settlePromiseAt(i) }, util.notEnumerableProp(Promise, "_makeSelfResolutionError", makeSelfResolutionError), _dereq_("./progress.js")(Promise, PromiseArray), _dereq_("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), _dereq_("./bind.js")(Promise, INTERNAL, tryConvertToPromise), _dereq_("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise), _dereq_("./direct_resolve.js")(Promise), _dereq_("./synchronous_inspection.js")(Promise), _dereq_("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL), Promise.version = "2.11.0", Promise.Promise = Promise, _dereq_("./map.js")(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL), _dereq_("./cancel.js")(Promise), _dereq_("./using.js")(Promise, apiRejection, tryConvertToPromise, createContext), _dereq_("./generators.js")(Promise, apiRejection, INTERNAL, tryConvertToPromise), _dereq_("./nodeify.js")(Promise), _dereq_("./call_get.js")(Promise), _dereq_("./props.js")(Promise, PromiseArray, tryConvertToPromise, apiRejection), _dereq_("./race.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection), _dereq_("./reduce.js")(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL), _dereq_("./settle.js")(Promise, PromiseArray), _dereq_("./some.js")(Promise, PromiseArray, apiRejection), _dereq_("./promisify.js")(Promise, INTERNAL), _dereq_("./any.js")(Promise), _dereq_("./each.js")(Promise, INTERNAL), _dereq_("./timers.js")(Promise, INTERNAL), _dereq_("./filter.js")(Promise, INTERNAL), util.toFastProperties(Promise), util.toFastProperties(Promise.prototype), fillTypes({ a: 1 }), fillTypes({ b: 2 }), fillTypes({ c: 3 }), fillTypes(1), fillTypes(function () { }), fillTypes(void 0), fillTypes(!1), fillTypes(new Promise(INTERNAL)), CapturedTrace.setBounds(async.firstLineError, util.lastLineError), Promise } }, { "./any.js": 1, "./async.js": 2, "./bind.js": 3, "./call_get.js": 5, "./cancel.js": 6, "./captured_trace.js": 7, "./catch_filter.js": 8, "./context.js": 9, "./debuggability.js": 10, "./direct_resolve.js": 11, "./each.js": 12, "./errors.js": 13, "./filter.js": 15, "./finally.js": 16, "./generators.js": 17, "./join.js": 18, "./map.js": 19, "./method.js": 20, "./nodeify.js": 21, "./progress.js": 22, "./promise_array.js": 24, "./promise_resolver.js": 25, "./promisify.js": 26, "./props.js": 27, "./race.js": 29, "./reduce.js": 30, "./settle.js": 32, "./some.js": 33, "./synchronous_inspection.js": 34, "./thenables.js": 35, "./timers.js": 36, "./using.js": 37, "./util.js": 38 }], 24: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { function toResolutionValue(val) { switch (val) { case -2: return []; case -3: return {} } } function PromiseArray(values) { var parent, promise = this._promise = new Promise(INTERNAL); values instanceof Promise && (parent = values, promise._propagateFrom(parent, 5)), this._values = values, this._length = 0, this._totalResolved = 0, this._init(void 0, -2) } var util = _dereq_("./util.js"), isArray = util.isArray; return PromiseArray.prototype.length = function () { return this._length }, PromiseArray.prototype.promise = function () { return this._promise }, PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { var values = tryConvertToPromise(this._values, this._promise); if (values instanceof Promise) { if (values = values._target(), this._values = values, !values._isFulfilled()) return values._isPending() ? void values._then(init, this._reject, void 0, this, resolveValueIfEmpty) : void this._reject(values._reason()); if (values = values._value(), !isArray(values)) { var err = new Promise.TypeError("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n"); return void this.__hardReject__(err) } } else if (!isArray(values)) return void this._promise._reject(apiRejection("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n")._reason()); if (0 === values.length) return void (resolveValueIfEmpty === -5 ? this._resolveEmptyArray() : this._resolve(toResolutionValue(resolveValueIfEmpty))); var len = this.getActualLength(values.length); this._length = len, this._values = this.shouldCopyValues() ? new Array(len) : this._values; for (var promise = this._promise, i = 0; i < len; ++i) { var isResolved = this._isResolved(), maybePromise = tryConvertToPromise(values[i], promise); maybePromise instanceof Promise ? (maybePromise = maybePromise._target(), isResolved ? maybePromise._ignoreRejections() : maybePromise._isPending() ? maybePromise._proxyPromiseArray(this, i) : maybePromise._isFulfilled() ? this._promiseFulfilled(maybePromise._value(), i) : this._promiseRejected(maybePromise._reason(), i)) : isResolved || this._promiseFulfilled(maybePromise, i) } }, PromiseArray.prototype._isResolved = function () { return null === this._values }, PromiseArray.prototype._resolve = function (value) { this._values = null, this._promise._fulfill(value) }, PromiseArray.prototype.__hardReject__ = PromiseArray.prototype._reject = function (reason) { this._values = null, this._promise._rejectCallback(reason, !1, !0) }, PromiseArray.prototype._promiseProgressed = function (progressValue, index) { this._promise._progress({ index: index, value: progressValue }) }, PromiseArray.prototype._promiseFulfilled = function (value, index) { this._values[index] = value; var totalResolved = ++this._totalResolved; totalResolved >= this._length && this._resolve(this._values) }, PromiseArray.prototype._promiseRejected = function (reason, index) { this._totalResolved++ , this._reject(reason) }, PromiseArray.prototype.shouldCopyValues = function () { return !0 }, PromiseArray.prototype.getActualLength = function (len) { return len }, PromiseArray } }, { "./util.js": 38 }], 25: [function (_dereq_, module, exports) { "use strict"; function isUntypedError(obj) { return obj instanceof Error && es5.getPrototypeOf(obj) === Error.prototype } function wrapAsOperationalError(obj) { var ret; if (isUntypedError(obj)) { ret = new OperationalError(obj), ret.name = obj.name, ret.message = obj.message, ret.stack = obj.stack; for (var keys = es5.keys(obj), i = 0; i < keys.length; ++i) { var key = keys[i]; rErrorKey.test(key) || (ret[key] = obj[key]) } return ret } return util.markAsOriginatingFromRejection(obj), obj } function nodebackForPromise(promise) { return function (err, value) { if (null !== promise) { if (err) { var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); promise._attachExtraTrace(wrapped), promise._reject(wrapped) } else if (arguments.length > 2) { for (var $_len = arguments.length, args = new Array($_len - 1), $_i = 1; $_i < $_len; ++$_i)args[$_i - 1] = arguments[$_i]; promise._fulfill(args) } else promise._fulfill(value); promise = null } } } var PromiseResolver, util = _dereq_("./util.js"), maybeWrapAsError = util.maybeWrapAsError, errors = _dereq_("./errors.js"), TimeoutError = errors.TimeoutError, OperationalError = errors.OperationalError, haveGetters = util.haveGetters, es5 = _dereq_("./es5.js"), rErrorKey = /^(?:name|message|stack|cause)$/; if (PromiseResolver = haveGetters ? function (promise) { this.promise = promise } : function (promise) { this.promise = promise, this.asCallback = nodebackForPromise(promise), this.callback = this.asCallback }, haveGetters) { var prop = { get: function () { return nodebackForPromise(this.promise) } }; es5.defineProperty(PromiseResolver.prototype, "asCallback", prop), es5.defineProperty(PromiseResolver.prototype, "callback", prop) } PromiseResolver._nodebackForPromise = nodebackForPromise, PromiseResolver.prototype.toString = function () { return "[object PromiseResolver]" }, PromiseResolver.prototype.resolve = PromiseResolver.prototype.fulfill = function (value) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._resolveCallback(value) }, PromiseResolver.prototype.reject = function (reason) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._rejectCallback(reason) }, PromiseResolver.prototype.progress = function (value) { if (!(this instanceof PromiseResolver)) throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n"); this.promise._progress(value) }, PromiseResolver.prototype.cancel = function (err) { this.promise.cancel(err) }, PromiseResolver.prototype.timeout = function () { this.reject(new TimeoutError("timeout")) }, PromiseResolver.prototype.isResolved = function () { return this.promise.isResolved() }, PromiseResolver.prototype.toJSON = function () { return this.promise.toJSON() }, module.exports = PromiseResolver }, { "./errors.js": 13, "./es5.js": 14, "./util.js": 38 }], 26: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function propsFilter(key) { return !noCopyPropsPattern.test(key) } function isPromisified(fn) { try { return fn.__isPromisified__ === !0 } catch (e) { return !1 } } function hasPromisified(obj, key, suffix) { var val = util.getDataPropertyOrDefault(obj, key + suffix, defaultPromisified); return !!val && isPromisified(val) } function checkValid(ret, suffix, suffixRegexp) { for (var i = 0; i < ret.length; i += 2) { var key = ret[i]; if (suffixRegexp.test(key)) for (var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""), j = 0; j < ret.length; j += 2)if (ret[j] === keyWithoutAsyncSuffix) throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/iWrZbw\n".replace("%s", suffix)) } } function promisifiableMethods(obj, suffix, suffixRegexp, filter) { for (var keys = util.inheritedDataKeys(obj), ret = [], i = 0; i < keys.length; ++i) { var key = keys[i], value = obj[key], passesDefaultFilter = filter === defaultFilter || defaultFilter(key, value, obj); "function" != typeof value || isPromisified(value) || hasPromisified(obj, key, suffix) || !filter(key, value, obj, passesDefaultFilter) || ret.push(key, value) } return checkValid(ret, suffix, suffixRegexp), ret } function makeNodePromisifiedClosure(callback, receiver, _, fn) { function promisified() { var _receiver = receiver; receiver === THIS && (_receiver = this); var promise = new Promise(INTERNAL); promise._captureStackTrace(); var cb = "string" == typeof method && this !== defaultThis ? this[method] : callback, fn = nodebackForPromise(promise); try { cb.apply(_receiver, withAppended(arguments, fn)) } catch (e) { promise._rejectCallback(maybeWrapAsError(e), !0, !0) } return promise } var defaultThis = function () { return this }(), method = callback; return "string" == typeof method && (callback = fn), util.notEnumerableProp(promisified, "__isPromisified__", !0), promisified } function promisifyAll(obj, suffix, filter, promisifier) { for (var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"), methods = promisifiableMethods(obj, suffix, suffixRegexp, filter), i = 0, len = methods.length; i < len; i += 2) { var key = methods[i], fn = methods[i + 1], promisifiedKey = key + suffix; if (promisifier === makeNodePromisified) obj[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix); else { var promisified = promisifier(fn, function () { return makeNodePromisified(key, THIS, key, fn, suffix) }); util.notEnumerableProp(promisified, "__isPromisified__", !0), obj[promisifiedKey] = promisified } } return util.toFastProperties(obj), obj } function promisify(callback, receiver) { return makeNodePromisified(callback, receiver, void 0, callback) } var makeNodePromisifiedEval, THIS = {}, util = _dereq_("./util.js"), nodebackForPromise = _dereq_("./promise_resolver.js")._nodebackForPromise, withAppended = util.withAppended, maybeWrapAsError = util.maybeWrapAsError, canEvaluate = util.canEvaluate, TypeError = _dereq_("./errors").TypeError, defaultSuffix = "Async", defaultPromisified = { __isPromisified__: !0 }, noCopyProps = ["arity", "length", "name", "arguments", "caller", "callee", "prototype", "__isPromisified__"], noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"), defaultFilter = function (name) { return util.isIdentifier(name) && "_" !== name.charAt(0) && "constructor" !== name }, escapeIdentRegex = function (str) { return str.replace(/([$])/, "\\$") }, makeNodePromisified = canEvaluate ? makeNodePromisifiedEval : makeNodePromisifiedClosure; Promise.promisify = function (fn, receiver) { if ("function" != typeof fn) throw new TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n"); if (isPromisified(fn)) return fn; var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); return util.copyDescriptors(fn, ret, propsFilter), ret }, Promise.promisifyAll = function (target, options) { if ("function" != typeof target && "object" != typeof target) throw new TypeError("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/9ITlV0\n"); options = Object(options); var suffix = options.suffix; "string" != typeof suffix && (suffix = defaultSuffix); var filter = options.filter; "function" != typeof filter && (filter = defaultFilter); var promisifier = options.promisifier; if ("function" != typeof promisifier && (promisifier = makeNodePromisified), !util.isIdentifier(suffix)) throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/8FZo5V\n"); for (var keys = util.inheritedDataKeys(target), i = 0; i < keys.length; ++i) { var value = target[keys[i]]; "constructor" !== keys[i] && util.isClass(value) && (promisifyAll(value.prototype, suffix, filter, promisifier), promisifyAll(value, suffix, filter, promisifier)) } return promisifyAll(target, suffix, filter, promisifier) } } }, { "./errors": 13, "./promise_resolver.js": 25, "./util.js": 38 }], 27: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, tryConvertToPromise, apiRejection) { function PropertiesPromiseArray(obj) { for (var keys = es5.keys(obj), len = keys.length, values = new Array(2 * len), i = 0; i < len; ++i) { var key = keys[i]; values[i] = obj[key], values[i + len] = key } this.constructor$(values) } function props(promises) { var ret, castValue = tryConvertToPromise(promises); return isObject(castValue) ? (ret = castValue instanceof Promise ? castValue._then(Promise.props, void 0, void 0, void 0, void 0) : new PropertiesPromiseArray(castValue).promise(), castValue instanceof Promise && ret._propagateFrom(castValue, 4), ret) : apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/OsFKC8\n") } var util = _dereq_("./util.js"), isObject = util.isObject, es5 = _dereq_("./es5.js"); util.inherits(PropertiesPromiseArray, PromiseArray), PropertiesPromiseArray.prototype._init = function () { this._init$(void 0, -3) }, PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { this._values[index] = value; var totalResolved = ++this._totalResolved; if (totalResolved >= this._length) { for (var val = {}, keyOffset = this.length(), i = 0, len = this.length(); i < len; ++i)val[this._values[i + keyOffset]] = this._values[i]; this._resolve(val) } }, PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { this._promise._progress({ key: this._values[index + this.length()], value: value }) }, PropertiesPromiseArray.prototype.shouldCopyValues = function () { return !1 }, PropertiesPromiseArray.prototype.getActualLength = function (len) { return len >> 1 }, Promise.prototype.props = function () { return props(this) }, Promise.props = function (promises) { return props(promises) } } }, { "./es5.js": 14, "./util.js": 38 }], 28: [function (_dereq_, module, exports) { "use strict"; function arrayMove(src, srcIndex, dst, dstIndex, len) { for (var j = 0; j < len; ++j)dst[j + dstIndex] = src[j + srcIndex], src[j + srcIndex] = void 0 } function Queue(capacity) { this._capacity = capacity, this._length = 0, this._front = 0 } Queue.prototype._willBeOverCapacity = function (size) { return this._capacity < size }, Queue.prototype._pushOne = function (arg) { var length = this.length(); this._checkCapacity(length + 1); var i = this._front + length & this._capacity - 1; this[i] = arg, this._length = length + 1 }, Queue.prototype._unshiftOne = function (value) { var capacity = this._capacity; this._checkCapacity(this.length() + 1); var front = this._front, i = (front - 1 & capacity - 1 ^ capacity) - capacity; this[i] = value, this._front = i, this._length = this.length() + 1 }, Queue.prototype.unshift = function (fn, receiver, arg) { this._unshiftOne(arg), this._unshiftOne(receiver), this._unshiftOne(fn) }, Queue.prototype.push = function (fn, receiver, arg) { var length = this.length() + 3; if (this._willBeOverCapacity(length)) return this._pushOne(fn), this._pushOne(receiver), void this._pushOne(arg); var j = this._front + length - 3; this._checkCapacity(length); var wrapMask = this._capacity - 1; this[j + 0 & wrapMask] = fn, this[j + 1 & wrapMask] = receiver, this[j + 2 & wrapMask] = arg, this._length = length }, Queue.prototype.shift = function () { var front = this._front, ret = this[front]; return this[front] = void 0, this._front = front + 1 & this._capacity - 1, this._length-- , ret }, Queue.prototype.length = function () { return this._length }, Queue.prototype._checkCapacity = function (size) { this._capacity < size && this._resizeTo(this._capacity << 1) }, Queue.prototype._resizeTo = function (capacity) { var oldCapacity = this._capacity; this._capacity = capacity; var front = this._front, length = this._length, moveItemsCount = front + length & oldCapacity - 1; arrayMove(this, 0, this, oldCapacity, moveItemsCount) }, module.exports = Queue }, {}], 29: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL, tryConvertToPromise, apiRejection) { function race(promises, parent) { var maybePromise = tryConvertToPromise(promises); if (maybePromise instanceof Promise) return raceLater(maybePromise); if (!isArray(promises)) return apiRejection("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n"); var ret = new Promise(INTERNAL); void 0 !== parent && ret._propagateFrom(parent, 5); for (var fulfill = ret._fulfill, reject = ret._reject, i = 0, len = promises.length; i < len; ++i) { var val = promises[i]; (void 0 !== val || i in promises) && Promise.cast(val)._then(fulfill, reject, void 0, ret, null) } return ret } var isArray = _dereq_("./util.js").isArray, raceLater = function (promise) { return promise.then(function (array) { return race(array, promise) }) }; Promise.race = function (promises) { return race(promises, void 0) }, Promise.prototype.race = function () { return race(this, void 0) } } }, { "./util.js": 38 }], 30: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL) { function ReductionPromiseArray(promises, fn, accum, _each) { this.constructor$(promises), this._promise._captureStackTrace(), this._preservedValues = _each === INTERNAL ? [] : null, this._zerothIsAccum = void 0 === accum, this._gotAccum = !1, this._reducingIndex = this._zerothIsAccum ? 1 : 0, this._valuesPhase = void 0; var maybePromise = tryConvertToPromise(accum, this._promise), rejected = !1, isPromise = maybePromise instanceof Promise; isPromise && (maybePromise = maybePromise._target(), maybePromise._isPending() ? maybePromise._proxyPromiseArray(this, -1) : maybePromise._isFulfilled() ? (accum = maybePromise._value(), this._gotAccum = !0) : (this._reject(maybePromise._reason()), rejected = !0)), isPromise || this._zerothIsAccum || (this._gotAccum = !0); var domain = getDomain(); this._callback = null === domain ? fn : domain.bind(fn), this._accum = accum, rejected || async.invoke(init, this, void 0) } function init() { this._init$(void 0, -5) } function reduce(promises, fn, initialValue, _each) { if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var array = new ReductionPromiseArray(promises, fn, initialValue, _each); return array.promise() } var getDomain = Promise._getDomain, async = _dereq_("./async.js"), util = _dereq_("./util.js"), tryCatch = util.tryCatch, errorObj = util.errorObj; util.inherits(ReductionPromiseArray, PromiseArray), ReductionPromiseArray.prototype._init = function () { }, ReductionPromiseArray.prototype._resolveEmptyArray = function () { (this._gotAccum || this._zerothIsAccum) && this._resolve(null !== this._preservedValues ? [] : this._accum) }, ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { var values = this._values; values[index] = value; var valuesPhaseIndex, length = this.length(), preservedValues = this._preservedValues, isEach = null !== preservedValues, gotAccum = this._gotAccum, valuesPhase = this._valuesPhase; if (!valuesPhase) for (valuesPhase = this._valuesPhase = new Array(length), valuesPhaseIndex = 0; valuesPhaseIndex < length; ++valuesPhaseIndex)valuesPhase[valuesPhaseIndex] = 0; if (valuesPhaseIndex = valuesPhase[index], 0 === index && this._zerothIsAccum ? (this._accum = value, this._gotAccum = gotAccum = !0, valuesPhase[index] = 0 === valuesPhaseIndex ? 1 : 2) : index === -1 ? (this._accum = value, this._gotAccum = gotAccum = !0) : 0 === valuesPhaseIndex ? valuesPhase[index] = 1 : (valuesPhase[index] = 2, this._accum = value), gotAccum) { for (var ret, callback = this._callback, receiver = this._promise._boundValue(), i = this._reducingIndex; i < length; ++i)if (valuesPhaseIndex = valuesPhase[i], 2 !== valuesPhaseIndex) { if (1 !== valuesPhaseIndex) return; if (value = values[i], this._promise._pushContext(), isEach ? (preservedValues.push(value), ret = tryCatch(callback).call(receiver, value, i, length)) : ret = tryCatch(callback).call(receiver, this._accum, value, i, length), this._promise._popContext(), ret === errorObj) return this._reject(ret.e); var maybePromise = tryConvertToPromise(ret, this._promise); if (maybePromise instanceof Promise) { if (maybePromise = maybePromise._target(), maybePromise._isPending()) return valuesPhase[i] = 4, maybePromise._proxyPromiseArray(this, i); if (!maybePromise._isFulfilled()) return this._reject(maybePromise._reason()); ret = maybePromise._value() } this._reducingIndex = i + 1, this._accum = ret } else this._reducingIndex = i + 1; this._resolve(isEach ? preservedValues : this._accum) } }, Promise.prototype.reduce = function (fn, initialValue) { return reduce(this, fn, initialValue, null) }, Promise.reduce = function (promises, fn, initialValue, _each) { return reduce(promises, fn, initialValue, _each) } } }, { "./async.js": 2, "./util.js": 38 }], 31: [function (_dereq_, module, exports) { "use strict"; var schedule, util = _dereq_("./util"), noAsyncScheduler = function () { throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n") }; if (util.isNode && "undefined" == typeof MutationObserver) { var GlobalSetImmediate = global.setImmediate, ProcessNextTick = process.nextTick; schedule = util.isRecentNode ? function (fn) { GlobalSetImmediate.call(global, fn) } : function (fn) { ProcessNextTick.call(process, fn) } } else "undefined" == typeof MutationObserver || "undefined" != typeof window && window.navigator && window.navigator.standalone ? schedule = "undefined" != typeof setImmediate ? function (fn) { setImmediate(fn) } : "undefined" != typeof setTimeout ? function (fn) { setTimeout(fn, 0) } : noAsyncScheduler : (schedule = function (fn) { var div = document.createElement("div"), observer = new MutationObserver(fn); return observer.observe(div, { attributes: !0 }), function () { div.classList.toggle("foo") } }, schedule.isStatic = !0); module.exports = schedule }, { "./util": 38 }], 32: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray) { function SettledPromiseArray(values) { this.constructor$(values) } var PromiseInspection = Promise.PromiseInspection, util = _dereq_("./util.js"); util.inherits(SettledPromiseArray, PromiseArray), SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { this._values[index] = inspection; var totalResolved = ++this._totalResolved; totalResolved >= this._length && this._resolve(this._values) }, SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { var ret = new PromiseInspection; ret._bitField = 268435456, ret._settledValue = value, this._promiseResolved(index, ret) }, SettledPromiseArray.prototype._promiseRejected = function (reason, index) { var ret = new PromiseInspection; ret._bitField = 134217728, ret._settledValue = reason, this._promiseResolved(index, ret) }, Promise.settle = function (promises) { return new SettledPromiseArray(promises).promise() }, Promise.prototype.settle = function () { return new SettledPromiseArray(this).promise() } } }, { "./util.js": 38 }], 33: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, PromiseArray, apiRejection) { function SomePromiseArray(values) { this.constructor$(values), this._howMany = 0, this._unwrap = !1, this._initialized = !1 } function some(promises, howMany) { if ((0 | howMany) !== howMany || howMany < 0) return apiRejection("expecting a positive integer\n\n See http://goo.gl/1wAmHx\n"); var ret = new SomePromiseArray(promises), promise = ret.promise(); return ret.setHowMany(howMany), ret.init(), promise } var util = _dereq_("./util.js"), RangeError = _dereq_("./errors.js").RangeError, AggregateError = _dereq_("./errors.js").AggregateError, isArray = util.isArray; util.inherits(SomePromiseArray, PromiseArray), SomePromiseArray.prototype._init = function () { if (this._initialized) { if (0 === this._howMany) return void this._resolve([]); this._init$(void 0, -5); var isArrayResolved = isArray(this._values); !this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill() && this._reject(this._getRangeError(this.length())) } }, SomePromiseArray.prototype.init = function () { this._initialized = !0, this._init() }, SomePromiseArray.prototype.setUnwrap = function () { this._unwrap = !0 }, SomePromiseArray.prototype.howMany = function () { return this._howMany }, SomePromiseArray.prototype.setHowMany = function (count) { this._howMany = count }, SomePromiseArray.prototype._promiseFulfilled = function (value) { this._addFulfilled(value), this._fulfilled() === this.howMany() && (this._values.length = this.howMany(), 1 === this.howMany() && this._unwrap ? this._resolve(this._values[0]) : this._resolve(this._values)) }, SomePromiseArray.prototype._promiseRejected = function (reason) { if (this._addRejected(reason), this.howMany() > this._canPossiblyFulfill()) { for (var e = new AggregateError, i = this.length(); i < this._values.length; ++i)e.push(this._values[i]); this._reject(e) } }, SomePromiseArray.prototype._fulfilled = function () { return this._totalResolved }, SomePromiseArray.prototype._rejected = function () { return this._values.length - this.length() }, SomePromiseArray.prototype._addRejected = function (reason) { this._values.push(reason) }, SomePromiseArray.prototype._addFulfilled = function (value) { this._values[this._totalResolved++] = value }, SomePromiseArray.prototype._canPossiblyFulfill = function () { return this.length() - this._rejected() }, SomePromiseArray.prototype._getRangeError = function (count) { var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items"; return new RangeError(message) }, SomePromiseArray.prototype._resolveEmptyArray = function () { this._reject(this._getRangeError(0)) }, Promise.some = function (promises, howMany) { return some(promises, howMany) }, Promise.prototype.some = function (howMany) { return some(this, howMany) }, Promise._SomePromiseArray = SomePromiseArray } }, { "./errors.js": 13, "./util.js": 38 }], 34: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise) { function PromiseInspection(promise) { void 0 !== promise ? (promise = promise._target(), this._bitField = promise._bitField, this._settledValue = promise._settledValue) : (this._bitField = 0, this._settledValue = void 0) } PromiseInspection.prototype.value = function () { if (!this.isFulfilled()) throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n"); return this._settledValue }, PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function () { if (!this.isRejected()) throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n"); return this._settledValue }, PromiseInspection.prototype.isFulfilled = Promise.prototype._isFulfilled = function () { return (268435456 & this._bitField) > 0 }, PromiseInspection.prototype.isRejected = Promise.prototype._isRejected = function () { return (134217728 & this._bitField) > 0 }, PromiseInspection.prototype.isPending = Promise.prototype._isPending = function () { return 0 === (402653184 & this._bitField) }, PromiseInspection.prototype.isResolved = Promise.prototype._isResolved = function () { return (402653184 & this._bitField) > 0 }, Promise.prototype.isPending = function () { return this._target()._isPending() }, Promise.prototype.isRejected = function () { return this._target()._isRejected() }, Promise.prototype.isFulfilled = function () { return this._target()._isFulfilled() }, Promise.prototype.isResolved = function () { return this._target()._isResolved() }, Promise.prototype._value = function () { return this._settledValue }, Promise.prototype._reason = function () { return this._unsetRejectionIsUnhandled(), this._settledValue }, Promise.prototype.value = function () { var target = this._target(); if (!target.isFulfilled()) throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n"); return target._settledValue }, Promise.prototype.reason = function () { var target = this._target(); if (!target.isRejected()) throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n"); return target._unsetRejectionIsUnhandled(), target._settledValue }, Promise.PromiseInspection = PromiseInspection } }, {}], 35: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function tryConvertToPromise(obj, context) { if (isObject(obj)) { if (obj instanceof Promise) return obj; if (isAnyBluebirdPromise(obj)) { var ret = new Promise(INTERNAL); return obj._then(ret._fulfillUnchecked, ret._rejectUncheckedCheckError, ret._progressUnchecked, ret, null), ret } var then = util.tryCatch(getThen)(obj); if (then === errorObj) { context && context._pushContext(); var ret = Promise.reject(then.e); return context && context._popContext(), ret } if ("function" == typeof then) return doThenable(obj, then, context) } return obj } function getThen(obj) { return obj.then } function isAnyBluebirdPromise(obj) { return hasProp.call(obj, "_promise0") } function doThenable(x, then, context) { function resolveFromThenable(value) { promise && (promise._resolveCallback(value), promise = null) } function rejectFromThenable(reason) { promise && (promise._rejectCallback(reason, synchronous, !0), promise = null) } function progressFromThenable(value) { promise && "function" == typeof promise._progress && promise._progress(value) } var promise = new Promise(INTERNAL), ret = promise; context && context._pushContext(), promise._captureStackTrace(), context && context._popContext(); var synchronous = !0, result = util.tryCatch(then).call(x, resolveFromThenable, rejectFromThenable, progressFromThenable); return synchronous = !1, promise && result === errorObj && (promise._rejectCallback(result.e, !0, !0), promise = null), ret } var util = _dereq_("./util.js"), errorObj = util.errorObj, isObject = util.isObject, hasProp = {}.hasOwnProperty; return tryConvertToPromise } }, { "./util.js": 38 }], 36: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, INTERNAL) { function successClear(value) { var handle = this; return handle instanceof Number && (handle = +handle), clearTimeout(handle), value } function failureClear(reason) { var handle = this; throw handle instanceof Number && (handle = +handle), clearTimeout(handle), reason } var util = _dereq_("./util.js"), TimeoutError = Promise.TimeoutError, afterTimeout = function (promise, message) { if (promise.isPending()) { var err; !util.isPrimitive(message) && message instanceof Error ? err = message : ("string" != typeof message && (message = "operation timed out"), err = new TimeoutError(message)), util.markAsOriginatingFromRejection(err), promise._attachExtraTrace(err), promise._cancel(err) } }, afterValue = function (value) { return delay(+this).thenReturn(value) }, delay = Promise.delay = function (value, ms) { if (void 0 === ms) { ms = value, value = void 0; var ret = new Promise(INTERNAL); return setTimeout(function () { ret._fulfill() }, ms), ret } return ms = +ms, Promise.resolve(value)._then(afterValue, null, null, ms, void 0) }; Promise.prototype.delay = function (ms) { return delay(this, ms) }, Promise.prototype.timeout = function (ms, message) { ms = +ms; var ret = this.then().cancellable(); ret._cancellationParent = this; var handle = setTimeout(function () { afterTimeout(ret, message) }, ms); return ret._then(successClear, failureClear, void 0, handle, void 0) } } }, { "./util.js": 38 }], 37: [function (_dereq_, module, exports) { "use strict"; module.exports = function (Promise, apiRejection, tryConvertToPromise, createContext) { function inspectionMapper(inspections) { for (var len = inspections.length, i = 0; i < len; ++i) { var inspection = inspections[i]; if (inspection.isRejected()) return Promise.reject(inspection.error()); inspections[i] = inspection._settledValue } return inspections } function thrower(e) { setTimeout(function () { throw e }, 0) } function castPreservingDisposable(thenable) { var maybePromise = tryConvertToPromise(thenable); return maybePromise !== thenable && "function" == typeof thenable._isDisposable && "function" == typeof thenable._getDisposer && thenable._isDisposable() && maybePromise._setDisposable(thenable._getDisposer()), maybePromise } function dispose(resources, inspection) { function iterator() { if (i >= len) return ret.resolve(); var maybePromise = castPreservingDisposable(resources[i++]); if (maybePromise instanceof Promise && maybePromise._isDisposable()) { try { maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise) } catch (e) { return thrower(e) } if (maybePromise instanceof Promise) return maybePromise._then(iterator, thrower, null, null, null) } iterator() } var i = 0, len = resources.length, ret = Promise.defer(); return iterator(), ret.promise } function disposerSuccess(value) { var inspection = new PromiseInspection; return inspection._settledValue = value, inspection._bitField = 268435456, dispose(this, inspection).thenReturn(value) } function disposerFail(reason) { var inspection = new PromiseInspection; return inspection._settledValue = reason, inspection._bitField = 134217728, dispose(this, inspection).thenThrow(reason) } function Disposer(data, promise, context) { this._data = data, this._promise = promise, this._context = context } function FunctionDisposer(fn, promise, context) { this.constructor$(fn, promise, context) } function maybeUnwrapDisposer(value) { return Disposer.isDisposer(value) ? (this.resources[this.index]._setDisposable(value), value.promise()) : value } var TypeError = _dereq_("./errors.js").TypeError, inherits = _dereq_("./util.js").inherits, PromiseInspection = Promise.PromiseInspection; Disposer.prototype.data = function () { return this._data }, Disposer.prototype.promise = function () { return this._promise }, Disposer.prototype.resource = function () { return this.promise().isFulfilled() ? this.promise().value() : null }, Disposer.prototype.tryDispose = function (inspection) { var resource = this.resource(), context = this._context; void 0 !== context && context._pushContext(); var ret = null !== resource ? this.doDispose(resource, inspection) : null; return void 0 !== context && context._popContext(), this._promise._unsetDisposable(), this._data = null, ret }, Disposer.isDisposer = function (d) { return null != d && "function" == typeof d.resource && "function" == typeof d.tryDispose }, inherits(FunctionDisposer, Disposer), FunctionDisposer.prototype.doDispose = function (resource, inspection) { var fn = this.data(); return fn.call(resource, resource, inspection) }, Promise.using = function () { var len = arguments.length; if (len < 2) return apiRejection("you must pass at least 2 arguments to Promise.using"); var fn = arguments[len - 1]; if ("function" != typeof fn) return apiRejection("fn must be a function\n\n See http://goo.gl/916lJJ\n"); var input, spreadArgs = !0; 2 === len && Array.isArray(arguments[0]) ? (input = arguments[0], len = input.length, spreadArgs = !1) : (input = arguments, len--); for (var resources = new Array(len), i = 0; i < len; ++i) { var resource = input[i]; if (Disposer.isDisposer(resource)) { var disposer = resource; resource = resource.promise(), resource._setDisposable(disposer) } else { var maybePromise = tryConvertToPromise(resource); maybePromise instanceof Promise && (resource = maybePromise._then(maybeUnwrapDisposer, null, null, { resources: resources, index: i }, void 0)) } resources[i] = resource } var promise = Promise.settle(resources).then(inspectionMapper).then(function (vals) { promise._pushContext(); var ret; try { ret = spreadArgs ? fn.apply(void 0, vals) : fn.call(void 0, vals) } finally { promise._popContext() } return ret })._then(disposerSuccess, disposerFail, void 0, resources, void 0); return resources.promise = promise, promise }, Promise.prototype._setDisposable = function (disposer) { this._bitField = 262144 | this._bitField, this._disposer = disposer }, Promise.prototype._isDisposable = function () { return (262144 & this._bitField) > 0 }, Promise.prototype._getDisposer = function () { return this._disposer }, Promise.prototype._unsetDisposable = function () { this._bitField = this._bitField & -262145, this._disposer = void 0 }, Promise.prototype.disposer = function (fn) { if ("function" == typeof fn) return new FunctionDisposer(fn, this, createContext()); throw new TypeError } } }, { "./errors.js": 13, "./util.js": 38 }], 38: [function (_dereq_, module, exports) { "use strict"; function tryCatcher() { try { var target = tryCatchTarget; return tryCatchTarget = null, target.apply(this, arguments) } catch (e) { return errorObj.e = e, errorObj } } function tryCatch(fn) { return tryCatchTarget = fn, tryCatcher } function isPrimitive(val) { return null == val || val === !0 || val === !1 || "string" == typeof val || "number" == typeof val } function isObject(value) { return !isPrimitive(value) } function maybeWrapAsError(maybeError) { return isPrimitive(maybeError) ? new Error(safeToString(maybeError)) : maybeError } function withAppended(target, appendee) { var i, len = target.length, ret = new Array(len + 1); for (i = 0; i < len; ++i)ret[i] = target[i]; return ret[i] = appendee, ret } function getDataPropertyOrDefault(obj, key, defaultValue) { if (!es5.isES5) return {}.hasOwnProperty.call(obj, key) ? obj[key] : void 0; var desc = Object.getOwnPropertyDescriptor(obj, key); return null != desc ? null == desc.get && null == desc.set ? desc.value : defaultValue : void 0 } function notEnumerableProp(obj, name, value) { if (isPrimitive(obj)) return obj; var descriptor = { value: value, configurable: !0, enumerable: !1, writable: !0 }; return es5.defineProperty(obj, name, descriptor), obj } function thrower(r) { throw r } function isClass(fn) { try { if ("function" == typeof fn) { var keys = es5.names(fn.prototype), hasMethods = es5.isES5 && keys.length > 1, hasMethodsOtherThanConstructor = keys.length > 0 && !(1 === keys.length && "constructor" === keys[0]), hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) return !0 } return !1 } catch (e) { return !1 } } function toFastProperties(obj) { function f() { } f.prototype = obj; for (var l = 8; l--;)new f; return obj } function isIdentifier(str) { return rident.test(str) } function filledRange(count, prefix, suffix) { for (var ret = new Array(count), i = 0; i < count; ++i)ret[i] = prefix + i + suffix; return ret } function safeToString(obj) { try { return obj + "" } catch (e) { return "[no string representation]" } } function markAsOriginatingFromRejection(e) { try { notEnumerableProp(e, "isOperational", !0) } catch (ignore) { } } function originatesFromRejection(e) { return null != e && (e instanceof Error.__BluebirdErrorTypes__.OperationalError || e.isOperational === !0) } function canAttachTrace(obj) { return obj instanceof Error && es5.propertyIsWritable(obj, "stack") } function classString(obj) { return {}.toString.call(obj) } function copyDescriptors(from, to, filter) { for (var keys = es5.names(from), i = 0; i < keys.length; ++i) { var key = keys[i]; if (filter(key)) try { es5.defineProperty(to, key, es5.getDescriptor(from, key)) } catch (ignore) { } } } var es5 = _dereq_("./es5.js"), canEvaluate = "undefined" == typeof navigator, haveGetters = function () { try { var o = {}; return es5.defineProperty(o, "f", { get: function () { return 3 } }), 3 === o.f } catch (e) { return !1 } }(), errorObj = { e: {} }, tryCatchTarget, inherits = function (Child, Parent) { function T() { this.constructor = Child, this.constructor$ = Parent; for (var propertyName in Parent.prototype) hasProp.call(Parent.prototype, propertyName) && "$" !== propertyName.charAt(propertyName.length - 1) && (this[propertyName + "$"] = Parent.prototype[propertyName]) } var hasProp = {}.hasOwnProperty; return T.prototype = Parent.prototype, Child.prototype = new T, Child.prototype }, inheritedDataKeys = function () { var excludedPrototypes = [Array.prototype, Object.prototype, Function.prototype], isExcludedProto = function (val) { for (var i = 0; i < excludedPrototypes.length; ++i)if (excludedPrototypes[i] === val) return !0; return !1 }; if (es5.isES5) { var getKeys = Object.getOwnPropertyNames; return function (obj) { for (var ret = [], visitedKeys = Object.create(null); null != obj && !isExcludedProto(obj);) { var keys; try { keys = getKeys(obj) } catch (e) { return ret } for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!visitedKeys[key]) { visitedKeys[key] = !0; var desc = Object.getOwnPropertyDescriptor(obj, key); null != desc && null == desc.get && null == desc.set && ret.push(key) } } obj = es5.getPrototypeOf(obj) } return ret } } var hasProp = {}.hasOwnProperty; return function (obj) { if (isExcludedProto(obj)) return []; var ret = []; enumeration: for (var key in obj) if (hasProp.call(obj, key)) ret.push(key); else { for (var i = 0; i < excludedPrototypes.length; ++i)if (hasProp.call(excludedPrototypes[i], key)) continue enumeration; ret.push(key) } return ret } }(), thisAssignmentPattern = /this\s*\.\s*\S+\s*=/, rident = /^[a-z$_][a-z$_0-9]*$/i, ensureErrorObject = function () { return "stack" in new Error ? function (value) { return canAttachTrace(value) ? value : new Error(safeToString(value)) } : function (value) { if (canAttachTrace(value)) return value; try { throw new Error(safeToString(value)) } catch (err) { return err } } }(), ret = { isClass: isClass, isIdentifier: isIdentifier, inheritedDataKeys: inheritedDataKeys, getDataPropertyOrDefault: getDataPropertyOrDefault, thrower: thrower, isArray: es5.isArray, haveGetters: haveGetters, notEnumerableProp: notEnumerableProp, isPrimitive: isPrimitive, isObject: isObject, canEvaluate: canEvaluate, errorObj: errorObj, tryCatch: tryCatch, inherits: inherits, withAppended: withAppended, maybeWrapAsError: maybeWrapAsError, toFastProperties: toFastProperties, filledRange: filledRange, toString: safeToString, canAttachTrace: canAttachTrace, ensureErrorObject: ensureErrorObject, originatesFromRejection: originatesFromRejection, markAsOriginatingFromRejection: markAsOriginatingFromRejection, classString: classString, copyDescriptors: copyDescriptors, hasDevTools: "undefined" != typeof chrome && chrome && "function" == typeof chrome.loadTimes, isNode: "undefined" != typeof process && "[object process]" === classString(process).toLowerCase() }; ret.isRecentNode = ret.isNode && function () { var version = process.versions.node.split(".").map(Number); return 0 === version[0] && version[1] > 10 || version[0] > 0 }(), ret.isNode && ret.toFastProperties(process); try { throw new Error } catch (e) { ret.lastLineError = e } module.exports = ret }, { "./es5.js": 14 }]}, { }, [4]) (4)}), "undefined" != typeof window && null !== window ? window.P = window.Promise : "undefined" != typeof self && null !== self && (self.P = self.Promise)}).call(exports, __webpack_require__(30), function () { return this }(), __webpack_require__(31).setImmediate)}, function(module, exports) { "use strict"; function SimpleDecorator(strategy, getComponent) { this.decorated = {}, this.strategy = strategy, this.getComponent = getComponent } function decorateRange(decorationsArray, start, end, key) { for (var ii = start; ii < end; ii++)decorationsArray[ii] = key } var KEY_SEPARATOR = "-"; SimpleDecorator.prototype.getDecorations = function (block) { function callback(start, end, props) { void 0 === props && (props = {}), key = blockKey + KEY_SEPARATOR + decorationId, decorated[blockKey][decorationId] = props, decorateRange(decorations, start, end, key), decorationId++ } var key, decorations = Array(block.getText().length).fill(null), blockKey = block.getKey(), decorationId = 0, decorated = this.decorated; return decorated[blockKey] = {}, this.strategy(block, callback), Immutable.List(decorations) }, SimpleDecorator.prototype.getComponentForKey = function (key) { return this.getComponent }, SimpleDecorator.prototype.getPropsForKey = function (key) { var parts = key.split(KEY_SEPARATOR), blockKey = parts[0], decorationId = parts[1]; return this.decorated[blockKey][decorationId] }, module.exports = SimpleDecorator }, function(module, exports, __webpack_require__) { function deepEqual(actual, expected, options) { var opts = options || {}; return !(opts.strict ? !is(actual, expected) : actual !== expected) || (!actual || !expected || "object" != typeof actual && "object" != typeof expected ? opts.strict ? is(actual, expected) : actual == expected : objEquiv(actual, expected, opts)) } function isUndefinedOrNull(value) { return null === value || void 0 === value } function isBuffer(x) { return !(!x || "object" != typeof x || "number" != typeof x.length) && ("function" == typeof x.copy && "function" == typeof x.slice && !(x.length > 0 && "number" != typeof x[0])) } function objEquiv(a, b, opts) { var i, key; if (typeof a != typeof b) return !1; if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) return !1; if (a.prototype !== b.prototype) return !1; if (isArguments(a) !== isArguments(b)) return !1; var aIsRegex = isRegex(a), bIsRegex = isRegex(b); if (aIsRegex !== bIsRegex) return !1; if (aIsRegex || bIsRegex) return a.source === b.source && flags(a) === flags(b); if (isDate(a) && isDate(b)) return getTime.call(a) === getTime.call(b); var aIsBuffer = isBuffer(a), bIsBuffer = isBuffer(b); if (aIsBuffer !== bIsBuffer) return !1; if (aIsBuffer || bIsBuffer) { if (a.length !== b.length) return !1; for (i = 0; i < a.length; i++)if (a[i] !== b[i]) return !1; return !0 } if (typeof a != typeof b) return !1; try { var ka = objectKeys(a), kb = objectKeys(b) } catch (e) { return !1 } if (ka.length !== kb.length) return !1; for (ka.sort(), kb.sort(), i = ka.length - 1; i >= 0; i--)if (ka[i] != kb[i]) return !1; for (i = ka.length - 1; i >= 0; i--)if (key = ka[i], !deepEqual(a[key], b[key], opts)) return !1; return !0 } var objectKeys = __webpack_require__(41), isArguments = __webpack_require__(44), is = __webpack_require__(59), isRegex = __webpack_require__(64), flags = __webpack_require__(65), isDate = __webpack_require__(71), getTime = Date.prototype.getTime; module.exports = deepEqual }, function(module, exports, __webpack_require__) { "use strict"; var slice = Array.prototype.slice, isArgs = __webpack_require__(42), origKeys = Object.keys, keysShim = origKeys ? function (o) { return origKeys(o) } : __webpack_require__(43), originalKeys = Object.keys; keysShim.shim = function () { if (Object.keys) { var keysWorksWithArguments = function () { var args = Object.keys(arguments); return args && args.length === arguments.length }(1, 2); keysWorksWithArguments || (Object.keys = function (object) { return originalKeys(isArgs(object) ? slice.call(object) : object) }) } else Object.keys = keysShim; return Object.keys || keysShim }, module.exports = keysShim }, function(module, exports) { "use strict"; var toStr = Object.prototype.toString; module.exports = function (value) { var str = toStr.call(value), isArgs = "[object Arguments]" === str; return isArgs || (isArgs = "[object Array]" !== str && null !== value && "object" == typeof value && "number" == typeof value.length && value.length >= 0 && "[object Function]" === toStr.call(value.callee)), isArgs } }, function(module, exports, __webpack_require__) { "use strict"; var keysShim; if (!Object.keys) { var has = Object.prototype.hasOwnProperty, toStr = Object.prototype.toString, isArgs = __webpack_require__(42), isEnumerable = Object.prototype.propertyIsEnumerable, hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString"), hasProtoEnumBug = isEnumerable.call(function () { }, "prototype"), dontEnums = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"], equalsConstructorPrototype = function (o) { var ctor = o.constructor; return ctor && ctor.prototype === o }, excludedKeys = { $applicationCache: !0, $console: !0, $external: !0, $frame: !0, $frameElement: !0, $frames: !0, $innerHeight: !0, $innerWidth: !0, $onmozfullscreenchange: !0, $onmozfullscreenerror: !0, $outerHeight: !0, $outerWidth: !0, $pageXOffset: !0, $pageYOffset: !0, $parent: !0, $scrollLeft: !0, $scrollTop: !0, $scrollX: !0, $scrollY: !0, $self: !0, $webkitIndexedDB: !0, $webkitStorageInfo: !0, $window: !0 }, hasAutomationEqualityBug = function () { if ("undefined" == typeof window) return !1; for (var k in window) try { if (!excludedKeys["$" + k] && has.call(window, k) && null !== window[k] && "object" == typeof window[k]) try { equalsConstructorPrototype(window[k]) } catch (e) { return !0 } } catch (e) { return !0 } return !1 }(), equalsConstructorPrototypeIfNotBuggy = function (o) { if ("undefined" == typeof window || !hasAutomationEqualityBug) return equalsConstructorPrototype(o); try { return equalsConstructorPrototype(o) } catch (e) { return !1 } }; keysShim = function (object) { var isObject = null !== object && "object" == typeof object, isFunction = "[object Function]" === toStr.call(object), isArguments = isArgs(object), isString = isObject && "[object String]" === toStr.call(object), theKeys = []; if (!isObject && !isFunction && !isArguments) throw new TypeError("Object.keys called on a non-object"); var skipProto = hasProtoEnumBug && isFunction; if (isString && object.length > 0 && !has.call(object, 0)) for (var i = 0; i < object.length; ++i)theKeys.push(String(i)); if (isArguments && object.length > 0) for (var j = 0; j < object.length; ++j)theKeys.push(String(j)); else for (var name in object) skipProto && "prototype" === name || !has.call(object, name) || theKeys.push(String(name)); if (hasDontEnumBug) for (var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object), k = 0; k < dontEnums.length; ++k)skipConstructor && "constructor" === dontEnums[k] || !has.call(object, dontEnums[k]) || theKeys.push(dontEnums[k]); return theKeys } } module.exports = keysShim }, function(module, exports, __webpack_require__) { "use strict"; var hasToStringTag = __webpack_require__(45)(), callBound = __webpack_require__(47), $toString = callBound("Object.prototype.toString"), isStandardArguments = function (value) { return !(hasToStringTag && value && "object" == typeof value && Symbol.toStringTag in value) && "[object Arguments]" === $toString(value) }, isLegacyArguments = function (value) { return !!isStandardArguments(value) || null !== value && "object" == typeof value && "number" == typeof value.length && value.length >= 0 && "[object Array]" !== $toString(value) && "[object Function]" === $toString(value.callee) }, supportsStandardArguments = function () { return isStandardArguments(arguments) }(); isStandardArguments.isLegacyArguments = isLegacyArguments, module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments }, function(module, exports, __webpack_require__) { "use strict"; var hasSymbols = __webpack_require__(46); module.exports = function () { return hasSymbols() && !!Symbol.toStringTag } }, function(module, exports) { "use strict"; module.exports = function () { if ("function" != typeof Symbol || "function" != typeof Object.getOwnPropertySymbols) return !1; if ("symbol" == typeof Symbol.iterator) return !0; var obj = {}, sym = Symbol("test"), symObj = Object(sym); if ("string" == typeof sym) return !1; if ("[object Symbol]" !== Object.prototype.toString.call(sym)) return !1; if ("[object Symbol]" !== Object.prototype.toString.call(symObj)) return !1; var symVal = 42; obj[sym] = symVal; for (sym in obj) return !1; if ("function" == typeof Object.keys && 0 !== Object.keys(obj).length) return !1; if ("function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(obj).length) return !1; var syms = Object.getOwnPropertySymbols(obj); if (1 !== syms.length || syms[0] !== sym) return !1; if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) return !1; if ("function" == typeof Object.getOwnPropertyDescriptor) { var descriptor = Object.getOwnPropertyDescriptor(obj, sym); if (descriptor.value !== symVal || descriptor.enumerable !== !0) return !1 } return !0 } }, function(module, exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(48), callBind = __webpack_require__(54), $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); module.exports = function (name, allowMissing) { var intrinsic = GetIntrinsic(name, !!allowMissing); return "function" == typeof intrinsic && $indexOf(name, ".prototype.") > -1 ? callBind(intrinsic) : intrinsic } }, function(module, exports, __webpack_require__) { "use strict"; var undefined, $SyntaxError = SyntaxError, $Function = Function, $TypeError = TypeError, getEvalledConstructor = function (expressionSyntax) { try { return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")() } catch (e) { } }, $gOPD = Object.getOwnPropertyDescriptor; if ($gOPD) try { $gOPD({}, "") } catch (e) { $gOPD = null } var throwTypeError = function () { throw new $TypeError }, ThrowTypeError = $gOPD ? function () { try { return arguments.callee, throwTypeError } catch (calleeThrows) { try { return $gOPD(arguments, "callee").get } catch (gOPDthrows) { return throwTypeError } } }() : throwTypeError, hasSymbols = __webpack_require__(49)(), hasProto = __webpack_require__(50)(), getProto = Object.getPrototypeOf || (hasProto ? function (x) { return x.__proto__ } : null), needsEval = {}, TypedArray = "undefined" != typeof Uint8Array && getProto ? getProto(Uint8Array) : undefined, INTRINSICS = { "%AggregateError%": "undefined" == typeof AggregateError ? undefined : AggregateError, "%Array%": Array, "%ArrayBuffer%": "undefined" == typeof ArrayBuffer ? undefined : ArrayBuffer, "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, "%AsyncFromSyncIteratorPrototype%": undefined, "%AsyncFunction%": needsEval, "%AsyncGenerator%": needsEval, "%AsyncGeneratorFunction%": needsEval, "%AsyncIteratorPrototype%": needsEval, "%Atomics%": "undefined" == typeof Atomics ? undefined : Atomics, "%BigInt%": "undefined" == typeof BigInt ? undefined : BigInt, "%BigInt64Array%": "undefined" == typeof BigInt64Array ? undefined : BigInt64Array, "%BigUint64Array%": "undefined" == typeof BigUint64Array ? undefined : BigUint64Array, "%Boolean%": Boolean, "%DataView%": "undefined" == typeof DataView ? undefined : DataView, "%Date%": Date, "%decodeURI%": decodeURI, "%decodeURIComponent%": decodeURIComponent, "%encodeURI%": encodeURI, "%encodeURIComponent%": encodeURIComponent, "%Error%": Error, "%eval%": eval, "%EvalError%": EvalError, "%Float32Array%": "undefined" == typeof Float32Array ? undefined : Float32Array, "%Float64Array%": "undefined" == typeof Float64Array ? undefined : Float64Array, "%FinalizationRegistry%": "undefined" == typeof FinalizationRegistry ? undefined : FinalizationRegistry, "%Function%": $Function, "%GeneratorFunction%": needsEval, "%Int8Array%": "undefined" == typeof Int8Array ? undefined : Int8Array, "%Int16Array%": "undefined" == typeof Int16Array ? undefined : Int16Array, "%Int32Array%": "undefined" == typeof Int32Array ? undefined : Int32Array, "%isFinite%": isFinite, "%isNaN%": isNaN, "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, "%JSON%": "object" == typeof JSON ? JSON : undefined, "%Map%": "undefined" == typeof Map ? undefined : Map, "%MapIteratorPrototype%": "undefined" != typeof Map && hasSymbols && getProto ? getProto((new Map)[Symbol.iterator]()) : undefined, "%Math%": Math, "%Number%": Number, "%Object%": Object, "%parseFloat%": parseFloat, "%parseInt%": parseInt, "%Promise%": "undefined" == typeof Promise ? undefined : Promise, "%Proxy%": "undefined" == typeof Proxy ? undefined : Proxy, "%RangeError%": RangeError, "%ReferenceError%": ReferenceError, "%Reflect%": "undefined" == typeof Reflect ? undefined : Reflect, "%RegExp%": RegExp, "%Set%": "undefined" == typeof Set ? undefined : Set, "%SetIteratorPrototype%": "undefined" != typeof Set && hasSymbols && getProto ? getProto((new Set)[Symbol.iterator]()) : undefined, "%SharedArrayBuffer%": "undefined" == typeof SharedArrayBuffer ? undefined : SharedArrayBuffer, "%String%": String, "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined, "%Symbol%": hasSymbols ? Symbol : undefined, "%SyntaxError%": $SyntaxError, "%ThrowTypeError%": ThrowTypeError, "%TypedArray%": TypedArray, "%TypeError%": $TypeError, "%Uint8Array%": "undefined" == typeof Uint8Array ? undefined : Uint8Array, "%Uint8ClampedArray%": "undefined" == typeof Uint8ClampedArray ? undefined : Uint8ClampedArray, "%Uint16Array%": "undefined" == typeof Uint16Array ? undefined : Uint16Array, "%Uint32Array%": "undefined" == typeof Uint32Array ? undefined : Uint32Array, "%URIError%": URIError, "%WeakMap%": "undefined" == typeof WeakMap ? undefined : WeakMap, "%WeakRef%": "undefined" == typeof WeakRef ? undefined : WeakRef, "%WeakSet%": "undefined" == typeof WeakSet ? undefined : WeakSet }; if (getProto) try { null.error } catch (e) { var errorProto = getProto(getProto(e)); INTRINSICS["%Error.prototype%"] = errorProto } var doEval = function doEval(name) { var value; if ("%AsyncFunction%" === name) value = getEvalledConstructor("async function () {}"); else if ("%GeneratorFunction%" === name) value = getEvalledConstructor("function* () {}"); else if ("%AsyncGeneratorFunction%" === name) value = getEvalledConstructor("async function* () {}"); else if ("%AsyncGenerator%" === name) { var fn = doEval("%AsyncGeneratorFunction%"); fn && (value = fn.prototype) } else if ("%AsyncIteratorPrototype%" === name) { var gen = doEval("%AsyncGenerator%"); gen && getProto && (value = getProto(gen.prototype)) } return INTRINSICS[name] = value, value }, LEGACY_ALIASES = { "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }, bind = __webpack_require__(51), hasOwn = __webpack_require__(53), $concat = bind.call(Function.call, Array.prototype.concat), $spliceApply = bind.call(Function.apply, Array.prototype.splice), $replace = bind.call(Function.call, String.prototype.replace), $strSlice = bind.call(Function.call, String.prototype.slice), $exec = bind.call(Function.call, RegExp.prototype.exec), rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, reEscapeChar = /\\(\\)?/g, stringToPath = function (string) { var first = $strSlice(string, 0, 1), last = $strSlice(string, -1); if ("%" === first && "%" !== last) throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); if ("%" === last && "%" !== first) throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); var result = []; return $replace(string, rePropName, function (match, number, quote, subString) { result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match }), result }, getBaseIntrinsic = function (name, allowMissing) { var alias, intrinsicName = name; if (hasOwn(LEGACY_ALIASES, intrinsicName) && (alias = LEGACY_ALIASES[intrinsicName], intrinsicName = "%" + alias[0] + "%"), hasOwn(INTRINSICS, intrinsicName)) { var value = INTRINSICS[intrinsicName]; if (value === needsEval && (value = doEval(intrinsicName)), "undefined" == typeof value && !allowMissing) throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); return { alias: alias, name: intrinsicName, value: value } } throw new $SyntaxError("intrinsic " + name + " does not exist!") }; module.exports = function (name, allowMissing) { if ("string" != typeof name || 0 === name.length) throw new $TypeError("intrinsic name must be a non-empty string"); if (arguments.length > 1 && "boolean" != typeof allowMissing) throw new $TypeError('"allowMissing" argument must be a boolean'); if (null === $exec(/^%?[^%]*%?$/, name)) throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); var parts = stringToPath(name), intrinsicBaseName = parts.length > 0 ? parts[0] : "", intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing), intrinsicRealName = intrinsic.name, value = intrinsic.value, skipFurtherCaching = !1, alias = intrinsic.alias; alias && (intrinsicBaseName = alias[0], $spliceApply(parts, $concat([0, 1], alias))); for (var i = 1, isOwn = !0; i < parts.length; i += 1) { var part = parts[i], first = $strSlice(part, 0, 1), last = $strSlice(part, -1); if (('"' === first || "'" === first || "`" === first || '"' === last || "'" === last || "`" === last) && first !== last) throw new $SyntaxError("property names with quotes must have matching quotes"); if ("constructor" !== part && isOwn || (skipFurtherCaching = !0), intrinsicBaseName += "." + part, intrinsicRealName = "%" + intrinsicBaseName + "%", hasOwn(INTRINSICS, intrinsicRealName)) value = INTRINSICS[intrinsicRealName]; else if (null != value) { if (!(part in value)) { if (!allowMissing) throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); return void undefined } if ($gOPD && i + 1 >= parts.length) { var desc = $gOPD(value, part); isOwn = !!desc, value = isOwn && "get" in desc && !("originalValue" in desc.get) ? desc.get : value[part] } else isOwn = hasOwn(value, part), value = value[part]; isOwn && !skipFurtherCaching && (INTRINSICS[intrinsicRealName] = value) } } return value } }, function(module, exports, __webpack_require__) { "use strict"; var origSymbol = "undefined" != typeof Symbol && Symbol, hasSymbolSham = __webpack_require__(46); module.exports = function () { return "function" == typeof origSymbol && ("function" == typeof Symbol && ("symbol" == typeof origSymbol("foo") && ("symbol" == typeof Symbol("bar") && hasSymbolSham()))) } }, function(module, exports) { "use strict"; var test = { foo: {} }, $Object = Object; module.exports = function () { return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object) } }, function(module, exports, __webpack_require__) { "use strict"; var implementation = __webpack_require__(52); module.exports = Function.prototype.bind || implementation }, function(module, exports) { "use strict"; var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ", toStr = Object.prototype.toString, max = Math.max, funcType = "[object Function]", concatty = function (a, b) { for (var arr = [], i = 0; i < a.length; i += 1)arr[i] = a[i]; for (var j = 0; j < b.length; j += 1)arr[j + a.length] = b[j]; return arr }, slicy = function (arrLike, offset) { for (var arr = [], i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1)arr[j] = arrLike[i]; return arr }, joiny = function (arr, joiner) { for (var str = "", i = 0; i < arr.length; i += 1)str += arr[i], i + 1 < arr.length && (str += joiner); return str }; module.exports = function (that) { var target = this; if ("function" != typeof target || toStr.apply(target) !== funcType) throw new TypeError(ERROR_MESSAGE + target); for (var bound, args = slicy(arguments, 1), binder = function () { if (this instanceof bound) { var result = target.apply(this, concatty(args, arguments)); return Object(result) === result ? result : this } return target.apply(that, concatty(args, arguments)) }, boundLength = max(0, target.length - args.length), boundArgs = [], i = 0; i < boundLength; i++)boundArgs[i] = "$" + i; if (bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder), target.prototype) { var Empty = function () { }; Empty.prototype = target.prototype, bound.prototype = new Empty, Empty.prototype = null } return bound } }, function(module, exports, __webpack_require__) { "use strict"; var call = Function.prototype.call, $hasOwn = Object.prototype.hasOwnProperty, bind = __webpack_require__(51); module.exports = bind.call(call, $hasOwn) }, function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(51), GetIntrinsic = __webpack_require__(48), setFunctionLength = __webpack_require__(55), $TypeError = GetIntrinsic("%TypeError%"), $apply = GetIntrinsic("%Function.prototype.apply%"), $call = GetIntrinsic("%Function.prototype.call%"), $reflectApply = GetIntrinsic("%Reflect.apply%", !0) || bind.call($call, $apply), $defineProperty = GetIntrinsic("%Object.defineProperty%", !0), $max = GetIntrinsic("%Math.max%"); if ($defineProperty) try { $defineProperty({}, "a", { value: 1 }) } catch (e) { $defineProperty = null } module.exports = function (originalFunction) { if ("function" != typeof originalFunction) throw new $TypeError("a function is required"); var func = $reflectApply(bind, $call, arguments); return setFunctionLength(func, 1 + $max(0, originalFunction.length - (arguments.length - 1)), !0) }; var applyBind = function () { return $reflectApply(bind, $apply, arguments) }; $defineProperty ? $defineProperty(module.exports, "apply", { value: applyBind }) : module.exports.apply = applyBind }, function(module, exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(48), define = __webpack_require__(56), hasDescriptors = __webpack_require__(57)(), gOPD = __webpack_require__(58), $TypeError = GetIntrinsic("%TypeError%"), $floor = GetIntrinsic("%Math.floor%"); module.exports = function (fn, length) { if ("function" != typeof fn) throw new $TypeError("`fn` is not a function"); if ("number" != typeof length || length < 0 || length > 4294967295 || $floor(length) !== length) throw new $TypeError("`length` must be a positive 32-bit integer"); var loose = arguments.length > 2 && !!arguments[2], functionLengthIsConfigurable = !0, functionLengthIsWritable = !0; if ("length" in fn && gOPD) { var desc = gOPD(fn, "length"); desc && !desc.configurable && (functionLengthIsConfigurable = !1), desc && !desc.writable && (functionLengthIsWritable = !1) } return (functionLengthIsConfigurable || functionLengthIsWritable || !loose) && (hasDescriptors ? define(fn, "length", length, !0, !0) : define(fn, "length", length)), fn } }, function(module, exports, __webpack_require__) { "use strict"; var hasPropertyDescriptors = __webpack_require__(57)(), GetIntrinsic = __webpack_require__(48), $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", !0); if ($defineProperty) try { $defineProperty({}, "a", { value: 1 }) } catch (e) { $defineProperty = !1 } var $SyntaxError = GetIntrinsic("%SyntaxError%"), $TypeError = GetIntrinsic("%TypeError%"), gopd = __webpack_require__(58); module.exports = function (obj, property, value) { if (!obj || "object" != typeof obj && "function" != typeof obj) throw new $TypeError("`obj` must be an object or a function`"); if ("string" != typeof property && "symbol" != typeof property) throw new $TypeError("`property` must be a string or a symbol`"); if (arguments.length > 3 && "boolean" != typeof arguments[3] && null !== arguments[3]) throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null"); if (arguments.length > 4 && "boolean" != typeof arguments[4] && null !== arguments[4]) throw new $TypeError("`nonWritable`, if provided, must be a boolean or null"); if (arguments.length > 5 && "boolean" != typeof arguments[5] && null !== arguments[5]) throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null"); if (arguments.length > 6 && "boolean" != typeof arguments[6]) throw new $TypeError("`loose`, if provided, must be a boolean"); var nonEnumerable = arguments.length > 3 ? arguments[3] : null, nonWritable = arguments.length > 4 ? arguments[4] : null, nonConfigurable = arguments.length > 5 ? arguments[5] : null, loose = arguments.length > 6 && arguments[6], desc = !!gopd && gopd(obj, property); if ($defineProperty) $defineProperty(obj, property, { configurable: null === nonConfigurable && desc ? desc.configurable : !nonConfigurable, enumerable: null === nonEnumerable && desc ? desc.enumerable : !nonEnumerable, value: value, writable: null === nonWritable && desc ? desc.writable : !nonWritable }); else { if (!loose && (nonEnumerable || nonWritable || nonConfigurable)) throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable."); obj[property] = value } } }, function(module, exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(48), $defineProperty = GetIntrinsic("%Object.defineProperty%", !0), hasPropertyDescriptors = function () { if ($defineProperty) try { return $defineProperty({}, "a", { value: 1 }), !0 } catch (e) { return !1 } return !1 }; hasPropertyDescriptors.hasArrayLengthDefineBug = function () { if (!hasPropertyDescriptors()) return null; try { return 1 !== $defineProperty([], "length", { value: 1 }).length } catch (e) { return !0 } }, module.exports = hasPropertyDescriptors }, function(module, exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(48), $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", !0); if ($gOPD) try { $gOPD([], "length") } catch (e) { $gOPD = null } module.exports = $gOPD }, function(module, exports, __webpack_require__) { "use strict"; var define = __webpack_require__(60), callBind = __webpack_require__(54), implementation = __webpack_require__(61), getPolyfill = __webpack_require__(62), shim = __webpack_require__(63), polyfill = callBind(getPolyfill(), Object); define(polyfill, { getPolyfill: getPolyfill, implementation: implementation, shim: shim }), module.exports = polyfill }, function(module, exports, __webpack_require__) { "use strict"; var keys = __webpack_require__(41), hasSymbols = "function" == typeof Symbol && "symbol" == typeof Symbol("foo"), toStr = Object.prototype.toString, concat = Array.prototype.concat, defineDataProperty = __webpack_require__(56), isFunction = function (fn) { return "function" == typeof fn && "[object Function]" === toStr.call(fn) }, supportsDescriptors = __webpack_require__(57)(), defineProperty = function (object, name, value, predicate) { if (name in object) if (predicate === !0) { if (object[name] === value) return } else if (!isFunction(predicate) || !predicate()) return; supportsDescriptors ? defineDataProperty(object, name, value, !0) : defineDataProperty(object, name, value) }, defineProperties = function (object, map) { var predicates = arguments.length > 2 ? arguments[2] : {}, props = keys(map); hasSymbols && (props = concat.call(props, Object.getOwnPropertySymbols(map))); for (var i = 0; i < props.length; i += 1)defineProperty(object, props[i], map[props[i]], predicates[props[i]]) }; defineProperties.supportsDescriptors = !!supportsDescriptors, module.exports = defineProperties }, function(module, exports) { "use strict"; var numberIsNaN = function (value) { return value !== value }; module.exports = function (a, b) { return 0 === a && 0 === b ? 1 / a === 1 / b : a === b || !(!numberIsNaN(a) || !numberIsNaN(b)) } }, function(module, exports, __webpack_require__) { "use strict"; var implementation = __webpack_require__(61); module.exports = function () { return "function" == typeof Object.is ? Object.is : implementation } }, function(module, exports, __webpack_require__) { "use strict"; var getPolyfill = __webpack_require__(62), define = __webpack_require__(60); module.exports = function () { var polyfill = getPolyfill(); return define(Object, { is: polyfill }, { is: function () { return Object.is !== polyfill } }), polyfill } }, function(module, exports, __webpack_require__) { "use strict"; var has, $exec, isRegexMarker, badStringifier, callBound = __webpack_require__(47), hasToStringTag = __webpack_require__(45)(); if (hasToStringTag) { has = callBound("Object.prototype.hasOwnProperty"), $exec = callBound("RegExp.prototype.exec"), isRegexMarker = {}; var throwRegexMarker = function () { throw isRegexMarker }; badStringifier = { toString: throwRegexMarker, valueOf: throwRegexMarker }, "symbol" == typeof Symbol.toPrimitive && (badStringifier[Symbol.toPrimitive] = throwRegexMarker) } var $toString = callBound("Object.prototype.toString"), gOPD = Object.getOwnPropertyDescriptor, regexClass = "[object RegExp]"; module.exports = hasToStringTag ? function (value) { if (!value || "object" != typeof value) return !1; var descriptor = gOPD(value, "lastIndex"), hasLastIndexDataProperty = descriptor && has(descriptor, "value"); if (!hasLastIndexDataProperty) return !1; try { $exec(value, badStringifier) } catch (e) { return e === isRegexMarker } } : function (value) { return !(!value || "object" != typeof value && "function" != typeof value) && $toString(value) === regexClass } }, function(module, exports, __webpack_require__) { "use strict"; var define = __webpack_require__(60), callBind = __webpack_require__(54), implementation = __webpack_require__(66), getPolyfill = __webpack_require__(69), shim = __webpack_require__(70), flagsBound = callBind(getPolyfill()); define(flagsBound, { getPolyfill: getPolyfill, implementation: implementation, shim: shim }), module.exports = flagsBound }, function(module, exports, __webpack_require__) { "use strict"; var setFunctionName = __webpack_require__(67), $Object = Object, $TypeError = TypeError; module.exports = setFunctionName(function () { if (null != this && this !== $Object(this)) throw new $TypeError("RegExp.prototype.flags getter called on non-object"); var result = ""; return this.hasIndices && (result += "d"), this.global && (result += "g"), this.ignoreCase && (result += "i"), this.multiline && (result += "m"), this.dotAll && (result += "s"), this.unicode && (result += "u"), this.unicodeSets && (result += "v"), this.sticky && (result += "y"), result }, "get flags", !0) }, function(module, exports, __webpack_require__) { "use strict"; var define = __webpack_require__(56), hasDescriptors = __webpack_require__(57)(), functionsHaveConfigurableNames = __webpack_require__(68).functionsHaveConfigurableNames(), $TypeError = TypeError; module.exports = function (fn, name) { if ("function" != typeof fn) throw new $TypeError("`fn` is not a function"); var loose = arguments.length > 2 && !!arguments[2]; return loose && !functionsHaveConfigurableNames || (hasDescriptors ? define(fn, "name", name, !0, !0) : define(fn, "name", name)), fn } }, function(module, exports) { "use strict"; var functionsHaveNames = function () { return "string" == typeof function () { }.name }, gOPD = Object.getOwnPropertyDescriptor; if (gOPD) try { gOPD([], "length") } catch (e) { gOPD = null } functionsHaveNames.functionsHaveConfigurableNames = function () { if (!functionsHaveNames() || !gOPD) return !1; var desc = gOPD(function () { }, "name"); return !!desc && !!desc.configurable }; var $bind = Function.prototype.bind; functionsHaveNames.boundFunctionsHaveNames = function () { return functionsHaveNames() && "function" == typeof $bind && "" !== function () { }.bind().name }, module.exports = functionsHaveNames }, function(module, exports, __webpack_require__) { "use strict"; var implementation = __webpack_require__(66), supportsDescriptors = __webpack_require__(60).supportsDescriptors, $gOPD = Object.getOwnPropertyDescriptor; module.exports = function () { if (supportsDescriptors && "gim" === /a/gim.flags) { var descriptor = $gOPD(RegExp.prototype, "flags"); if (descriptor && "function" == typeof descriptor.get && "boolean" == typeof RegExp.prototype.dotAll && "boolean" == typeof RegExp.prototype.hasIndices) { var calls = "", o = {}; if (Object.defineProperty(o, "hasIndices", { get: function () { calls += "d" } }), Object.defineProperty(o, "sticky", { get: function () { calls += "y" } }), "dy" === calls) return descriptor.get } } return implementation } }, function(module, exports, __webpack_require__) { "use strict"; var supportsDescriptors = __webpack_require__(60).supportsDescriptors, getPolyfill = __webpack_require__(69), gOPD = Object.getOwnPropertyDescriptor, defineProperty = Object.defineProperty, TypeErr = TypeError, getProto = Object.getPrototypeOf, regex = /a/; module.exports = function () { if (!supportsDescriptors || !getProto) throw new TypeErr("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors"); var polyfill = getPolyfill(), proto = getProto(regex), descriptor = gOPD(proto, "flags"); return descriptor && descriptor.get === polyfill || defineProperty(proto, "flags", { configurable: !0, enumerable: !1, get: polyfill }), polyfill } }, function(module, exports, __webpack_require__) { "use strict"; var getDay = Date.prototype.getDay, tryDateObject = function (value) { try { return getDay.call(value), !0 } catch (e) { return !1 } }, toStr = Object.prototype.toString, dateClass = "[object Date]", hasToStringTag = __webpack_require__(45)(); module.exports = function (value) { return "object" == typeof value && null !== value && (hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass) } }, function(module, exports) { "use strict"; var _ReactBootstrap = ReactBootstrap, Overlay = _ReactBootstrap.Overlay, Popover = (_ReactBootstrap.Button, _ReactBootstrap.Popover), HASHTAG_REGEX = /\#[\w\u0590-\u05ff]+/g, popoverStyle = { position: "absolute", display: "table", backgroundColor: "#f5f5f5", boxShadow: "0 5px 10px rgba(0, 0, 0, 0.2)", borderColor: "#bbb", borderRadius: 6, color: "#333333", padding: 8, width: 359, maxWidth: "inherit" }, errorImageURL = gAppBaseURL + "Content/Images/no-media-irsa-logo.png", HashValuePopover = React.createClass({ displayName: "HashValuePopover", propTypes: { targetId: React.PropTypes.string.isRequired, taggedAsset: React.PropTypes.object.isRequired }, getInitialState: function () { return { url: "" } }, onErrorMediaImage: function () { this.setState({ url: errorImageURL }) }, componentWillMount: function () { var taggedAsset = this.props.taggedAsset; this.setState({ url: taggedAsset.thumbnail }) }, componentWillReceiveProps: function (nextProps) { var taggedAsset = nextProps.taggedAsset; this.setState({ url: taggedAsset.thumbnail }) }, render: function () { var _props = this.props, targetId = _props.targetId, taggedAsset = _props.taggedAsset, offset = $("#" + targetId).offset(); return popoverStyle.top = offset.top - 73, popoverStyle.left = offset.left - 171, popoverStyle.left < 10 && (popoverStyle.left = 10), React.createElement(Popover, { id: "po_" + targetId, placement: "top", className: "hash-value-popover assetID", style: popoverStyle }, React.createElement("div", { className: "mediaIDContainer" }, React.createElement("div", { className: "mediaIDImage" }, React.createElement("img", { src: this.state.url, onError: this.onErrorMediaImage })), React.createElement("div", { className: "mediaIDContent" }, React.createElement("a", { href: "#" }, taggedAsset.assetID), React.createElement("p", null, taggedAsset.description)))) } }), HashValue = React.createClass({ displayName: "HashValue", propTypes: { propsChildren: React.PropTypes.array.isRequired, taggedAsset: React.PropTypes.object.isRequired }, getInitialState: function () { return { show: !1 } }, onMouseOver: function (e) { var _this = this; e.preventDefault(), setTimeout(function () { _this.setState({ show: !0 }) }, 100) }, onMouseLeave: function (e) { var _this2 = this; e.preventDefault(), setTimeout(function () { _this2.setState({ show: !1 }) }, 100) }, onClick: function (e) { var taggedAsset = this.props.taggedAsset; e.preventDefault(); var url = "/Media/Detail?id=" + taggedAsset.assetID + "&EvidenceGroupId=" + taggedAsset.evidenceGroupId; window.open(url) }, render: function () { var _this3 = this, _props2 = this.props, propsChildren = _props2.propsChildren, taggedAsset = _props2.taggedAsset, targetId = IrsaModulesUtil.generateUUID(); return React.createElement("span", { className: "hash-value" }, React.createElement("a", { id: targetId, ref: "target", style: { color: "#006aae", textDecoration: "none", padding: "15px 0px", cursor: "pointer" }, onMouseOver: this.onMouseOver, onMouseLeave: this.onMouseLeave, onClick: this.onClick }, React.createElement("span", null, propsChildren)), React.createElement(Overlay, { show: this.state.show, animation: !1, onHide: function () { return _this3.setState({ show: !1 }) }, target: function () { return ReactDOM.findDOMNode(_this3.refs.target) } }, React.createElement(HashValuePopover, { targetId: targetId, taggedAsset: taggedAsset }))) } }), hashtagHTML = function (props) { var strategyInfo = props.strategyInfo, decoratedText = props.decoratedText, arr = decoratedText.split("#"), ui = React.createElement("span", null, props.children); if (arr.length > 1) { var orderId = arr[1], taggedAsset = strategyInfo.context.find(function (e) { return e.orderIdStr == orderId }); null != taggedAsset && (ui = React.createElement(HashValue, { propsChildren: props.children, taggedAsset: taggedAsset })) } return ui }; module.exports = { rgx: HASHTAG_REGEX, hashtagHTML: hashtagHTML } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } var _objectAssign = __webpack_require__(7), _objectAssign2 = _interopRequireDefault(_objectAssign), _constants = __webpack_require__(22), _commonFunctions = __webpack_require__(74), _AssetImage = __webpack_require__(75), _AssetImage2 = _interopRequireDefault(_AssetImage), _AssetsView = __webpack_require__(76), _AssetsView2 = _interopRequireDefault(_AssetsView), _DownloadAssetModal = __webpack_require__(80), _DownloadAssetModal2 = _interopRequireDefault(_DownloadAssetModal), _minSysSerial = 0, _count = 0, pageSize = 4, _evidenceGroupIdsInBucket = [], AssetData = [], AssetTabSwitched = !1, setUniqueSysSerialsOnAssets = function (data) { var result = data.map(function (m) { return m.sysSerial = --_minSysSerial, (0 == m.TotalSegments || m.TotalSegments == -1 || null == m.TotalSegments || m.TotalSegments > 0 && 0 == m.isMaster) && delete m.OtherAssetsOfGroup, m.OtherAssetsOfGroup && m.OtherAssetsOfGroup.length > 0 && (m.OtherAssetsOfGroup.sort(function (a, b) { return a.assetSysSerial - b.assetSysSerial }), m.OtherAssetsOfGroup = m.OtherAssetsOfGroup.map(function (n) { return n.sysSerial = --_minSysSerial, n })), m }); return result }, SearchAssetslist = function (searchText, page) { _tagAssetModelSelectedTabKey = 1; var data = void 0, result = null; showLoaderOnVP(), null == page && (page = 1); var stationIDToPass = __stationId; if (_isAdmin && (stationIDToPass = 0), 1 == page && 0 == AssetData.length || 1 == AssetTabSwitched) { if (makeAjaxRequest({ type: "GET", url: "/UniversalSearch/SearchData", async: !1, params: { searchTerm: searchText, page: 1, pageSize: 1e4, stationID: stationIDToPass, isTagCaseSearch: !0 }, scope: void 0, onComplete: function (resp) { data = JSON.parse(resp.responseText), data.msg && data.msg.length > 0 && console.error(data.msg), hideLoaderOnVP() } }), AssetTabSwitched = !1, null == data || !data.Root) return []; AssetData = data.Root, AssetData = setUniqueSysSerialsOnAssets(AssetData) } hideLoaderOnVP(); var startindex = 4 * (page - 1), endindex = startindex + 4, NextPageRecords = AssetData.slice(startindex, endindex); return _count = AssetData.length, result = NextPageRecords }, getUserAssetBucketList = function (page) { var data = null, result = null; if (showLoaderOnVP(), null == page && (page = 1), 1 == page && 0 == AssetData.length) { if (makeAjaxRequest({ type: "GET", url: "/Case/GetUserAssetBucketList", async: !1, params: { page: 1, pageSize: 1e4 }, scope: void 0, onComplete: function (resp) { data = JSON.parse(resp.responseText), data.msg && data.msg.length > 0 ? console.error(data.msg) : (_count = data.TotalCount, _evidenceGroupIdsInBucket = data.EvidenceGroupIds), hideLoaderOnVP() }, onError: function (err) { console.log(err.statusText), hideLoaderOnVP() } }), null == data || !data.Root) return []; 0 == AssetData.length && (AssetData = data.Root, AssetData = setUniqueSysSerialsOnAssets(AssetData)) } hideLoaderOnVP(); var startindex = 4 * (page - 1), endindex = startindex + 4, NextPageRecords = AssetData.slice(startindex, endindex); return result = NextPageRecords }, AssetSearchbox = React.createClass({ displayName: "AssetSearchbox", propTypes: { onSearch: React.PropTypes.func.isRequired }, getInitialState: function () { return { value: "" } }, onChange: function (e) { e.preventDefault(), this.setState({ value: e.target.value }) }, onSearch: function (e) { e.preventDefault(); var assetID = this.refs.searchAsset.value, errInfo = checkForValidInputContent(assetID); return errInfo && errInfo.length > 0 ? void showErrorMsg("Invalid value. Please correct.") : void this.props.onSearch(assetID) }, render: function () { var _this = this; return setTimeout(function (e) { _this.refs.searchAsset.focus() }, 100), React.createElement("form", { className: "form-horizontal" }, React.createElement("div", { className: "form-group" }, React.createElement("div", { className: "col-md-8", style: { paddingRight: "0" } }, React.createElement("input", { type: "text", ref: "searchAsset", id: "searchAsset", className: "form-control", placeholder: "Type Asset ID to search...", value: this.state.value, onChange: this.onChange })), React.createElement("div", { className: "col-sm-1", style: { paddingLeft: "5px" } }, React.createElement("button", { className: "btn btn-default", onClick: this.onSearch }, "Search")))) } }), AssetsGrid = React.createClass({ displayName: "AssetsGrid", propTypes: { assetsList: React.PropTypes.arrayOf(_constants.MediaForTaggingShape), count: React.PropTypes.number, onSearch: React.PropTypes.func, searchText: React.PropTypes.string, isBucket: React.PropTypes.bool }, getDefaultProps: function () { return { assetsList: [], count: 0, showDownloadButton: !1 } }, getInitialState: function () { return { allChecked: !1, assetsList: [], count: 0, selectedAssets: [], prevPage: !1, prevAssetsSelected: [], pageChecking: [], currentPage: 1, prevCheckedAll: !1 } }, onSelectAssetAll: function (e) { var chkState = e.target.checked, newState = this.state.assetsList.map(function (m) { var o = (0, _objectAssign2.default)({}, m); return o.checked = chkState, o }), selectedAssets = newState.filter(function (a) { return 1 == a.checked }); selectedAssets = 1 == chkState ? AssetData : [], this.setState({ allChecked: chkState, assetsList: newState, selectedAssets: selectedAssets }) }, onSelectAsset: function (e, sysSerial, assetSysSerial) { var chkState = e.target.checked, _state = this.state, assetsList = (_state.prevAssetsSelected, _state.assetsList), newState = assetsList.map(function (m) { if (m.sysSerial === sysSerial) { var o = (0, _objectAssign2.default)({}, m); return o.checked = chkState, o } return m }), prevSelectedAssetslist = this.state.selectedAssets.filter(function (a) { return a.sysSerial !== sysSerial }), selectedAssets = newState.filter(function (a) { return a.sysSerial === sysSerial }); 1 == chkState && (prevSelectedAssetslist = 0 === prevSelectedAssetslist.length ? selectedAssets : [].concat(_toConsumableArray(prevSelectedAssetslist), _toConsumableArray(selectedAssets))); var allChecked = prevSelectedAssetslist.length === _count; allChecked && (prevSelectedAssetslist = AssetData), this.setState({ allChecked: allChecked, assetsList: newState, selectedAssets: prevSelectedAssetslist }) }, getSelectedAssets: function () { return [].concat(_toConsumableArray(this.state.selectedAssets)) }, getAssets: function () { return this.props.assetsList }, componentWillMount: function () { this.setState({ assetsList: this.props.assetsList, count: _count, searchText: this.props.searchText, isBucket: this.props.isBucket }) }, componentWillReceiveProps: function (nextProps) { this.setState({ assetsList: nextProps.assetsList, count: _count, searchText: nextProps.searchText, isBucket: nextProps.isBucket }) }, rowAssetsSelect: function (sysSerial, checked) { var isChecked = 0 == checked, newState = this.state.assetsList; newState = newState.map(function (m) { if (m.sysSerial === sysSerial) { var o = (0, _objectAssign2.default)({}, m); return o.checked = isChecked, o } return m }); var previousSelectedAssets = this.state.selectedAssets; previousSelectedAssets = previousSelectedAssets.filter(function (a) { return a.sysSerial !== sysSerial }); var currentselectedAssets = newState.filter(function (a) { return a.sysSerial === sysSerial }); 1 == isChecked && (previousSelectedAssets = 0 === previousSelectedAssets.length ? currentselectedAssets : [].concat(_toConsumableArray(previousSelectedAssets), _toConsumableArray(currentselectedAssets))); var allChecked = previousSelectedAssets.length === _count; allChecked && (previousSelectedAssets = AssetData), this.setState({ allChecked: allChecked, assetsList: newState, selectedAssets: previousSelectedAssets }) }, handleSelect: function (eventKey, e) { eventKey.preventDefault(); var isBucket = this.state.isBucket; if (isBucket) { var page = parseInt(e.eventKey), selectedAssets = this.state.selectedAssets, data = getUserAssetBucketList(page); selectedAssets.length > 0 && (data = data.map(function (m) { var filterrows = selectedAssets.filter(function (a) { return a.sysSerial === m.sysSerial }); if (filterrows.length > 0) { var o = (0, _objectAssign2.default)({}, m); return o.checked = !0, o } return m })), this.setState({ assetsList: data, currentPage: page, count: _count, selectedAssets: selectedAssets }) } else { var _selectedAssets = this.state.selectedAssets, searchText = this.state.searchText, page = parseInt(e.eventKey), _data = SearchAssetslist(searchText, page); _selectedAssets.length > 0 && (_data = _data.map(function (m) { var filterrows = _selectedAssets.filter(function (a) { return a.sysSerial === m.sysSerial }); if (filterrows.length > 0) { var o = (0, _objectAssign2.default)({}, m); return o.checked = !0, o } return m })), this.setState({ assetsList: _data, currentPage: page, count: _count, selectedAssets: _selectedAssets }) } }, reloadData: function (e) { var isBucket = this.state.isBucket; AssetData = []; var selectedlist = []; if (isBucket) { var page = 1, data = getUserAssetBucketList(page); this.setState({ allChecked: !1, assetsList: data, currentPage: page, count: _count, selectedAssets: selectedlist }) } else { var searchText = this.state.searchText, page = 1; this.setState({ allChecked: !1, currentPage: page, selectedAssets: selectedlist }), this.props.onSearch(searchText, page) } }, render: function () { var _this2 = this, _state2 = this.state, allChecked = _state2.allChecked, assetsList = _state2.assetsList, assetGridIncidentCnt = 0, popupAssetCnt = 0, selectAllChkUI = void 0; selectAllChkUI = 1 == allChecked ? React.createElement("input", { type: "checkbox", title: "Select All", id: "chkSelectAll", checked: !0, onChange: this.onSelectAssetAll }) : React.createElement("input", { type: "checkbox", title: "Select All", id: "chkSelectAll", onChange: this.onSelectAssetAll }); var next = !0, prev = !0, last = !0, first = !0, ellipsis = !0, items = Math.ceil(this.state.count / pageSize), boundaryLinks = !0; return assetsList.length > 0 ? React.createElement("div", null, React.createElement("table", { className: "tag-asset-grid" }, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", { className: "selector" }, selectAllChkUI), React.createElement("th", { className: "asset-grid-ID" }, "Asset ID"), React.createElement("th", { className: "asset-grid-description" }, "Description"))), React.createElement("tbody", null, assetsList.map(function (e) { var chkUI = void 0, sysSerial = e.sysSerial, assetSysSerial = e.assetSysSerial, incds = e.incidents ? e.incidents : [], incidentsList = null; (1 == incds.length && "" != incds[0].Name || incds.length > 1) && (incidentsList = incds.map(function (a) { return ++assetGridIncidentCnt, React.createElement("span", { key: "assetsGridIncident_" + assetGridIncidentCnt, className: "incident-on-asset" }, a.Name) })), chkUI = 1 == allChecked || 1 == e.checked ? React.createElement("input", { type: "checkbox", id: "chkSelect_" + e.sysSerial, checked: !0, onChange: function (a) { _this2.onSelectAsset(a, sysSerial, assetSysSerial) } }) : React.createElement("input", { type: "checkbox", id: "chkSelect_" + e.sysSerial, onChange: function (a) { _this2.onSelectAsset(a, sysSerial, assetSysSerial) } }); var masterFlagUI = void 0; return e.isMaster && (masterFlagUI = React.createElement("span", { className: "assetBucket-masterFlag" }, "M")), ++popupAssetCnt, React.createElement("tr", { onClick: function (a) { _this2.rowAssetsSelect(sysSerial, e.checked) }, key: "popupAsset_" + popupAssetCnt }, React.createElement("td", { className: "selector" }, chkUI), React.createElement("td", { className: "assetID" }, React.createElement("div", { className: "mediaIDContainer" }, React.createElement("div", { className: "mediaIDImage" }, React.createElement("a", { href: "/Media/Detail?id=" + e.assetID + "&EvidenceGroupId=" + e.evidenceGroupId }, React.createElement(_AssetImage2.default, { src: e.thumbnail }))), React.createElement("div", { className: "mediaIDContent" }, React.createElement("a", { href: "/Media/Detail?id=" + e.assetID + "&EvidenceGroupId=" + e.evidenceGroupId }, e.assetID), masterFlagUI, React.createElement("div", { className: "asset-incidents" }, incidentsList)))), React.createElement("td", { className: "description" }, e.description)) }))), React.createElement(ReactBootstrap.Pagination, { prev: prev, next: next, first: first, last: last, ellipsis: ellipsis, boundaryLinks: boundaryLinks, items: items, maxButtons: 4, activePage: this.state.currentPage, onSelect: this.handleSelect }), React.createElement("div", { className: "tableRefreshButton" }, React.createElement("div", { className: "button-content" }, React.createElement("button", { name: "refresh", className: "refreshButton", onClick: function (e) { _this2.reloadData(e) } }, React.createElement("img", { src: "/Content/Images/icons/icomoon/png/32px/0303-loop2.png" }))))) : React.createElement("div", { className: "alert alert-danger" }, "No records found.") } }), AssetSearchTab = React.createClass({ displayName: "AssetSearchTab", getInitialState: function () { return { assetsList: [], count: 0, searchText: "" } }, onSearch: function (searchText, page) { _tagAssetModelSelectedTabKey = 1; var data = void 0, result = null; showLoaderOnVP(), null == page && (page = 1); var stationIDToPass = __stationId; if (_isAdmin && (stationIDToPass = 0), this.state.searchText != searchText || 1 == page && 0 == AssetData.length) { if (makeAjaxRequest({ type: "GET", url: "/UniversalSearch/SearchData", async: !1, params: { searchTerm: searchText, page: page, pageSize: 1e4, stationID: stationIDToPass, isTagCaseSearch: !0 }, scope: this, onComplete: function (resp) { data = JSON.parse(resp.responseText), data.msg && data.msg.length > 0 && console.error(data.msg), hideLoaderOnVP() } }), null == data || !data.Root) return []; AssetData = data.Root, AssetData = setUniqueSysSerialsOnAssets(AssetData) } hideLoaderOnVP(); var startindex = 4 * (page - 1), endindex = startindex + 4, NextPageRecords = AssetData.slice(startindex, endindex); result = NextPageRecords, _count = AssetData.length, this.setState({ assetsList: result, count: _count, searchText: searchText }) }, render: function () { return React.createElement("div", { className: "asset-search-tab" }, React.createElement(AssetSearchbox, { onSearch: this.onSearch }), React.createElement(AssetsGrid, { ref: "AssetSearchTabGrid", allChecked: !1, searchText: this.state.searchText, assetsList: this.state.assetsList, count: this.state.count, onSearch: this.onSearch })) } }), AssetBucketTab = React.createClass({ displayName: "AssetBucketTab", getInitialState: function () { return { assetsList: [], count: 0, isBucket: !0 } }, componentWillMount: function () { }, componentWillReceiveProps: function () { }, render: function () { return React.createElement("div", { className: "asset-bucket-tab" }, React.createElement(AssetsGrid, { ref: "AssetBucketTabGrid", allChecked: !1, assetsList: this.state.assetsList, count: this.state.count, isBucket: this.state.isBucket })) }, loadData: function () { AssetData = []; var data = getUserAssetBucketList(), count = data.length; this.setState({ assetsList: data, count: count, isBucket: !0 }) } }), _tagAssetModelSelectedTabKey = 1, bucketLoadedAlready = !1, TagAssetModal = React.createClass({ displayName: "TagAssetModal", props: { show: React.PropTypes.bool.isRequired, onOK: React.PropTypes.func.isRequired, onCancel: React.PropTypes.func.isRequired, stationId: React.PropTypes.number.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, currentAttachedAssets: React.PropTypes.arrayOf(_constants.AssetShape) }, getDefaultProps: function () { return { currentAttachedAssets: [] } }, onSelectTab: function (eventKey, e) { if (AssetTabSwitched = !0, _tagAssetModelSelectedTabKey = eventKey, 2 == _tagAssetModelSelectedTabKey) this.refs.AssetBucketTab.refs.AssetBucketTabGrid.reloadData(), AssetTabSwitched = !1; else { this.refs.AssetSearchTab.refs.AssetSearchTabGrid.reloadData(); AssetTabSwitched = !1 } }, onOK: function () { var _this3 = this; showLoaderOnVP(); var selectedAssets = [], data = [], assetBucketAllChecked = !1; if (1 == _tagAssetModelSelectedTabKey ? selectedAssets = this.refs.AssetSearchTab.refs.AssetSearchTabGrid.getSelectedAssets() : 2 == _tagAssetModelSelectedTabKey && (selectedAssets = this.refs.AssetBucketTab.refs.AssetBucketTabGrid.getSelectedAssets(), assetBucketAllChecked = this.refs.AssetBucketTab.refs.AssetBucketTabGrid.state.allChecked), 0 == selectedAssets.length) return showErrorMsg("No Asset selected"), void hideLoaderOnVP(); var selectedAssetsDetail = [], result = [], tagAllChildAssetsAndSegments = this.refs.tagAssetModal.state.chkUnTagAssetValue; if (2 == _tagAssetModelSelectedTabKey) { if (assetBucketAllChecked) selectedAssetsDetail = getOtherAssetsOfGroup(null, !0, tagAllChildAssetsAndSegments), selectedAssetsDetail = selectedAssetsDetail.concat(selectedAssets); else { var evidenceGroupInfo = selectedAssets.filter(function (x) { return x.isMaster }).map(function (x) { return x.evidenceGroupInfoForOtherAssets }); selectedAssetsDetail = getOtherAssetsOfGroup(evidenceGroupInfo, !1, tagAllChildAssetsAndSegments), selectedAssetsDetail = selectedAssetsDetail.concat(selectedAssets) } hideLoaderOnVP() } else { for (var selectedAssetIds = [], i = 0; i < selectedAssets.length; i++) { var assetObj = selectedAssets[i]; selectedAssetIds.push(assetObj.assetID) } if (selectedAssetIds.length > 0) { var params = { assetIDCsv: selectedAssetIds.join(","), tagAllChildAssetsAndSegments: tagAllChildAssetsAndSegments }; showLoaderOnVP(), makeAjaxRequest({ type: "POST", url: "/Case/SearchMedia", async: !1, params: params, scope: this, onComplete: function (resp) { if (data = JSON.parse(resp.responseText), data.success) { data = data.Root; for (var _i = 0; _i < data.length; _i++) { var _assetObj = data[_i]; selectedAssetsDetail.push(_assetObj), null == _assetObj.OtherAssetsOfGroup && void 0 == _assetObj.OtherAssetsOfGroup || (selectedAssetsDetail = selectedAssetsDetail.concat(_assetObj.OtherAssetsOfGroup)) } } else showErrorMsg(data.msg); hideLoaderOnVP() } }) } } for (var _loop = function (_i2) { var assetObj = selectedAssetsDetail[_i2], found = _this3.props.currentAttachedAssets.find(function (e) { return e.assetID == assetObj.assetID && e.evidenceGroupId == assetObj.evidenceGroupId }); null == found && (found = result.find(function (e) { return e.assetID == assetObj.assetID && e.evidenceGroupId == assetObj.evidenceGroupId }), null == found && result.push(assetObj)) }, _i2 = 0; _i2 < selectedAssetsDetail.length; _i2++)_loop(_i2); return 0 == result.length ? (hideLoaderOnVP(), this.props.onCancel(), void (bucketLoadedAlready = !1)) : (this.props.onOK(result), void (bucketLoadedAlready = !1)) }, onCancel: function () { this.props.onCancel(), bucketLoadedAlready = !1 }, getContent: function () { return React.createElement("div", { className: "tag-asset-modal-content" }, React.createElement(IrsaReactTabstrip, { id: "TagAssetModalTabStrip", onSelect: this.onSelectTab, key: 1, items: [{ id: "AssetSearchTab", key: 1, title: "Search Asset", content: React.createElement(AssetSearchTab, { ref: "AssetSearchTab" }) }, { id: "AssetBucketTab", key: 2, title: "Asset Bucket", content: React.createElement(AssetBucketTab, { ref: "AssetBucketTab" }) }] })) }, render: function () { return React.createElement("div", { id: "tagAssetsContainer" }, React.createElement(IrsaReactModal, { ref: "tagAssetModal", title: "Tag Assets to Case", show: this.props.show, content: this.getContent(), width: 300, buttons: [{ key: "ok", text: "OK", width: 90, className: "btn-glow inverse", onClick: this.onOK }, { key: "cancel", text: "Cancel", width: 90, className: "btn-glow", onClick: this.onCancel }], tagAssetsPopup: !0 })) } }), getOtherAssetsOfGroup = function (evidenceGroupsInfo, isSelectAllBucket, tagAllChildAssetsAndSegments) { var data = null, OtherAssetsOfGroup = null; if (void 0 != isSelectAllBucket && null != isSelectAllBucket || (isSelectAllBucket = !1), makeAjaxRequest({ type: "GET", url: "/Case/GetOtherAssetsOfGroup", async: !1, params: { evidenceGroupsDetails: JSON.stringify(evidenceGroupsInfo), isSelectAllBucket: isSelectAllBucket, tagAllChildAssetsAndSegments: tagAllChildAssetsAndSegments }, scope: void 0, onComplete: function (resp) { data = JSON.parse(resp.responseText), data.msg && data.msg.length > 0 ? console.error(data.msg) : OtherAssetsOfGroup = data.Root, hideLoaderOnVP() }, onError: function (err) { console.log(err.statusText), hideLoaderOnVP() } }), null == data || !data.Root) return []; var result = setUniqueSysSerialsOnAssets(data.Root); return result }, Assets = React.createClass({ displayName: "Assets", propTypes: { assets: React.PropTypes.arrayOf(_constants.AssetShape), stationId: React.PropTypes.number.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, onTaggedAssetsChange: React.PropTypes.func.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, isGuest: React.PropTypes.bool.isRequired, allowAssetsPlaying: React.PropTypes.bool.isRequired, allowAssetsDownloading: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, onChanged: React.PropTypes.func.isRequired, exportAllAssets: React.PropTypes.func.isRequired }, getDefaultProps: function () { return { assets: [] } }, getInitialState: function () { return { showTagAssetModal: !1, showDownloadAssetModal: !1, evgIdForAssetDownloading: 0, assetSysSerialDownloading: 0, untaggedAssets: [], assets: [], allCaseAssets: !1 } }, onTagAssetButtonClick: function (e) { e.preventDefault(), this.setState({ showTagAssetModal: !0 }) }, onAssetsSelectedFromModal: function (selectedAssets) { var _this4 = this, maxId = [].concat(_toConsumableArray(this.state.assets)).reduce(function (maxId, curr) { return Math.max(parseInt(curr.orderIdStr), maxId) }, 0), assetsToAdd = selectedAssets.filter(function (e) { return 1 == e.isMaster }); assetsToAdd.forEach(function (ma) { var evidenceGroupAssets = _this4.state.assets.filter(function (e) { return 0 == e.isMaster && e.evidenceGroupId == ma.evidenceGroupId }); if (evidenceGroupAssets.length > 0) { var firstAsset = evidenceGroupAssets[0]; null == firstAsset && void 0 == firstAsset || (maxId = parseInt(firstAsset.orderIdStr.replace(/[a-z]/g, "")) - 1) } ++maxId, ma.orderIdStr = maxId.toString(); var childAssets = selectedAssets.filter(function (e) { return e.evidenceGroupId == ma.evidenceGroupId && 0 == e.isMaster }); childAssets = _.uniq(childAssets, function (p) { return p.assetSysSerial }), ma.childAssets = childAssets; var i = "A"; ma.childAssets.forEach(function (ca, idx) { i = idx > 0 ? IrsaModulesUtil.LettersIncrement.increment(i) : "A", ca.orderIdStr = maxId.toString() + i.toLowerCase(), ca.CreatedOnTicks = (new Date).getTime(), ca.UpdatedOnTicks = 0, ca.CreatedByUser = { Id: _this4.props.userInfo.userId, FullName: _this4.props.userInfo.userFullName }, ca.checked = !0; var dt = new Date, cntInc = 0; ca.incidents = ca.incidents.map(function (a) { return { sysSerial: --cntInc, IncidentId: a.IncidentId, Name: a.Name, CreatedOn: dt, CreatedOnTicks: dt.getTime(), CreatedByUser: { Id: _this4.props.userInfo.userId, FullName: _this4.props.userInfo.userFullName } } }) }), ma.CreatedOnTicks = (new Date).getTime(), ma.UpdatedOnTicks = 0, ma.CreatedByUser = { Id: _this4.props.userInfo.userId, FullName: _this4.props.userInfo.userFullName }, ma.checked = !0; var dt = new Date, cntInc = 0; ma.incidents = ma.incidents.map(function (a) { return { sysSerial: --cntInc, IncidentId: a.IncidentId, Name: a.Name, CreatedOn: dt, CreatedOnTicks: dt.getTime(), CreatedByUser: { Id: _this4.props.userInfo.userId, FullName: _this4.props.userInfo.userFullName } } }) }); var otherAssets = selectedAssets.filter(function (e) { return 0 == e.isMaster }); otherAssets = _.uniq(otherAssets, function (a) { return a.assetID }); var oChildAssets = [], lastChildID = []; otherAssets.forEach(function (a) { var found = !1; assetsToAdd.forEach(function (b) { if (b.assetSysSerial == a.assetSysSerial && b.evidenceGroupId == a.evidenceGroupId) found = !0; else if (b.childAssets && b.childAssets.length > 0) { var f = b.childAssets.find(function (r) { return r.assetSysSerial == a.assetSysSerial }); null != f && (found = !0) } }), found || oChildAssets.push(a) }), oChildAssets.forEach(function (oa) { var masterAsset = _this4.state.assets.find(function (e) { return e.evidenceGroupId == oa.evidenceGroupId && 1 == e.isMaster }); if (masterAsset) if (masterAsset.childAssets.length > 0) { masterAsset.childAssets.sort(_commonFunctions.assetComparator); var last = masterAsset.childAssets[masterAsset.childAssets.length - 1]; if (lastChildID.length > 0) { var lastChild = lastChildID[lastChildID.length - 1]; lastChild.replace(/[a-z]/g, "").toString() == masterAsset.orderIdStr.toString() ? oa.orderIdStr = masterAsset.orderIdStr.toString() + IrsaModulesUtil.LettersIncrement.increment(lastChild.replace(/[0-9]/g, "")).toLowerCase() : oa.orderIdStr = masterAsset.orderIdStr.toString() + IrsaModulesUtil.LettersIncrement.increment(last.orderIdStr.replace(/[0-9]/g, "")).toLowerCase() } else { var currentMaxChildOrderIdStr = last.orderIdStr.replace(/[0-9]/g, ""); oa.orderIdStr = masterAsset.orderIdStr.toString() + IrsaModulesUtil.LettersIncrement.increment(currentMaxChildOrderIdStr).toLowerCase() } lastChildID.push(oa.orderIdStr) } else { if (lastChildID.length > 0) { var _lastChild = lastChildID[lastChildID.length - 1]; _lastChild.replace(/[a-z]/g, "").toString() == masterAsset.orderIdStr.toString() ? oa.orderIdStr = masterAsset.orderIdStr.toString() + IrsaModulesUtil.LettersIncrement.increment(_lastChild.replace(/[0-9]/g, "")).toLowerCase() : oa.orderIdStr = masterAsset.orderIdStr.toString() + "a" } else oa.orderIdStr = masterAsset.orderIdStr.toString() + "a"; lastChildID.push(oa.orderIdStr) } else ++maxId, oa.orderIdStr = maxId.toString(); oa.CreatedOnTicks = (new Date).getTime(), oa.UpdatedOnTicks = 0, oa.CreatedByUser = { Id: _this4.props.userInfo.userId, FullName: _this4.props.userInfo.userFullName }, oa.checked = !0; var dt = new Date, cntInc = 0; oa.incidents = oa.incidents.map(function (a) { return { sysSerial: --cntInc, IncidentId: a.IncidentId, Name: a.Name, CreatedOn: dt, CreatedOnTicks: dt.getTime(), CreatedByUser: { Id: _this4.props.userInfo.userId, FullName: _this4.props.userInfo.userFullName } } }) }); var selAssets = assetsToAdd.concat(oChildAssets), finalAssets = [], existsAlready = !1; selAssets.map(function (e) { _this4.state.assets.forEach(function (a) { if (a.assetSysSerial == e.assetSysSerial && a.evidenceGroupId == e.evidenceGroupId) existsAlready = !0; else if (a.childAssets) { var foundInChildren = a.childAssets.find(function (c) { return c.assetSysSerial == e.assetSysSerial && c.evidenceGroupId == e.evidenceGroupId }); foundInChildren && (existsAlready = !0) } }), existsAlready || finalAssets.push(e) }); var untaggedAssets = this.state.untaggedAssets, assetsToMerge = []; finalAssets.forEach(function (m) { assetsToMerge.push(m), m.descriptionComparer = m.description; var matchedUntaggedAsset = untaggedAssets.find(function (ua) { return ua.assetSysSerial == m.assetSysSerial && ua.evidencegroupId == m.evidencegroupId }); matchedUntaggedAsset ? (m.orderIdStrComparer = matchedUntaggedAsset.orderIdStr, untaggedAssets = untaggedAssets.filter(function (ua) { return ua.assetSysSerial != m.assetSysSerial && ua.evidencegroupId != m.evidencegroupId })) : m.orderIdStrComparer = m.orderIdStr, m.childAssets && m.childAssets.length > 0 && m.childAssets.forEach(function (c) { c.descriptionComparer = c.description; var matchedUntaggedAsset = untaggedAssets.find(function (ua) { return ua.assetSysSerial == c.assetSysSerial && ua.evidencegroupId == c.evidencegroupId }); matchedUntaggedAsset ? (c.orderIdStrComparer = matchedUntaggedAsset.orderIdStr, untaggedAssets = untaggedAssets.filter(function (ua) { return ua.assetSysSerial != m.assetSysSerial && ua.evidencegroupId != m.evidencegroupId })) : c.orderIdStrComparer = c.orderIdStr, assetsToMerge.push(c) }) }); var newState = null, childState = [], assetState = this.state.assets, masterAssetsSelected = assetsToMerge.filter(function (e) { return 1 == e.isMaster }); if (masterAssetsSelected.length > 0) { masterAssetsSelected.forEach(function (ma) { var childAssetsExists = _this4.state.assets.filter(function (e) { return e.evidenceGroupId == ma.evidenceGroupId && 0 == e.isMaster }), childAssetsSelected = assetsToMerge.filter(function (e) { return 0 == e.isMaster && e.evidenceGroupId == ma.evidenceGroupId }), last = childAssetsSelected[childAssetsSelected.length - 1], currentMaxChildOrderIdStr = "a"; void 0 != last || null != last ? (currentMaxChildOrderIdStr = last.orderIdStr.replace(/[0-9]/g, ""), currentMaxChildOrderIdStr = IrsaModulesUtil.LettersIncrement.increment(currentMaxChildOrderIdStr)) : currentMaxChildOrderIdStr = "a", childAssetsExists.forEach(function (ca) { ca.orderIdStrComparer = ca.orderIdStr, ca.orderIdStr = ma.orderIdStr.toString() + currentMaxChildOrderIdStr.toLowerCase(), currentMaxChildOrderIdStr = IrsaModulesUtil.LettersIncrement.increment(currentMaxChildOrderIdStr), childState.push(ca), assetState = assetState.filter(function (e) { return e.assetID != ca.assetID }) }) }); var taggedAssets = assetState.concat(childState), _finalAssets = taggedAssets.concat(assetsToMerge); newState = _finalAssets } else newState = [].concat(_toConsumableArray(this.state.assets), assetsToMerge); newState.forEach(function (a) { a.orderIdStrComparer = a.orderIdStrComparer ? a.orderIdStrComparer : a.orderIdStr }), this.setState({ assets: newState, showTagAssetModal: !1, untaggedAssets: untaggedAssets }, function () { _this4.props.onTaggedAssetsChange(newState, !0, !1), _this4.props.onChanged() }) }, onCancelTagAssetModal: function () { this.setState({ showTagAssetModal: !1 }) }, onChangeAssetDescription: function (sysSerial, evidencegroupId, value) { var newState = this.state.assets.map(function (e) { if (e.assetSysSerial == sysSerial && e.evidenceGroupId == evidencegroupId) { var o = (0, _objectAssign2.default)({}, e); return o.description = value, o } return e }); this.setState({ assets: newState }), this.props.onChanged() }, onChangeAssetExternalRMSID: function (sysSerial, evidencegroupId, value) { var newState = this.state.assets.map(function (e) { if (e.assetSysSerial == sysSerial && e.evidenceGroupId == evidencegroupId) { var o = (0, _objectAssign2.default)({}, e); return o.Ext_RMSID = value, o } return e }); this.setState({ assets: newState }), this.props.onChanged() }, onUntagAsset: function (sysSerial, assetSysSerial, evidenceGroupId) { showConfirmDialog({ msg: "Are you sure to untag this Asset?", callbackYes: function () { var record = this.state.assets.find(function (a) { return a.assetSysSerial == assetSysSerial && a.evidenceGroupId == evidenceGroupId }), newState = void 0, untaggedAssets = this.state.untaggedAssets; record.isMaster ? (newState = this.state.assets.filter(function (e) { return e.evidenceGroupId != record.evidenceGroupId }), untaggedAssets = untaggedAssets.concat(this.state.assets.filter(function (e) { return e.evidenceGroupId == record.evidenceGroupId }))) : (newState = this.state.assets.filter(function (e) { return e.assetSysSerial != record.assetSysSerial || e.evidenceGroupId != record.evidenceGroupId }), untaggedAssets.push(record)), this.setState({ assets: newState, untaggedAssets: untaggedAssets }), this.props.onTaggedAssetsChange(newState, !1, !0), this.props.onChanged() }, scope: this }) }, onCancelDownloadAssetModal: function () { this.setState({ showDownloadAssetModal: !1, allCaseAssets: !1 }) }, onDownloadAssetButtonClick: function (sysserial, evidenceGroupId, allCaseAssets) { var caseAssets = !!allCaseAssets && allCaseAssets; this.setState({ evgIdForAssetDownloading: evidenceGroupId, assetSysSerialDownloading: sysserial, showDownloadAssetModal: !0, allCaseAssets: caseAssets }) }, componentWillMount: function () { this.setState({ assets: this.props.assets }) }, componentWillReceiveProps: function (nextProps) { this.setState({ assets: nextProps.assets }) }, render: function () { var _props = this.props, stationId = _props.stationId, userInfo = _props.userInfo, readOnlyMode = _props.readOnlyMode, isGuest = _props.isGuest, allowAssetsPlaying = _props.allowAssetsPlaying, allowAssetsDownloading = _props.allowAssetsDownloading, caseSysSerial = _props.caseSysSerial, exportAllAssets = _props.exportAllAssets, _state3 = this.state, assets = _state3.assets, evgIdForAssetDownloading = _state3.evgIdForAssetDownloading, assetSysSerialDownloading = _state3.assetSysSerialDownloading, allCaseAssets = _state3.allCaseAssets, tagAssetModalUI = React.createElement(TagAssetModal, { userInfo: userInfo, show: this.state.showTagAssetModal, stationId: stationId, onOK: this.onAssetsSelectedFromModal, onCancel: this.onCancelTagAssetModal, currentAttachedAssets: assets }), downloadAssetModalUI = React.createElement(_DownloadAssetModal2.default, { onCancel: this.onCancelDownloadAssetModal, show: this.state.showDownloadAssetModal, evidenceGroupId: evgIdForAssetDownloading, assetSysSerial: assetSysSerialDownloading, isGuest: isGuest, trackCaseHistory: this.props.trackCaseHistory, caseSysSerial: caseSysSerial, allCaseAssets: allCaseAssets }); return React.createElement("div", null, tagAssetModalUI, downloadAssetModalUI, React.createElement(_AssetsView2.default, { assets: assets, stationId: stationId, userInfo: userInfo, readOnlyMode: readOnlyMode, isGuest: isGuest, allowAssetsPlaying: allowAssetsPlaying, allowAssetsDownloading: allowAssetsDownloading, caseSysSerial: caseSysSerial, onChangeAssetDescription: this.onChangeAssetDescription, onChangeAssetExternalRMSID: this.onChangeAssetExternalRMSID, onUntagAsset: this.onUntagAsset, onTagAssetButtonClick: this.onTagAssetButtonClick, exportAllAssets: exportAllAssets, onDownloadAssetButtonClick: this.onDownloadAssetButtonClick })) } }); module.exports = Assets }, function(module, exports) { "use strict"; var getMediaStatus = function (state, status) { var result = ""; switch (state) { case 1: case 2: switch (status) { case 6: result = "Available"; break; case 1: result = "Queued"; break; case 2: result = "Uploading"; break; case 3: result = "Processing"; break; case 4: result = "Processing"; break; case 5: result = "Failed"; break; case 7: result = "Metadata Only "; break; case 8: result = "Request Upload"; break; case 11: result = "Unit Reset" }break; case 3: switch (status) { case 6: case 1: case 2: case 3: case 4: case 7: case 8: result = "Trash"; break; case 5: result = "Failed, Trash" }break; case 4: switch (status) { case 6: case 1: case 2: case 3: case 4: case 7: case 8: result = "Deleted"; break; case 5: result = "Failed, Deleted" }break; case 5: switch (status) { case 6: result = "Retain"; break; case 1: result = "Retain, Queued"; break; case 2: result = "Retain, Uploading"; break; case 3: result = "Retain, Processing"; break; case 4: result = "Retain, Processing"; break; case 5: result = "Retain, Failed"; break; case 7: result = "Retain, MetaData Only"; break; case 8: result = "retain, Request upload" } }return result }, isAssetAvailable = function (mediaStatus, mediaState) { var isAvailable = !(6 != mediaStatus && 5 != mediaStatus || 1 != mediaState && 3 != mediaState && 5 != mediaState); return isAvailable }, assetComparator = function (a, b) { var nameA = a.orderIdStr.toUpperCase(), nameB = b.orderIdStr.toUpperCase(); return nameA < nameB ? -1 : nameA > nameB ? 1 : 0 }, masterAssetComparator = function (a, b) { var nameA = a.orderIdStr.match(/(\d+)/g)[0], nameB = b.orderIdStr.match(/(\d+)/g)[0]; return Number(nameA) - Number(nameB) }; module.exports = { getMediaStatus: getMediaStatus, isAssetAvailable: isAssetAvailable, assetComparator: assetComparator, masterAssetComparator: masterAssetComparator } }, function(module, exports, __webpack_require__) { "use strict"; var _constants = __webpack_require__(22), AssetImage = React.createClass({ displayName: "AssetImage", propTypes: { src: React.PropTypes.string.isRequired }, getInitialState: function () { return { src: _constants.ERROR_IMAGE_PATH, errored: !1 } }, handleError: function () { this.setState({ errored: !0 }) }, componentWillMount: function () { this.setState({ src: this.props.src, errored: !1 }) }, componentWillReceiveProps: function (nextProps) { this.setState({ src: nextProps.src }) }, shouldComponentUpdate: function (nextProps, nextState) { return this.state.errored !== !0 }, render: function () { var ticks = (new Date).getTime(), style = { width: "79px", height: "64px", border: "0 none", borderRadius: "5px" }, imgUI = void 0; if (this.state.errored) { var src = _constants.ERROR_IMAGE_PATH; imgUI = React.createElement("img", { style: style, src: src }) } else { var _src = this.state.src; _src = _src.indexOf("?") > -1 ? _src + "&dt=" + ticks.toString() : _src + "?dt=" + ticks.toString(), imgUI = React.createElement("img", { style: style, src: _src, onError: this.handleError }) } return imgUI } }); module.exports = AssetImage }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _constants = __webpack_require__(22), _react = __webpack_require__(1), _Asset = __webpack_require__(77), _Asset2 = _interopRequireDefault(_Asset), _commonFunctions = __webpack_require__(74), AssetsView = function (_React$Component) { function AssetsView(props) { _classCallCheck(this, AssetsView); var _this = _possibleConstructorReturn(this, (AssetsView.__proto__ || Object.getPrototypeOf(AssetsView)).call(this, props)), assets = _this.convertDataToHierarchyStructure(props.assets); return _this.state = { assets: assets }, _this } return _inherits(AssetsView, _React$Component), _createClass(AssetsView, [{ key: "componentWillReceiveProps", value: function (nextProps) { var assets = this.convertDataToHierarchyStructure(nextProps.assets); this.setState({ assets: assets }) } }, { key: "convertDataToHierarchyStructure", value: function (assets) { var masterAssets = assets.filter(function (e) { return 1 == e.isMaster }); masterAssets.forEach(function (ma) { var childAssets = assets.filter(function (e) { return e.evidenceGroupId == ma.evidenceGroupId && 0 == e.isMaster }); ma.childAssets = childAssets }); var otherAssets = assets.filter(function (e) { return 0 == e.isMaster }), oAssets = []; otherAssets.map(function (e) { var found = !1; masterAssets.forEach(function (m) { if (m.assetSysSerial == e.assetSysSerial) found = !0; else { var f = m.childAssets.find(function (b) { return b.assetSysSerial == e.assetSysSerial }); null != f && (found = !0) } }), found || oAssets.push(e) }); var finalAssets = [].concat(_toConsumableArray(masterAssets), oAssets); return finalAssets.sort(_commonFunctions.masterAssetComparator), finalAssets } }, { key: "ShowAllAsset", value: function () { var _this2 = this, assets = this.state.assets; assets.map(function (e, idx) { _this2.props.onDownloadAssetButtonClick(e.assetSysSerial, e.evidenceGroupId, !0) }) } }, { key: "render", value: function () { var _this3 = this, _props = this.props, readOnlyMode = (_props.stationId, _props.userInfo, _props.readOnlyMode), isGuest = _props.isGuest, allowAssetsPlaying = _props.allowAssetsPlaying, allowAssetsDownloading = _props.allowAssetsDownloading, caseSysSerial = _props.caseSysSerial, exportAllAssets = _props.exportAllAssets, assets = this.state.assets, buttonsUI = void 0; readOnlyMode !== !0 && (buttonsUI = React.createElement("div", { className: "case-asset-buttons" }, React.createElement("button", { className: "btn btn-default tagAssetButtonOnPage", onClick: function (e) { return _this3.props.onTagAssetButtonClick(e) } }, React.createElement("i", { className: "fa fa-external-link", style: { marginRight: "5px", color: "#404040" } }), React.createElement("span", null, "Tag Asset")))); var exportAllBtnUI = void 0; return 1 == allowAssetsDownloading && 1 == isGuest ? exportAllBtnUI = React.createElement("div", { className: "optionsMenu-downloads exportAll-Btn" }, React.createElement("div", { className: "btn-group" }, React.createElement("button", { type: "button", id: "btn-toggle-optionsMenu", title: "Export All", className: "btn dropdown-toggle", "data-toggle": "dropdown" }, React.createElement("i", { className: "fa fa-download" }), React.createElement("span", { className: "caret" })), React.createElement("ul", { id: "optionsMenu", className: "dropdown-menu", role: "menu" }, React.createElement("li", { onClick: function (e) { return exportAllAssets("zip") } }, React.createElement("a", null, "Zip")), React.createElement("li", { onClick: function (e) { return exportAllAssets("iso") } }, React.createElement("a", null, "ISO")), React.createElement("li", { onClick: function (e) { return _this3.ShowAllAsset() } }, React.createElement("a", null, "Show All"))))) : 1 == allowAssetsDownloading && 0 == isGuest && (exportAllBtnUI = React.createElement("div", { className: "optionsMenu-downloads exportAll-Btn" }, React.createElement("div", { className: "btn-group" }, React.createElement("button", { type: "button", id: "btn-toggle-optionsMenu", title: "Export All", className: "btn dropdown-toggle", "data-toggle": "dropdown" }, React.createElement("i", { className: "fa fa-download" }), React.createElement("span", { className: "caret" })), React.createElement("ul", { id: "optionsMenu", className: "dropdown-menu", role: "menu" }, React.createElement("li", { onClick: function (e) { return exportAllAssets("zip") } }, React.createElement("a", null, "Zip")), React.createElement("li", { onClick: function (e) { return exportAllAssets("iso") } }, React.createElement("a", null, "ISO")), React.createElement("li", { onClick: function (e) { return exportAllAssets("ZipAsNewAsset") } }, React.createElement("a", null, "Create Zip as New Asset")), React.createElement("li", { onClick: function (e) { return _this3.ShowAllAsset() } }, React.createElement("a", null, "Show All")))))), assets.length > 0 ? React.createElement("div", { className: "case-assets-container" }, React.createElement("label", { className: "section-heading" }, "Tagged Assets"), exportAllBtnUI, React.createElement("table", { className: "table table-bordered table-striped case-assets" }, React.createElement("tbody", null, assets.map(function (e, idx) { return React.createElement(_Asset2.default, { key: "ta_" + idx, ref: "Asset", asset: e, onChangeDescription: function (a) { return _this3.props.onChangeAssetDescription(e.assetSysSerial, e.evidenceGroupId, a.target.value) }, onDownloadAssetButtonClick: function (a) { return _this3.props.onDownloadAssetButtonClick(e.assetSysSerial, e.evidenceGroupId) }, onChangeChildDescription: _this3.props.onChangeAssetDescription, onChangeAssetExternalRMSID: function (a) { return _this3.props.onChangeAssetExternalRMSID(e.assetSysSerial, e.evidenceGroupId, a.target.value) }, onUntagAsset: _this3.props.onUntagAsset, readOnlyMode: readOnlyMode, caseSysSerial: caseSysSerial, isGuest: isGuest, allowAssetsPlaying: allowAssetsPlaying, allowAssetsDownloading: allowAssetsDownloading }) }))), buttonsUI) : React.createElement("div", { className: "case-assets-container" }, React.createElement("div", { className: "alert alert-warning case-assets", role: "alert" }, "No Assets tagged to this Case yet"), buttonsUI) } }]), AssetsView }(React.Component); exports.default = AssetsView, AssetsView.propTypes = { assets: _react.PropTypes.arrayOf(_constants.AssetShape), stationId: _react.PropTypes.number.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, readOnlyMode: _react.PropTypes.bool.isRequired, isGuest: _react.PropTypes.bool.isRequired, allowAssetsPlaying: _react.PropTypes.bool.isRequired, allowAssetsDownloading: _react.PropTypes.bool.isRequired, caseSysSerial: _react.PropTypes.number.isRequired, onChangeAssetDescription: _react.PropTypes.func.isRequired, onUntagAsset: _react.PropTypes.func.isRequired, onTagAssetButtonClick: _react.PropTypes.func.isRequired, onDownloadAssetButtonClick: _react.PropTypes.func }, AssetsView.defaultProps = { assets: [] } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _EvidenceGroupDetail = __webpack_require__(78), _EvidenceGroupDetail2 = _interopRequireDefault(_EvidenceGroupDetail), _constants = __webpack_require__(22), _AssetImage = __webpack_require__(75), _AssetImage2 = _interopRequireDefault(_AssetImage), _SegmentUI = __webpack_require__(79), _SegmentUI2 = _interopRequireDefault(_SegmentUI), _commonFunctions = __webpack_require__(74), Asset = React.createClass({ displayName: "Asset", propTypes: { asset: _constants.AssetShape.isRequired, onChangeDescription: React.PropTypes.func.isRequired, onChangeChildDescription: React.PropTypes.func.isRequired, onUntagAsset: React.PropTypes.func.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, isGuest: React.PropTypes.bool.isRequired, allowAssetsPlaying: React.PropTypes.bool.isRequired, allowAssetsDownloading: React.PropTypes.bool.isRequired, onChangeAssetExternalRMSID: React.PropTypes.func.isRequired, onDownloadAssetButtonClick: React.PropTypes.func }, getInitialState: function () { return { expanded: !1 } }, onChangeDescription: function (value, sysSerial, evidenceGroupId) { this.props.onChangeChildDescription(sysSerial ? sysSerial : this.props.asset.sysSerial, evidenceGroupId, value) }, onUnTagAsset: function (sysSerial, assetSysSerial, evidenceGroupId) { this.props.onUntagAsset(sysSerial ? sysSerial : this.props.asset.sysSerial, assetSysSerial, evidenceGroupId) }, onClickMediaLink: function (event) { var _props = this.props, asset = _props.asset, isGuest = _props.isGuest; if (isGuest && (!isGuest || 1 != asset.mediaTypeId && 5 != asset.mediaTypeId && 2 != asset.mediaTypeId)) { var mediaPreviewContainer = document.getElementById("mediaPreview"); if ((0, _commonFunctions.isAssetAvailable)(asset.mediaStatus, asset.mediaState)) if (_constants.VIDEO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !1); else if (_constants.AUDIO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !0); else if (_constants.IMAGE_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) { event.preventDefault(); var imageSrc = asset.assetURLForExport; ReactDOM.render(React.createElement(IrsaReactAssetPreview, { url: imageSrc, width: 650, height: 450 }), mediaPreviewContainer); var mediaId = asset.assetID, Currenturl = new URL(window.location.href), searchParams = Currenturl.searchParams, EsyndicatedId = searchParams.get("ce"); null != EsyndicatedId && "" != EsyndicatedId && (EsyndicatedId = EsyndicatedId.replace(/\+/g, "|")), 1 == isGuest && null != EsyndicatedId && makeAjaxRequest({ type: "POST", url: "/Public/Case/logDownloadandViewCaseMedia", async: !1, params: { EsyndicatedId: EsyndicatedId, mediaId: mediaId, Isimageview: !0 }, onComplete: function (resp) { var json = JSON.parse(resp.responseText); 1 != json.success && console.log(json.msg) } }) } } }, downloadAsset: function (e, assetURLForExport, isMediaAvailable) { e.preventDefault(); var evidenceGroupId = this.props.asset.evidenceGroupId; return isMediaAvailable && this.props.onDownloadAssetButtonClick(evidenceGroupId), !1 }, onClickArrow: function (e) { e.preventDefault(), this.setState({ expanded: !this.state.expanded }) }, render: function () { var _this = this, _props2 = this.props, readOnlyMode = _props2.readOnlyMode, isGuest = _props2.isGuest, allowAssetsPlaying = _props2.allowAssetsPlaying, allowAssetsDownloading = _props2.allowAssetsDownloading, caseSysSerial = _props2.caseSysSerial, _props$asset = this.props.asset, orderIdStr = (_props$asset.sysSerial, _props$asset.orderIdStr), assetSysSerial = _props$asset.assetSysSerial, assetID = _props$asset.assetID, evidenceGroupId = _props$asset.evidenceGroupId, thumbnail = _props$asset.thumbnail, description = (_props$asset.incidents, _props$asset.description), mediaTypeId = _props$asset.mediaTypeId, mediaStatus = _props$asset.mediaStatus, mediaState = _props$asset.mediaState, assetURLForExport = _props$asset.assetURLForExport, mediaURL = _props$asset.mediaURL, childAssets = (_props$asset.HasSubDetail, _props$asset.childAssets), Ext_RMSID = _props$asset.Ext_RMSID, TotalSegments = (_props$asset.isMaster, _props$asset.TotalSegments), segmentsTagged = _props$asset.segmentsTagged, expanded = this.state.expanded, isMediaAvailable = (0, _commonFunctions.isAssetAvailable)(mediaStatus, mediaState), incidentsList = void 0, iconRemoveCell = void 0; readOnlyMode !== !0 && (iconRemoveCell = React.createElement("td", { className: "remove-icon" }, React.createElement("a", { href: "#", title: "Untag Asset", onClick: function (e) { e.preventDefault(), _this.onUnTagAsset(assetSysSerial, assetSysSerial, evidenceGroupId) } }, React.createElement("i", { className: "icon-remove-sign" })))); var mediaUrl = "/Media/Detail?id=" + assetID + "&EvidenceGroupId=" + evidenceGroupId; mediaUrl += "&showSO=" + !1, isGuest === !0 && (mediaUrl = 1 == mediaTypeId || 5 == mediaTypeId || 2 == mediaTypeId || 8 == mediaTypeId || 6 == mediaTypeId || 7 == mediaTypeId | 10 == mediaTypeId || 11 == mediaTypeId || 17 == mediaTypeId ? mediaURL : "#"); var mediaTypeUI = void 0, mediaImageUI = void 0, mediaLinkUI = void 0, mediaStatusUI = void 0, downloadBtnCellUI = void 0, childAssetsUI = void 0, arrowIconUI = void 0, segmentUI = void 0; _constants.VIDEO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Video") : _constants.IMAGE_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Image") : _constants.AUDIO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) && (mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Audio")), 1 == isMediaAvailable ? 1 == allowAssetsPlaying ? (mediaImageUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, React.createElement(_AssetImage2.default, { src: thumbnail })), mediaLinkUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, assetID)) : (mediaImageUI = React.createElement("a", null, React.createElement(_AssetImage2.default, { src: thumbnail })), mediaLinkUI = React.createElement("a", null, assetID)) : (mediaImageUI = React.createElement(_AssetImage2.default, { src: thumbnail }), mediaLinkUI = 1 == allowAssetsPlaying ? React.createElement("a", { href: "#", onClick: function (e) { e.preventDefault() }, style: { cursor: "default" } }, assetID) : React.createElement("a", { href: mediaUrl, style: { cursor: "default" } }, assetID)); var resolvedMediaStatus = (0, _commonFunctions.getMediaStatus)(mediaState, mediaStatus); return "" != resolvedMediaStatus && (mediaStatusUI = React.createElement("span", { className: "label label-default asset-status-desc", title: resolvedMediaStatus }, resolvedMediaStatus)), "Supprimé" == resolvedMediaStatus && (mediaStatusUI = React.createElement("span", { className: "label label-default asset-status-desc", style: { background: "#d9534f" }, title: resolvedMediaStatus }, resolvedMediaStatus)), 1 == allowAssetsDownloading && (downloadBtnCellUI = React.createElement("td", { className: "download-asset-cell" }, React.createElement("a", { href: "#", className: isMediaAvailable ? "" : "downloadLink-disabled", onClick: function (e) { return _this.downloadAsset(e, assetURLForExport, isMediaAvailable) } }, React.createElement("i", { className: "fa fa-download" })))), expanded && (childAssetsUI = React.createElement(_EvidenceGroupDetail2.default, { key: "tagChildAsset_" + evidenceGroupId, ref: "AssetSubDetail", assets: childAssets, caseSysSerial: caseSysSerial, readOnlyMode: readOnlyMode, isGuest: isGuest, allowAssetsPlaying: allowAssetsPlaying, allowAssetsDownloading: allowAssetsDownloading, onDownloadAssetButtonClick: function (a) { return _this.props.onDownloadAssetButtonClick(evidenceGroupId) }, onChangeAssetDescription: this.onChangeDescription, onUntagAsset: this.onUnTagAsset, setPopoverForSegmentsDisplay: this.setPopoverForSegmentsDisplay })), childAssets && childAssets.length > 0 && (arrowIconUI = React.createElement("a", { href: "#", onClick: this.onClickArrow }, React.createElement("i", { className: expanded ? "fa fa-caret-down" : "fa fa-caret-right", "aria-hidden": "true" }))), TotalSegments > 1 && segmentsTagged && (segmentUI = React.createElement(_SegmentUI2.default, { TotalSegments: TotalSegments, assetSysSerial: assetSysSerial, evidenceGroupId: evidenceGroupId, allowAssetsPlaying: allowAssetsPlaying })), React.createElement("tr", { className: "asset parent-row" }, React.createElement("td", { colSpan: "5" }, React.createElement("table", null, React.createElement("tbody", null, React.createElement("tr", null, React.createElement("td", { className: "order-id" }, arrowIconUI, " #", orderIdStr), React.createElement("td", { className: "assetID" }, React.createElement("div", { className: "mediaIDContainer" }, React.createElement("div", { className: "mediaIDImage" }, mediaImageUI), React.createElement("div", { className: "mediaIDContent" }, mediaLinkUI, mediaTypeUI, mediaStatusUI, segmentUI, React.createElement("div", { className: "asset-incidents" }, incidentsList)))), React.createElement("td", null, React.createElement(IrsaEditableText, { ref: "description", fieldName: "Asset Description", placeholder: "Description", value: description, className: "asset-description", onChange: this.props.onChangeDescription, maxlength: 150, title: "Description", disabled: readOnlyMode })), React.createElement("td", null, React.createElement(IrsaEditableText, { ref: "Ext_RMSID", fieldName: "Ext_RMSID", placeholder: "RMS ID...", value: Ext_RMSID, className: "asset-description", onChange: this.props.onChangeAssetExternalRMSID, maxlength: 150, title: "External RMSID", disabled: readOnlyMode })), downloadBtnCellUI, iconRemoveCell), React.createElement("tr", null, React.createElement("td", { className: "removeBorder", colSpan: "5" }, childAssetsUI)))))) } }); module.exports = Asset }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _constants = __webpack_require__(22), _objectAssign = __webpack_require__(7), _AssetImage = (_interopRequireDefault(_objectAssign), __webpack_require__(75)), _AssetImage2 = _interopRequireDefault(_AssetImage), _commonFunctions = __webpack_require__(74), _SegmentUI = __webpack_require__(79), _SegmentUI2 = _interopRequireDefault(_SegmentUI), SubDetailAsset = React.createClass({ displayName: "SubDetailAsset", propTypes: { asset: _constants.AssetShape.isRequired, onChangeDescription: React.PropTypes.func.isRequired, onUntagAsset: React.PropTypes.func.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, isGuest: React.PropTypes.bool.isRequired, allowAssetsPlaying: React.PropTypes.bool.isRequired, allowAssetsDownloading: React.PropTypes.bool.isRequired, onDownloadAssetButtonClick: React.PropTypes.func, setPopoverForSegmentsDisplay: React.PropTypes.func }, onClickMediaLink: function () { var _props = this.props, asset = _props.asset, isGuest = _props.isGuest; if (isGuest && (!isGuest || 1 != asset.mediaTypeId && 5 != asset.mediaTypeId && 2 != asset.mediaTypeId)) { var mediaPreviewContainer = document.getElementById("mediaPreview"); if ((0, _commonFunctions.isAssetAvailable)(asset.mediaStatus, asset.mediaState)) if (_constants.VIDEO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !1); else if (_constants.AUDIO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !0); else if (_constants.IMAGE_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) { var imageSrc = asset.assetURLForExport; ReactDOM.render(React.createElement(IrsaReactAssetPreview, { url: imageSrc, width: 650, height: 450 }), mediaPreviewContainer) } } }, downloadAsset: function (e, assetURLForExport, isMediaAvailable) { e.preventDefault(); var evidenceGroupId = this.props.asset.evidenceGroupId; return isMediaAvailable && this.props.onDownloadAssetButtonClick(evidenceGroupId), !1 }, render: function () { var _this = this, _props2 = this.props, readOnlyMode = _props2.readOnlyMode, isGuest = _props2.isGuest, allowAssetsPlaying = _props2.allowAssetsPlaying, allowAssetsDownloading = _props2.allowAssetsDownloading, onUntagAsset = (_props2.caseSysSerial, _props2.onUntagAsset), _props$asset = this.props.asset, sysSerial = _props$asset.sysSerial, orderIdStr = _props$asset.orderIdStr, assetSysSerial = _props$asset.assetSysSerial, assetID = _props$asset.assetID, evidenceGroupId = _props$asset.evidenceGroupId, thumbnail = _props$asset.thumbnail, description = (_props$asset.incidents, _props$asset.description), mediaTypeId = _props$asset.mediaTypeId, mediaStatus = _props$asset.mediaStatus, mediaState = _props$asset.mediaState, assetURLForExport = _props$asset.assetURLForExport, mediaURL = _props$asset.mediaURL, TotalSegments = (_props$asset.isMaster, _props$asset.TotalSegments), isMediaAvailable = (_props$asset.segmentsTagged, (0, _commonFunctions.isAssetAvailable)(mediaStatus, mediaState)), incidentsList = void 0, iconRemoveCell = void 0; readOnlyMode !== !0 && (iconRemoveCell = React.createElement("td", { className: "remove-icon" }, React.createElement("a", { href: "#", title: "Untag Asset", onClick: function (e) { e.preventDefault(), onUntagAsset(sysSerial, assetSysSerial, evidenceGroupId) } }, React.createElement("i", { className: "icon-remove-sign" })))); var mediaUrl = "/Media/Detail?id=" + assetID + "&EvidenceGroupId=" + evidenceGroupId; mediaUrl += "&showSO=" + !1, isGuest === !0 && (mediaUrl = 1 == mediaTypeId || 5 == mediaTypeId || 2 == mediaTypeId || 8 == mediaTypeId || 6 == mediaTypeId || 7 == mediaTypeId | 10 == mediaTypeId || 11 == mediaTypeId || 17 == mediaTypeId ? mediaURL : "#"); var mediaTypeUI = void 0, mediaImageUI = void 0, mediaLinkUI = void 0, mediaStatusUI = void 0, downloadBtnCellUI = void 0, segmentUI = void 0; _constants.VIDEO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Video") : _constants.IMAGE_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Image") : _constants.AUDIO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) && (mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Audio")), 1 == isMediaAvailable ? 1 == allowAssetsPlaying ? (mediaImageUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, React.createElement(_AssetImage2.default, { src: thumbnail })), mediaLinkUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, assetID)) : (mediaImageUI = React.createElement("a", null, React.createElement(_AssetImage2.default, { src: thumbnail })), mediaLinkUI = React.createElement("a", null, assetID)) : (mediaImageUI = React.createElement(_AssetImage2.default, { src: thumbnail }), mediaLinkUI = 1 == allowAssetsPlaying ? React.createElement("a", { href: "#", onClick: function (e) { e.preventDefault() }, style: { cursor: "default" } }, assetID) : React.createElement("a", { href: mediaUrl, style: { cursor: "default" } }, assetID)); var resolvedMediaStatus = (0, _commonFunctions.getMediaStatus)(mediaState, mediaStatus); return "" != resolvedMediaStatus && (mediaStatusUI = React.createElement("span", { className: "label label-default asset-status-desc", title: resolvedMediaStatus }, resolvedMediaStatus)), 1 == allowAssetsDownloading && (downloadBtnCellUI = React.createElement("td", { className: "download-asset-cell" }, React.createElement("a", { href: "#", className: isMediaAvailable ? "" : "downloadLink-disabled", onClick: function (e) { return _this.downloadAsset(e, assetURLForExport, isMediaAvailable) } }, React.createElement("i", { className: "fa fa-download" })))), TotalSegments > 1 && (segmentUI = React.createElement(_SegmentUI2.default, { TotalSegments: TotalSegments, assetSysSerial: assetSysSerial, evidenceGroupId: evidenceGroupId, allowAssetsPlaying: allowAssetsPlaying })), React.createElement("tr", { className: "asset" }, React.createElement("td", { colSpan: "5" }, React.createElement("table", null, React.createElement("tbody", null, React.createElement("tr", null, React.createElement("td", { className: "order-id" }, "#", orderIdStr), React.createElement("td", { className: "assetID" }, React.createElement("div", { className: "mediaIDContainer" }, React.createElement("div", { className: "mediaIDImage" }, mediaImageUI), React.createElement("div", { className: "mediaIDContent" }, mediaLinkUI, mediaTypeUI, mediaStatusUI, segmentUI, React.createElement("div", { className: "asset-incidents" }, incidentsList)))), React.createElement("td", null, React.createElement(IrsaEditableText, { ref: "description", fieldName: "Asset Description", placeholder: "Description", value: description, className: "asset-description", onChange: this.props.onChangeDescription, maxlength: 150, disabled: readOnlyMode })), downloadBtnCellUI, iconRemoveCell))))) } }), EvidenceGroupDetail = React.createClass({ displayName: "EvidenceGroupDetail", propTypes: { assets: React.PropTypes.arrayOf(_constants.AssetShape), readOnlyMode: React.PropTypes.bool.isRequired, isGuest: React.PropTypes.bool.isRequired, allowAssetsPlaying: React.PropTypes.bool.isRequired, allowAssetsDownloading: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, onChangeAssetDescription: React.PropTypes.func.isRequired, onUntagAsset: React.PropTypes.func.isRequired, onDownloadAssetButtonClick: React.PropTypes.func, setPopoverForSegmentsDisplay: React.PropTypes.func }, getDefaultProps: function () { return { assets: [] } }, getInitialState: function () { return { assets: [] } }, render: function () { var _this2 = this, _props3 = this.props, assets = _props3.assets, readOnlyMode = _props3.readOnlyMode, isGuest = _props3.isGuest, allowAssetsPlaying = _props3.allowAssetsPlaying, allowAssetsDownloading = _props3.allowAssetsDownloading, caseSysSerial = _props3.caseSysSerial, taggedAssetCnt = (_props3.assetOrderId, 0); return assets.length > 0 ? React.createElement("div", { className: "case-assets-child-container" }, React.createElement("table", { className: "table case-assets" }, React.createElement("tbody", null, assets.map(function (e) { return ++taggedAssetCnt, React.createElement(SubDetailAsset, { key: "tac_" + taggedAssetCnt, ref: "Asset", asset: e, readOnlyMode: readOnlyMode, onChangeDescription: function (a) { return _this2.props.onChangeAssetDescription(a.target.value, e.assetSysSerial, e.evidenceGroupId) }, onUntagAsset: _this2.props.onUntagAsset, onDownloadAssetButtonClick: function (a) { return _this2.props.onDownloadAssetButtonClick(e.evidenceGroupId) }, caseSysSerial: caseSysSerial, isGuest: isGuest, allowAssetsPlaying: allowAssetsPlaying, allowAssetsDownloading: allowAssetsDownloading, setPopoverForSegmentsDisplay: _this2.props.setPopoverForSegmentsDisplay }) })))) : React.createElement("span", null) } }); module.exports = EvidenceGroupDetail }, function(module, exports) { "use strict"; var Segment = React.createClass({ displayName: "Segment", propTypes: { assetSysSerial: React.PropTypes.number.isRequired, evidenceGroupId: React.PropTypes.number.isRequired, TotalSegments: React.PropTypes.number.isRequired, allowAssetsPlaying: React.PropTypes.bool.isRequired }, getInitialState: function () { return { TotalSegments: 1 } }, componentDidMount: function () { var _props = this.props, assetSysSerial = _props.assetSysSerial, evidenceGroupId = _props.evidenceGroupId, TotalSegments = _props.TotalSegments; TotalSegments > 1 && this.setPopoverForSegmentsDisplay(assetSysSerial, evidenceGroupId) }, setPopoverForSegmentsDisplay: function (sysSerial, EvidenceGroupId) { var _props2 = this.props, allowAssetsPlaying = (_props2.isGuest, _props2.allowAssetsPlaying), elmId = "seg-" + sysSerial + "_" + EvidenceGroupId, elm = document.getElementById(elmId); null != elm && (createIrsaPopover({ element: elm, title: "Segments", placement: "right", content: function () { var data = []; return makeAjaxRequest({ params: { sysSerial: sysSerial, EvidenceGroupId: EvidenceGroupId }, type: "GET", async: !1, url: gAppBaseURL + "Media/GetVideoSegmentsInfo", onComplete: function (resp) { var result = JSON.parse(resp.responseText); 1 == result.success && result.segments && result.segments.length > 0 ? (data = result.segments, allowAssetsPlaying || data.forEach(function (e) { e.mediaURL = "#" })) : result.msg && result.msg.length > 0 && showErrorMsg(result.msg) } }), data }, loadDataOnce: !0, wrapperClass: "total-segments-list", template: $("#segmentTmpl").html(), trigger: "click" }), $(".k-master-row .k-hierarchy-cell .k-icon").on("click", function (e) { $(".total-segments-list").hide() })) }, render: function () { var _props3 = this.props, assetSysSerial = _props3.assetSysSerial, evidenceGroupId = _props3.evidenceGroupId, TotalSegments = _props3.TotalSegments; return React.createElement("span", { id: "seg-" + assetSysSerial + "_" + evidenceGroupId, className: "label label-default total-segments", title: "Click to view Continuous Video Segments" }, TotalSegments + " Segments") } }); module.exports = Segment }, function(module, exports, __webpack_require__) { "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _DataTable = __webpack_require__(81), _Column = __webpack_require__(112), DownloadAssetModal = (__webpack_require__(113), function (_React$Component) { function DownloadAssetModal(props) { _classCallCheck(this, DownloadAssetModal); var _this = _possibleConstructorReturn(this, (DownloadAssetModal.__proto__ || Object.getPrototypeOf(DownloadAssetModal)).call(this, props)); return _this.state = { assets: [] }, _this.bodyTemplate = _this.bodyTemplate.bind(_this), _this.onCancel = _this.onCancel.bind(_this), _this } return _inherits(DownloadAssetModal, _React$Component), _createClass(DownloadAssetModal, [{ key: "componentWillReceiveProps", value: function (nextProps) { var show = nextProps.show, evidenceGroupId = nextProps.evidenceGroupId, assetSysSerial = nextProps.assetSysSerial, isGuest = nextProps.isGuest, caseSysSerial = nextProps.caseSysSerial, allCaseAssets = nextProps.allCaseAssets, assets = []; show && (assets = this.getAssetsForDownload(evidenceGroupId, assetSysSerial, isGuest, caseSysSerial, allCaseAssets)), this.setState({ assets: assets }) } }, { key: "getAssetsForDownload", value: function (evidenceGroupId, assetSysSerial, isGuest, caseSysSerial, allCaseAssets) { var jsonResp = null; showLoaderOnVP(); var currentURL = window.location.href, url = new URL(currentURL), ce = url.searchParams.get("ce"), params = {}; return allCaseAssets ? (evidenceGroupId = 0, params = isGuest ? { evidenceGroupId: evidenceGroupId, isCaseView: !0, syndicatedVideoId: assetSysSerial, caseSysSerial: caseSysSerial, ce: ce } : { evidenceGroupId: evidenceGroupId, isCaseView: !0, caseSysSerial: caseSysSerial, ce: ce }) : params = isGuest ? { evidenceGroupId: evidenceGroupId, isCaseView: !0, syndicatedVideoId: assetSysSerial, caseSysSerial: caseSysSerial, ce: ce } : { evidenceGroupId: evidenceGroupId, isCaseView: !0, caseSysSerial: caseSysSerial, ce: ce }, makeAjaxRequest({ params: params, type: "GET", async: !1, scope: this, url: gAppBaseURL + "Media/GetAssetsForDownload", onComplete: function (resp) { jsonResp = $.parseJSON(resp.responseText), hideLoaderOnVP() } }), jsonResp && jsonResp.Root ? jsonResp.Root : [] } }, { key: "onDowloadAsset", value: function (e, downloadPath, fileType, isExport, mediaId) { var updatedDownloadPath, isGuest = this.props.isGuest, caseSysSerial = this.props.caseSysSerial; updatedDownloadPath = 0 == isExport && "Image" != fileType ? downloadPath.replace("Exp=true", "Exp=false") : downloadPath, e.preventDefault(); var url = gAppBaseURL + updatedDownloadPath, Currenturl = new URL(window.location.href), searchParams = Currenturl.searchParams, EsyndicatedId = searchParams.get("ce"); null != EsyndicatedId && "" != EsyndicatedId && (EsyndicatedId = EsyndicatedId.replace(/\+/g, "|")), url = url + "&EsyndicatedId=" + EsyndicatedId, $.downloadMediaFile(url), this.props.trackCaseHistory(isGuest, mediaId, null), 1 == isGuest ? this.logDownloadCaseMedia(isGuest, mediaId) : this.LogDownloadMedia(isGuest, mediaId, isExport, caseSysSerial) } }, { key: "LogDownloadMedia", value: function (isGuest, mediaId, isExport, caseSysSerial) { 0 == isGuest && makeAjaxRequest({ type: "POST", url: "/Case/LogDownloadMedia", async: !1, params: { mediaId: mediaId, caseId: caseSysSerial }, onComplete: function (resp) { var json = JSON.parse(resp.responseText); 1 != json.success && console.log(json.msg) } }) } }, { key: "logDownloadCaseMedia", value: function (isGuest, mediaId) { var Currenturl = new URL(window.location.href), searchParams = Currenturl.searchParams, EsyndicatedId = searchParams.get("ce"); null != EsyndicatedId && "" != EsyndicatedId && (EsyndicatedId = EsyndicatedId.replace(/\+/g, "|")), 1 == isGuest && null != EsyndicatedId && makeAjaxRequest({ type: "POST", url: "/Public/Case/logDownloadandViewCaseMedia", async: !1, params: { EsyndicatedId: EsyndicatedId, mediaId: mediaId }, onComplete: function (resp) { var json = JSON.parse(resp.responseText); 1 != json.success && console.log(json.msg) } }) } }, { key: "bodyTemplate", value: function (rowData, column) { var _this2 = this, field = column.field; return "downloadpath" == field.toLowerCase() ? React.createElement("div", { className: "optionsMenu-container caseMediaDownload" }, React.createElement("div", { className: "btn-group" }, React.createElement("button", { type: "button", id: "btn-toggle-optionsMenu", className: "btn dropdown-toggle k-irsa-button k-irsa-button-toolbar", "data-toggle": "dropdown" }, React.createElement("i", { className: "fa fa-download" }), React.createElement("span", { className: "caret" })), React.createElement("ul", { id: "optionsMenu", className: "dropdown-menu pull-right", role: "menu" }, React.createElement("li", { id: "li-initiateUpload" }, React.createElement("a", { href: "#", onClick: function (e) { return _this2.onDowloadAsset(e, rowData.DownloadPath, e.FileType, !0, rowData.mediaId) } }, "Original Format")), React.createElement("li", { id: "li-download-iso" }, React.createElement("a", { href: "#", onClick: function (e) { return _this2.onDowloadAsset(e, "Media/GenerateArchiveExportRequest?type=iso&assets=[" + rowData.SysSerial + "]&evidenceGroupIds=[" + rowData.EvidenceGroupId + "]&SingleSegment=true", rowData.FileType, !0, rowData.mediaId) } }, "ISO Format"))))) : React.createElement("span", { title: rowData[field] }, rowData[field]) } }, { key: "onCancel", value: function () { this.props.onCancel() } }, { key: "getContent", value: function () { var _this3 = this, assets = this.state.assets, evidenceGroupId = this.props.evidenceGroupId; return React.createElement("div", { className: "downloadAsset-modal-content", ref: function (contentDiv) { return _this3.contentDiv = contentDiv } }, React.createElement(_DataTable.DataTable, { key: "downloadAssets_" + evidenceGroupId, resizableColumns: !1, value: assets, paginator: !0, rows: 5, first: this.state.first, onPage: function (e) { return _this3.setState({ first: e.first }) } }, React.createElement(_Column.Column, { field: "SNo", header: "SNO", filter: !1, style: { width: "10px" }, sortable: !1, body: this.bodyTemplate }), React.createElement(_Column.Column, { field: "mediaId", header: "Media Id", filter: !1, style: { width: "120px" }, sortable: !1, body: this.bodyTemplate }), React.createElement(_Column.Column, { field: "duration", header: "Duration", filter: !1, style: { width: "40px" }, sortable: !1, body: this.bodyTemplate }), React.createElement(_Column.Column, { field: "FileType", header: "File Type", filter: !1, style: { width: "40px" }, sortable: !1, body: this.bodyTemplate }), React.createElement(_Column.Column, { field: "DownloadPath", header: "Download", filter: !1, style: { width: "40px", overflow: "visible", textAlign: "center" }, sortable: !1, body: this.bodyTemplate }))) } }, { key: "render", value: function () { var show = this.props.show; return React.createElement(IrsaReactModal, { ref: "downloadAssetModal", title: "Asset Downloads", show: show, content: this.getContent(), width: 250, buttons: [{ key: "cancel", text: "Close", width: 90, className: "btn-glow", onClick: this.onCancel }] }) } }]), DownloadAssetModal }(React.Component)); exports.default = DownloadAssetModal, DownloadAssetModal.propTypes = { show: _react.PropTypes.bool, onCancel: _react.PropTypes.func, evidenceGroupId: _react.PropTypes.number } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.DataTable = void 0; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]) } return target }, _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _Paginator = __webpack_require__(86), _TableHeader = __webpack_require__(100), _TableBody = __webpack_require__(105), _TableFooter = __webpack_require__(109), _ScrollableView = __webpack_require__(111), _ObjectUtils = __webpack_require__(95), _ObjectUtils2 = _interopRequireDefault(_ObjectUtils), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler), DataTable = exports.DataTable = function (_Component) { function DataTable(props) { _classCallCheck(this, DataTable); var _this = _possibleConstructorReturn(this, (DataTable.__proto__ || Object.getPrototypeOf(DataTable)).call(this, props)); return _this.state = { first: props.first, rows: props.rows, sortField: props.sortField, sortOrder: props.sortOrder, multiSortMeta: props.multiSortMeta, filters: props.filters }, _this.onPageChange = _this.onPageChange.bind(_this), _this.onSort = _this.onSort.bind(_this), _this.onFilter = _this.onFilter.bind(_this), _this.onColumnResizeStart = _this.onColumnResizeStart.bind(_this), _this.onHeaderCheckboxClick = _this.onHeaderCheckboxClick.bind(_this), _this.onColumnDragStart = _this.onColumnDragStart.bind(_this), _this.onColumnDragOver = _this.onColumnDragOver.bind(_this), _this.onColumnDragLeave = _this.onColumnDragLeave.bind(_this), _this.onColumnDrop = _this.onColumnDrop.bind(_this), _this.onVirtualScroll = _this.onVirtualScroll.bind(_this), _this.frozenSelectionMode = null, _this } return _inherits(DataTable, _Component), _createClass(DataTable, [{ key: "onPageChange", value: function (event) { this.setState({ first: event.first, rows: event.rows }), this.props.lazy && this.props.onLazyLoad({ first: event.first, rows: event.rows, sortField: this.state.sortField, sortOrder: this.state.sortOrder, multiSortMeta: this.state.multiSortMeta, filters: this.state.filters }), this.props.onPage && this.props.onPage(event) } }, { key: "createPaginator", value: function (position, totalRecords, data) { var className = "ui-paginator-" + position; return _react2.default.createElement(_Paginator.Paginator, { first: this.state.first, rows: this.state.rows, pageLinkSize: this.props.pageLinkSize, className: className, onPageChange: this.onPageChange, template: this.props.paginatorTemplate, totalRecords: totalRecords, rowsPerPageOptions: this.props.rowsPerPageOptions, leftContent: this.props.paginatorLeft, rightContent: this.props.paginatorRight }) } }, { key: "onSort", value: function (event) { var sortField = event.sortField, sortOrder = this.state.sortField === event.sortField ? this.state.sortOrder * -1 : 1, multiSortMeta = void 0; if (this.columnSortable = event.sortable, this.columnSortFunction = event.sortFunction, "multiple" === this.props.sortMode) { var metaKey = event.originalEvent.metaKey || event.originalEvent.ctrlKey; multiSortMeta = this.state.multiSortMeta, multiSortMeta && metaKey || (multiSortMeta = []), this.addSortMeta({ field: sortField, order: sortOrder }, multiSortMeta) } this.setState({ sortField: sortField, sortOrder: sortOrder, first: 0, multiSortMeta: multiSortMeta }), this.props.lazy && this.props.onLazyLoad({ first: 0, rows: this.state.rows, sortField: sortField, sortOrder: sortOrder, multiSortMeta: multiSortMeta, filters: this.state.filters }), this.props.onSort && this.props.onSort({ sortField: sortField, sortOrder: sortOrder, multiSortMeta: multiSortMeta }) } }, { key: "addSortMeta", value: function (meta, multiSortMeta) { for (var index = -1, i = 0; i < multiSortMeta.length; i++)if (multiSortMeta[i].field === meta.field) { index = i; break } index >= 0 ? multiSortMeta[index] = meta : multiSortMeta.push(meta) } }, { key: "sortSingle", value: function (data) { var _this2 = this, value = [].concat(_toConsumableArray(data)); return this.columnSortable && "custom" === this.columnSortable && this.columnSortFunction ? value = this.columnSortFunction({ field: this.state.sortField, order: this.state.sortOrder }) : value.sort(function (data1, data2) { var value1 = _ObjectUtils2.default.resolveFieldData(data1, _this2.state.sortField), value2 = _ObjectUtils2.default.resolveFieldData(data2, _this2.state.sortField), result = null; return result = null == value1 && null != value2 ? -1 : null != value1 && null == value2 ? 1 : null == value1 && null == value2 ? 0 : "string" == typeof value1 && "string" == typeof value2 ? value1.localeCompare(value2, void 0, { numeric: !0 }) : value1 < value2 ? -1 : value1 > value2 ? 1 : 0, _this2.state.sortOrder * result }), value } }, { key: "sortMultiple", value: function (data) { var _this3 = this, value = [].concat(_toConsumableArray(data)); return value.sort(function (data1, data2) { return _this3.multisortField(data1, data2, _this3.state.multiSortMeta, 0) }), value } }, { key: "multisortField", value: function (data1, data2, multiSortMeta, index) { var value1 = _ObjectUtils2.default.resolveFieldData(data1, this.state.multiSortMeta[index].field), value2 = _ObjectUtils2.default.resolveFieldData(data2, this.state.multiSortMeta[index].field), result = null; if ("string" == typeof value1 || value1 instanceof String) { if (value1.localeCompare && value1 !== value2) return this.state.multiSortMeta[index].order * value1.localeCompare(value2, void 0, { numeric: !0 }) } else result = value1 < value2 ? -1 : 1; return value1 === value2 ? this.state.multiSortMeta.length - 1 > index ? this.multisortField(data1, data2, this.state.multiSortMeta, index + 1) : 0 : this.state.multiSortMeta[index].order * result } }, { key: "filter", value: function (value, field, mode) { this.onFilter({ value: value, field: field, matchMode: mode }) } }, { key: "onFilter", value: function (event) { var filterMetadata = this.state.filters || {}; this.isFilterBlank(event.value) ? filterMetadata[event.field] && delete filterMetadata[event.field] : filterMetadata[event.field] = { value: event.value, matchMode: event.matchMode }, this.setState({ first: 0, filters: filterMetadata }), this.props.lazy && this.props.onLazyLoad({ first: 0, rows: this.state.rows, sortField: this.state.sortField, sortOrder: this.state.sortOrder, multiSortMeta: this.state.multiSortMeta, filters: filterMetadata }), this.props.onFilter && this.props.onFilter({ filters: filterMetadata }) } }, { key: "isFilterBlank", value: function (filter) { return null === filter || void 0 === filter || ("string" == typeof filter && 0 === filter.trim().length || filter instanceof Array && 0 === filter.length) } }, { key: "componentDidMount", value: function () { this.props.lazy && this.props.onLazyLoad && this.props.onLazyLoad({ first: this.props.first, rows: this.props.rows, sortField: this.props.sortField, sortOrder: this.props.sortOrder, multiSortMeta: this.props.multiSortField, filters: this.props.filters }), this.container.style.width = this.getContainerWidth() } }, { key: "hasFooter", value: function () { if (!this.props.children) return !1; if (this.props.footerColumnGroup) return !0; if (!(this.props.children instanceof Array)) return null !== this.props.children.footer; for (var i = 0; i < this.props.children.length; i++)if (this.props.children[i].footer) return !0 } }, { key: "onColumnResizeStart", value: function (event) { var containerLeft = _DomHandler2.default.getOffset(this.container).left; this.resizeColumn = event.columnEl, this.columnResizing = !0, this.lastResizerHelperX = event.originalEvent.pageX - containerLeft + this.container.scrollLeft, this.bindColumnResizeEvents() } }, { key: "onColumnResize", value: function (event) { var containerLeft = _DomHandler2.default.getOffset(this.container).left; _DomHandler2.default.addClass(this.container, "ui-unselectable-text"), this.resizerHelper.style.height = this.container.offsetHeight + "px", this.resizerHelper.style.top = "0px", this.resizerHelper.style.left = event.pageX - containerLeft + this.container.scrollLeft + "px", this.resizerHelper.style.display = "block" } }, { key: "onColumnResizeEnd", value: function (event) { var delta = this.resizerHelper.offsetLeft - this.lastResizerHelperX, columnWidth = this.resizeColumn.offsetWidth, newColumnWidth = columnWidth + delta, minWidth = this.resizeColumn.style.minWidth || 15; if (columnWidth + delta > parseInt(minWidth, 10)) { if ("fit" === this.props.columnResizeMode) { var nextColumn = this.resizeColumn.nextElementSibling, nextColumnWidth = nextColumn.offsetWidth - delta; if (newColumnWidth > 15 && nextColumnWidth > 15 && (this.resizeColumn.style.width = newColumnWidth + "px", nextColumn && (nextColumn.style.width = nextColumnWidth + "px"), this.props.scrollable)) { var colGroup = _DomHandler2.default.findSingle(this.container, "colgroup.ui-datatable-scrollable-colgroup"), resizeColumnIndex = _DomHandler2.default.index(this.resizeColumn); colGroup.children[resizeColumnIndex].style.width = newColumnWidth + "px", nextColumn && (colGroup.children[resizeColumnIndex + 1].style.width = nextColumnWidth + "px") } } else if ("expand" === this.props.columnResizeMode) { var table = _DomHandler2.default.findSingle(this.container, "tbody.ui-datatable-data").parentElement; table.style.width = table.offsetWidth + delta + "px", this.resizeColumn.style.width = newColumnWidth + "px"; var containerWidth = table.style.width; if (this.props.scrollable) { _DomHandler2.default.findSingle(this.container, ".ui-datatable-scrollable-header-box").children[0].style.width = containerWidth; var _colGroup = _DomHandler2.default.findSingle(this.container, "colgroup.ui-datatable-scrollable-colgroup"), _resizeColumnIndex = _DomHandler2.default.index(this.resizeColumn); _colGroup.children[_resizeColumnIndex].style.width = newColumnWidth + "px" } else this.container.style.width = containerWidth } this.props.onColumnResizeEnd && this.props.onColumnResizeEnd({ element: this.resizeColumn, delta: delta }) } this.resizerHelper.style.display = "none", this.resizeColumn = null, _DomHandler2.default.removeClass(this.container, "ui-unselectable-text"), this.unbindColumnResizeEvents() } }, { key: "bindColumnResizeEvents", value: function () { var _this4 = this; this.documentColumnResizeListener = document.addEventListener("mousemove", function (event) { _this4.columnResizing && _this4.onColumnResize(event) }), this.documentColumnResizeEndListener = document.addEventListener("mouseup", function (event) { _this4.columnResizing && (_this4.columnResizing = !1, _this4.onColumnResizeEnd(event)) }) } }, { key: "unbindColumnResizeEvents", value: function () { document.removeEventListener("document", this.documentColumnResizeListener), document.removeEventListener("document", this.documentColumnResizeEndListener) } }, { key: "findParentHeader", value: function (element) { if ("TH" === element.nodeName) return element; for (var parent = element.parentElement; "TH" !== parent.nodeName && (parent = parent.parentElement);); return parent } }, { key: "onColumnDragStart", value: function (event) { return this.columnResizing ? void event.preventDefault() : (this.iconWidth = _DomHandler2.default.getHiddenElementOuterWidth(this.reorderIndicatorUp), this.iconHeight = _DomHandler2.default.getHiddenElementOuterHeight(this.reorderIndicatorUp), this.draggedColumn = this.findParentHeader(event.target), void event.dataTransfer.setData("text", "b")) } }, { key: "onColumnDragOver", value: function (event) { var dropHeader = this.findParentHeader(event.target); if (this.props.reorderableColumns && this.draggedColumn && dropHeader) { event.preventDefault(); var containerOffset = _DomHandler2.default.getOffset(this.container), dropHeaderOffset = _DomHandler2.default.getOffset(dropHeader); if (this.draggedColumn !== dropHeader) { var targetLeft = dropHeaderOffset.left - containerOffset.left, columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2; this.reorderIndicatorUp.style.top = dropHeaderOffset.top - containerOffset.top - (this.iconHeight - 1) + "px", this.reorderIndicatorDown.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + "px", event.pageX > columnCenter ? (this.reorderIndicatorUp.style.left = targetLeft + dropHeader.offsetWidth - Math.ceil(this.iconWidth / 2) + "px", this.reorderIndicatorDown.style.left = targetLeft + dropHeader.offsetWidth - Math.ceil(this.iconWidth / 2) + "px", this.dropPosition = 1) : (this.reorderIndicatorUp.style.left = targetLeft - Math.ceil(this.iconWidth / 2) + "px", this.reorderIndicatorDown.style.left = targetLeft - Math.ceil(this.iconWidth / 2) + "px", this.dropPosition = -1), this.reorderIndicatorUp.style.display = "block", this.reorderIndicatorDown.style.display = "block" } else event.dataTransfer.dropEffect = "none" } } }, { key: "onColumnDragLeave", value: function (event) { this.props.reorderableColumns && this.draggedColumn && (event.preventDefault(), this.reorderIndicatorUp.style.display = "none", this.reorderIndicatorDown.style.display = "none") } }, { key: "onColumnDrop", value: function (event) { if (event.preventDefault(), this.draggedColumn) { var dragIndex = _DomHandler2.default.index(this.draggedColumn), dropIndex = _DomHandler2.default.index(this.findParentHeader(event.target)), allowDrop = dragIndex !== dropIndex; if (allowDrop && (dropIndex - dragIndex === 1 && this.dropPosition === -1 || dragIndex - dropIndex === 1 && 1 === this.dropPosition) && (allowDrop = !1), allowDrop) { var columns = this.state.columnOrder ? this.getColumns() : _react2.default.Children.toArray(this.props.children); _ObjectUtils2.default.reorderArray(columns, dragIndex, dropIndex); var columnOrder = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for (var _step, _iterator = columns[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) { var column = _step.value; columnOrder.push(column.props.columnKey || column.props.field) } } catch (err) { _didIteratorError = !0, _iteratorError = err } finally { try { !_iteratorNormalCompletion && _iterator.return && _iterator.return() } finally { if (_didIteratorError) throw _iteratorError } } this.setState({ columnOrder: columnOrder }), this.props.onColReorder && this.props.onColReorder({ dragIndex: dragIndex, dropIndex: dropIndex, columns: columns }) } this.reorderIndicatorUp.style.display = "none", this.reorderIndicatorDown.style.display = "none", this.draggedColumn.draggable = !1, this.draggedColumn = null, this.dropPosition = null } } }, { key: "onVirtualScroll", value: function (event) { var _this5 = this; this.virtualScrollTimer && clearTimeout(this.virtualScrollTimer), this.virtualScrollTimer = setTimeout(function () { var first = (event.page - 1) * _this5.props.rows; _this5.setState({ first: first }), _this5.props.lazy && _this5.props.onLazyLoad({ first: first, rows: _this5.state.rows, sortField: _this5.state.sortField, sortOrder: _this5.state.sortOrder, multiSortMeta: _this5.state.multiSortMeta, filters: _this5.state.filters }) }, this.props.virtualScrollDelay) } }, { key: "exportCSV", value: function () { for (var _this6 = this, data = this.processData(), csv = "\ufeff", columns = _react2.default.Children.toArray(this.props.children), i = 0; i < columns.length; i++)columns[i].props.field && (csv += '"' + (columns[i].props.header || columns[i].props.field) + '"', i < columns.length - 1 && (csv += this.props.csvSeparator)); data.forEach(function (record, i) { csv += "\n"; for (var _i = 0; _i < columns.length; _i++)columns[_i].props.field && (csv += '"' + _ObjectUtils2.default.resolveFieldData(record, columns[_i].props.field) + '"', _i < columns.length - 1 && (csv += _this6.props.csvSeparator)) }); var blob = new Blob([csv], { type: "text/csv;charset=utf-8;" }); if (window.navigator.msSaveOrOpenBlob) navigator.msSaveOrOpenBlob(blob, this.props.exportFilename + ".csv"); else { var link = document.createElement("a"); link.style.display = "none", document.body.appendChild(link), void 0 !== link.download ? (link.setAttribute("href", URL.createObjectURL(blob)), link.setAttribute("download", this.props.exportFilename + ".csv"), link.click()) : (csv = "data:text/csv;charset=utf-8," + csv, window.open(encodeURI(csv))), document.body.removeChild(link) } } }, { key: "onHeaderCheckboxClick", value: function (event) { var selection = void 0; selection = event.checked ? [] : [].concat(_toConsumableArray(this.props.value)), this.props.onSelectionChange({ originalEvent: event, data: selection }) } }, { key: "filterLocal", value: function (value) { for (var filteredValue = [], columns = _react2.default.Children.toArray(this.props.children), i = 0; i < value.length; i++) { for (var localMatch = !0, globalMatch = !1, j = 0; j < columns.length; j++) { var col = columns[j], filterMeta = this.state.filters ? this.state.filters[col.props.field] : null; if (filterMeta) { var filterValue = filterMeta.value, filterField = col.props.field, filterMatchMode = filterMeta.matchMode || col.props.filterMatchMode, dataFieldValue = _ObjectUtils2.default.resolveFieldData(value[i], filterField), filterConstraint = "custom" === filterMatchMode ? col.props.filterFunction : _ObjectUtils2.default.filterConstraints[filterMatchMode]; if (filterConstraint(dataFieldValue, filterValue) || (localMatch = !1), !localMatch) break } this.props.globalFilter && !globalMatch && (globalMatch = _ObjectUtils2.default.filterConstraints.contains(_ObjectUtils2.default.resolveFieldData(value[i], col.props.field), this.props.globalFilter)) } var matches = localMatch; this.props.globalFilter && (matches = localMatch && globalMatch), matches && filteredValue.push(value[i]) } return filteredValue.length === value.length && (filteredValue = value), filteredValue } }, { key: "processData", value: function () { var data = this.props.value; return this.props.lazy || data && data.length && ((this.state.sortField || this.state.multiSortMeta) && ("single" === this.props.sortMode ? data = this.sortSingle(data) : "multiple" === this.props.sortMode && (data = this.sortMultiple(data))), (this.state.filters || this.props.globalFilter) && (data = this.filterLocal(data))), data } }, { key: "isAllSelected", value: function () { return this.props.selection && this.props.value && this.props.selection.length === this.props.value.length } }, { key: "getFrozenColumns", value: function (columns) { var frozenColumns = null, _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0; try { for (var _step2, _iterator2 = columns[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) { var col = _step2.value; col.props.frozen && (frozenColumns = frozenColumns || [], frozenColumns.push(col)) } } catch (err) { _didIteratorError2 = !0, _iteratorError2 = err } finally { try { !_iteratorNormalCompletion2 && _iterator2.return && _iterator2.return() } finally { if (_didIteratorError2) throw _iteratorError2 } } return frozenColumns } }, { key: "getContainerWidth", value: function () { return this.props.scrollable ? this.props.scrollWidth ? this.props.scrollWidth : this.props.frozenWidth && this.props.unfrozenWidth ? parseFloat(this.props.frozenWidth) + parseFloat(this.props.unfrozenWidth) + "px" : void 0 : this.props.style ? this.props.style.width : null } }, { key: "getScrollableColumns", value: function (columns) { var scrollableColumns = null, _iteratorNormalCompletion3 = !0, _didIteratorError3 = !1, _iteratorError3 = void 0; try { for (var _step3, _iterator3 = columns[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = !0) { var col = _step3.value; col.props.frozen || (scrollableColumns = scrollableColumns || [], scrollableColumns.push(col)) } } catch (err) { _didIteratorError3 = !0, _iteratorError3 = err } finally { try { !_iteratorNormalCompletion3 && _iterator3.return && _iterator3.return() } finally { if (_didIteratorError3) throw _iteratorError3 } } return scrollableColumns } }, { key: "getFrozenSelectionModeInColumn", value: function (columns) { if (Array.isArray(columns)) { var _iteratorNormalCompletion4 = !0, _didIteratorError4 = !1, _iteratorError4 = void 0; try { for (var _step4, _iterator4 = columns[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = !0) { var col = _step4.value; if (col.props.selectionMode) return col.props.selectionMode } } catch (err) { _didIteratorError4 = !0, _iteratorError4 = err } finally { try { !_iteratorNormalCompletion4 && _iterator4.return && _iterator4.return() } finally { if (_didIteratorError4) throw _iteratorError4 } } } return null } }, { key: "createTableHeader", value: function (columns, columnGroup) { return _react2.default.createElement(_TableHeader.TableHeader, { onSort: this.onSort, sortField: this.state.sortField, sortOrder: this.state.sortOrder, multiSortMeta: this.state.multiSortMeta, columnGroup: columnGroup, resizableColumns: this.props.resizableColumns, onColumnResizeStart: this.onColumnResizeStart, onFilter: this.onFilter, onHeaderCheckboxClick: this.onHeaderCheckboxClick, headerCheckboxSelected: this.isAllSelected(), reorderableColumns: this.props.reorderableColumns, onColumnDragStart: this.onColumnDragStart, filters: this.state.filters, onColumnDragOver: this.onColumnDragOver, onColumnDragLeave: this.onColumnDragLeave, onColumnDrop: this.onColumnDrop }, columns) } }, { key: "createTableBody", value: function (value, columns) { return _react2.default.createElement(_TableBody.TableBody, { value: value, first: this.state.first, rows: this.state.rows, lazy: this.props.lazy, dataKey: this.props.dataKey, compareSelectionBy: this.props.compareSelectionBy, selectionMode: this.props.selectionMode, selection: this.props.selection, metaKeySelection: this.props.metaKeySelection, frozenSelectionMode: this.frozenSelectionMode, onSelectionChange: this.props.onSelectionChange, onRowClick: this.props.onRowClick, onRowDoubleClick: this.props.onRowDoubleClick, onRowSelect: this.props.onRowSelect, onRowUnselect: this.props.onRowUnselect, expandedRows: this.props.expandedRows, onRowToggle: this.props.onRowToggle, rowExpansionTemplate: this.props.rowExpansionTemplate, onRowExpand: this.props.onRowExpand, responsive: this.props.responsive, emptyMessage: this.props.emptyMessage, contextMenu: this.props.contextMenu, onContextMenuSelect: this.props.onContextMenuSelect, virtualScroll: this.props.virtualScroll, groupField: this.props.groupField, rowGroupMode: this.props.rowGroupMode, rowGroupHeaderTemplate: this.props.rowGroupHeaderTemplate, rowGroupFooterTemplate: this.props.rowGroupFooterTemplate, sortField: this.state.sortField, rowClassName: this.props.rowClassName, onRowReorder: this.props.onRowReorder }, columns) } }, { key: "createTableFooter", value: function (columns, columnGroup) { return this.hasFooter() ? _react2.default.createElement(_TableFooter.TableFooter, { columnGroup: columnGroup }, columns) : null } }, { key: "createScrollableView", value: function (value, columns, frozen, headerColumnGroup, footerColumnGroup, totalRecords) { return _react2.default.createElement(_ScrollableView.ScrollableView, { columns: columns, header: this.createTableHeader(columns, headerColumnGroup), body: this.createTableBody(value, columns), frozenBody: this.props.frozenValue ? this.createTableBody(this.props.frozenValue, columns) : null, footer: this.createTableFooter(columns, footerColumnGroup), scrollHeight: this.props.scrollHeight, frozen: frozen, frozenWidth: this.props.frozenWidth, unfrozenWidth: this.props.unfrozenWidth, virtualScroll: this.props.virtualScroll, rows: this.props.rows, totalRecords: totalRecords, onVirtualScroll: this.onVirtualScroll }) } }, { key: "getColumns", value: function () { var columns = _react2.default.Children.toArray(this.props.children); if (this.props.reorderableColumns && this.state.columnOrder) { var orderedColumns = [], _iteratorNormalCompletion5 = !0, _didIteratorError5 = !1, _iteratorError5 = void 0; try { for (var _step5, _iterator5 = this.state.columnOrder[Symbol.iterator](); !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = !0) { var columnKey = _step5.value; orderedColumns.push(this.findColumnByKey(columns, columnKey)) } } catch (err) { _didIteratorError5 = !0, _iteratorError5 = err } finally { try { !_iteratorNormalCompletion5 && _iterator5.return && _iterator5.return() } finally { if (_didIteratorError5) throw _iteratorError5 } } return orderedColumns } return columns } }, { key: "findColumnByKey", value: function (columns, key) { if (columns && columns.length) for (var i = 0; i < columns.length; i++) { var child = columns[i]; if (child.props.columnKey === key || child.props.field === key) return child } return null } }, { key: "getTotalRecords", value: function (data) { return this.props.lazy ? this.props.totalRecords : data ? data.length : 0 } }, { key: "renderLoader", value: function () { var iconClassName = (0, _classnames2.default)("ui-datatable-loading-icon pi-spin", this.props.loadingIcon); return _react2.default.createElement("div", { className: "ui-datatable-loader" }, _react2.default.createElement("div", { className: "ui-datatable-loader-overlay ui-widget-overlay" }), _react2.default.createElement("div", { className: "ui-datatable-loader-content" }, _react2.default.createElement("i", { className: iconClassName }))) } }, { key: "render", value: function () { var _this7 = this, value = this.processData(), columns = this.getColumns(), totalRecords = this.getTotalRecords(value), className = (0, _classnames2.default)("ui-datatable ui-widget", { "ui-datatable-reflow": this.props.responsive, "ui-datatable-resizable": this.props.resizableColumns, "ui-datatable-scrollable": this.props.scrollable, "ui-datatable-virtual-scrollable": this.props.virtualScroll, "ui-datatable-auto-layout": this.props.autoLayout }, this.props.className), paginatorTop = this.props.paginator && "bottom" !== this.props.paginatorPosition && this.createPaginator("top", totalRecords), paginatorBottom = this.props.paginator && "top" !== this.props.paginatorPosition && this.createPaginator("bottom", totalRecords), headerFacet = this.props.header && _react2.default.createElement("div", { className: "ui-datatable-header ui-widget-header" }, this.props.header), footerFacet = this.props.footer && _react2.default.createElement("div", { className: "ui-datatable-footer ui-widget-header" }, this.props.footer), resizeHelper = this.props.resizableColumns && _react2.default.createElement("div", { ref: function (el) { _this7.resizerHelper = el }, className: "ui-column-resizer-helper ui-state-highlight", style: { display: "none" } }), tableContent = null, resizeIndicatorUp = this.props.reorderableColumns && _react2.default.createElement("span", { ref: function (el) { _this7.reorderIndicatorUp = el }, className: "pi pi-arrow-down ui-datatable-reorder-indicator-up", style: { position: "absolute", display: "none" } }), resizeIndicatorDown = this.props.reorderableColumns && _react2.default.createElement("span", { ref: function (el) { _this7.reorderIndicatorDown = el }, className: "pi pi-arrow-up ui-datatable-reorder-indicator-down", style: { position: "absolute", display: "none" } }), loader = void 0; if (this.props.loading && (loader = this.renderLoader()), this.props.scrollable) { this.frozenSelectionMode = this.frozenSelectionMode || this.getFrozenSelectionModeInColumn(columns); var frozenColumns = this.getFrozenColumns(columns), scrollableColumns = frozenColumns ? this.getScrollableColumns(columns) : columns, frozenView = void 0, scrollableView = void 0; frozenColumns && (frozenView = this.createScrollableView(value, frozenColumns, !0, this.props.frozenHeaderColumnGroup, this.props.frozenFooterColumnGroup, totalRecords)), scrollableView = this.createScrollableView(value, scrollableColumns, !1, this.props.headerColumnGroup, this.props.footerColumnGroup, totalRecords), tableContent = _react2.default.createElement("div", { className: "ui-datatable-scrollable-wrapper" }, frozenView, scrollableView) } else { var tableHeader = this.createTableHeader(columns, this.props.headerColumnGroup), tableBody = this.createTableBody(value, columns), tableFooter = this.createTableFooter(columns, this.props.footerColumnGroup); tableContent = _react2.default.createElement("div", { className: "ui-datatable-tablewrapper" }, _react2.default.createElement("table", { style: this.props.tableStyle, className: this.props.tableClassName, ref: function (el) { _this7.table = el } }, tableHeader, tableFooter, tableBody)) } return _react2.default.createElement("div", { id: this.props.id, className: className, style: this.props.style, ref: function (el) { _this7.container = el } }, loader, headerFacet, paginatorTop, tableContent, paginatorBottom, footerFacet, resizeHelper, resizeIndicatorUp, resizeIndicatorDown) } }], [{ key: "getDerivedStateFromProps", value: function (nextProps, prevState) { var state = {}; return null !== nextProps.first && nextProps.first !== prevState.first && (state = _extends({}, state, { first: nextProps.first })), null !== nextProps.rows && nextProps.rows !== prevState.rows && (state = _extends({}, state, { rows: nextProps.rows })), nextProps.sortField && nextProps.sortField !== prevState.sortField && (state = _extends({}, state, { sortField: nextProps.sortField })), nextProps.sortOrder && nextProps.sortOrder !== prevState.sortOrder && (state = _extends({}, state, { sortOrder: nextProps.sortOrder })), nextProps.multiSortMeta && nextProps.multiSortMeta !== prevState.multiSortMeta && (state = _extends({}, state, { multiSortMeta: nextProps.multiSortMeta })), nextProps.filters && nextProps.filters !== prevState.filters && (state = _extends({}, state, { filters: nextProps.filters })), null !== nextProps.globalFilter && (state = _extends({}, state, { first: 0 })), Object.keys(state).length > 0 ? state : null } }]), DataTable }(_react.Component); DataTable.defaultProps = { id: null, value: null, header: null, footer: null, style: null, className: null, tableStyle: null, tableClassName: null, paginator: !1, paginatorPosition: "bottom", alwaysShowPaginator: !0, paginatorTemplate: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown", paginatorLeft: null, paginatorRight: null, pageLinkSize: 5, first: null, rows: null, totalRecords: null, rowsPerPageOptions: null, lazy: !1, sortField: null, sortOrder: null, multiSortMeta: null, sortMode: "single", emptyMessage: "No records found", selectionMode: null, selection: null, onSelectionChange: null, compareSelectionBy: "deepEquals", dataKey: null, metaKeySelection: !0, headerColumnGroup: null, footerColumnGroup: null, frozenHeaderColumnGroup: null, frozenFooterColumnGroup: null, rowExpansionTemplate: null, expandedRows: null, onRowToggle: null, responsive: !1, resizableColumns: !1, columnResizeMode: "fit", reorderableColumns: !1, filters: null, globalFilter: null, scrollable: !1, scrollHeight: null, virtualScroll: !1, virtualScrollDelay: 500, frozenWidth: null, unfrozenWidth: null, frozenValue: null, csvSeparator: ",", exportFilename: "download", contextMenu: null, rowGroupMode: null, rowClassName: null, rowGroupHeaderTemplate: null, rowGroupFooterTemplate: null, loading: !1, loadingIcon: "pi pi-circle-o-notch", autoLayout: !1, onColumnResizeEnd: null, onSort: null, onPage: null, onFilter: null, onLazyLoad: null, onRowClick: null, onRowDoubleClick: null, onRowSelect: null, onRowUnselect: null, onRowExpand: null, onRowCollapse: null, onContextMenuSelect: null, onColReorder: null, onRowReorder: null }, DataTable.propTypes = { id: _propTypes2.default.string, value: _propTypes2.default.array, header: _propTypes2.default.any, footer: _propTypes2.default.any, style: _propTypes2.default.object, className: _propTypes2.default.string, tableStyle: _propTypes2.default.any, tableClassName: _propTypes2.default.string, paginator: _propTypes2.default.bool, paginatorPosition: _propTypes2.default.string, alwaysShowPaginator: _propTypes2.default.bool, paginatorTemplate: _propTypes2.default.string, paginatorLeft: _propTypes2.default.any, paginatorRight: _propTypes2.default.any, pageLinkSize: _propTypes2.default.number, first: _propTypes2.default.number, rows: _propTypes2.default.number, totalRecords: _propTypes2.default.number, rowsPerPageOptions: _propTypes2.default.array, lazy: _propTypes2.default.bool, sortField: _propTypes2.default.string, sortOrder: _propTypes2.default.number, multiSortMeta: _propTypes2.default.array, sortMode: _propTypes2.default.string, emptyMessage: _propTypes2.default.string, selectionMode: _propTypes2.default.string, selection: _propTypes2.default.any, onSelectionChange: _propTypes2.default.func, compareSelectionBy: _propTypes2.default.string, dataKey: _propTypes2.default.string, metaKeySelection: _propTypes2.default.bool, headerColumnGroup: _propTypes2.default.element, footerColumnGroup: _propTypes2.default.element, frozenHeaderColumnGroup: _propTypes2.default.element, frozenFooterColumnGroup: _propTypes2.default.element, rowExpansionTemplate: _propTypes2.default.func, expandedRows: _propTypes2.default.array, onRowToggle: _propTypes2.default.func, responsive: _propTypes2.default.bool, resizableColumns: _propTypes2.default.bool, columnResizeMode: _propTypes2.default.string, reorderableColumns: _propTypes2.default.bool, filters: _propTypes2.default.object, globalFilter: _propTypes2.default.any, scrollable: _propTypes2.default.bool, scrollHeight: _propTypes2.default.string, virtualScroll: _propTypes2.default.bool, virtualScrollDelay: _propTypes2.default.number, frozenWidth: _propTypes2.default.string, unfrozenWidth: _propTypes2.default.string, frozenValue: _propTypes2.default.array, csvSeparator: _propTypes2.default.string, exportFilename: _propTypes2.default.string, contextMenu: _propTypes2.default.any, rowGroupMode: _propTypes2.default.string, rowClassName: _propTypes2.default.func, rowGroupHeaderTemplate: _propTypes2.default.func, rowGroupFooterTemplate: _propTypes2.default.func, loading: _propTypes2.default.bool, loadingIcon: _propTypes2.default.string, autoLayout: _propTypes2.default.bool, onColumnResizeEnd: _propTypes2.default.func, onSort: _propTypes2.default.func, onPage: _propTypes2.default.func, onFilter: _propTypes2.default.func, onLazyLoad: _propTypes2.default.func, onRowClick: _propTypes2.default.func, onRowDoubleClick: _propTypes2.default.func, onRowSelect: _propTypes2.default.func, onRowUnselect: _propTypes2.default.func, onRowExpand: _propTypes2.default.func, onRowCollapse: _propTypes2.default.func, onContextMenuSelect: _propTypes2.default.func, onColReorder: _propTypes2.default.func, onRowReorder: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { module.exports = __webpack_require__(83)() }, function(module, exports, __webpack_require__) { "use strict"; function emptyFunction() { } function emptyFunctionWithReset() { } var ReactPropTypesSecret = __webpack_require__(84); emptyFunctionWithReset.resetWarningCache = emptyFunction, module.exports = function () { function shim(props, propName, componentName, location, propFullName, secret) { if (secret !== ReactPropTypesSecret) { var err = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"); throw err.name = "Invariant Violation", err } } function getShim() { return shim } shim.isRequired = shim; var ReactPropTypes = { array: shim, bigint: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim, checkPropTypes: emptyFunctionWithReset, resetWarningCache: emptyFunction }; return ReactPropTypes.PropTypes = ReactPropTypes, ReactPropTypes } }, function(module, exports) { "use strict"; var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; module.exports = ReactPropTypesSecret }, function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function () { "use strict"; function classNames() { for (var classes = [], i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (arg) { var argType = typeof arg; if ("string" === argType || "number" === argType) classes.push(arg); else if (Array.isArray(arg)) { if (arg.length) { var inner = classNames.apply(null, arg); inner && classes.push(inner) } } else if ("object" === argType) { if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) { classes.push(arg.toString()); continue } for (var key in arg) hasOwn.call(arg, key) && arg[key] && classes.push(key) } } } return classes.join(" ") } var hasOwn = {}.hasOwnProperty; "undefined" != typeof module && module.exports ? (classNames.default = classNames, module.exports = classNames) : (__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { return classNames }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), !(void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))) }() }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.Paginator = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _FirstPageLink = __webpack_require__(87), _NextPageLink = __webpack_require__(88), _PrevPageLink = __webpack_require__(89), _LastPageLink = __webpack_require__(90), _PageLinks = __webpack_require__(91), _RowsPerPageDropdown = __webpack_require__(92), _CurrentPageReport = __webpack_require__(99), Paginator = exports.Paginator = function (_Component) { function Paginator(props) { _classCallCheck(this, Paginator); var _this = _possibleConstructorReturn(this, (Paginator.__proto__ || Object.getPrototypeOf(Paginator)).call(this, props)); return _this.changePageToFirst = _this.changePageToFirst.bind(_this), _this.changePageToPrev = _this.changePageToPrev.bind(_this), _this.changePageToNext = _this.changePageToNext.bind(_this), _this.changePageToLast = _this.changePageToLast.bind(_this), _this.onRowsChange = _this.onRowsChange.bind(_this), _this.onPageLinkClick = _this.onPageLinkClick.bind(_this), _this } return _inherits(Paginator, _Component), _createClass(Paginator, [{ key: "isFirstPage", value: function () { return 0 === this.getPage() } }, { key: "isLastPage", value: function () { return this.getPage() === this.getPageCount() - 1 } }, { key: "getPageCount", value: function () { return Math.ceil(this.props.totalRecords / this.props.rows) || 1 } }, { key: "calculatePageLinkBoundaries", value: function () { var numberOfPages = this.getPageCount(), visiblePages = Math.min(this.props.pageLinkSize, numberOfPages), start = Math.max(0, Math.ceil(this.getPage() - visiblePages / 2)), end = Math.min(numberOfPages - 1, start + visiblePages - 1), delta = this.props.pageLinkSize - (end - start + 1); return start = Math.max(0, start - delta), [start, end] } }, { key: "updatePageLinks", value: function () { for (var pageLinks = [], boundaries = this.calculatePageLinkBoundaries(), start = boundaries[0], end = boundaries[1], i = start; i <= end; i++)pageLinks.push(i + 1); return pageLinks } }, { key: "changePage", value: function (first, rows) { var pc = this.getPageCount(), p = Math.floor(first / rows); if (p >= 0 && p < pc) { var newPageState = { first: first, rows: rows, page: p, pageCount: pc }; this.props.onPageChange && this.props.onPageChange(newPageState) } } }, { key: "getPage", value: function () { return Math.floor(this.props.first / this.props.rows) } }, { key: "changePageToFirst", value: function (event) { this.changePage(0, this.props.rows), event.preventDefault() } }, { key: "changePageToPrev", value: function (event) { this.changePage(this.props.first - this.props.rows, this.props.rows), event.preventDefault() } }, { key: "onPageLinkClick", value: function (event) { this.changePage((event.value - 1) * this.props.rows, this.props.rows) } }, { key: "changePageToNext", value: function (event) { this.changePage(this.props.first + this.props.rows, this.props.rows), event.preventDefault() } }, { key: "changePageToLast", value: function (event) { this.changePage((this.getPageCount() - 1) * this.props.rows, this.props.rows), event.preventDefault() } }, { key: "onRowsChange", value: function (event) { this.changePage(0, event.value) } }, { key: "render", value: function () { var _this2 = this, className = (0, _classnames2.default)("ui-paginator ui-widget ui-widget-header ui-unselectable-text", this.props.className), paginatorElements = this.props.template.split(" ").map(function (value) { var key = value.trim(), element = void 0; switch (key) { case "FirstPageLink": element = _react2.default.createElement(_FirstPageLink.FirstPageLink, { key: key, onClick: _this2.changePageToFirst, disabled: _this2.isFirstPage() }); break; case "PrevPageLink": element = _react2.default.createElement(_PrevPageLink.PrevPageLink, { key: key, onClick: _this2.changePageToPrev, disabled: _this2.isFirstPage() }); break; case "NextPageLink": element = _react2.default.createElement(_NextPageLink.NextPageLink, { key: key, onClick: _this2.changePageToNext, disabled: _this2.isLastPage() }); break; case "LastPageLink": element = _react2.default.createElement(_LastPageLink.LastPageLink, { key: key, onClick: _this2.changePageToLast, disabled: _this2.isLastPage() }); break; case "PageLinks": element = _react2.default.createElement(_PageLinks.PageLinks, { key: key, value: _this2.updatePageLinks(), page: _this2.getPage(), onClick: _this2.onPageLinkClick }); break; case "RowsPerPageDropdown": element = _react2.default.createElement(_RowsPerPageDropdown.RowsPerPageDropdown, { key: key, value: _this2.props.rows, options: _this2.props.rowsPerPageOptions, onChange: _this2.onRowsChange }); break; case "CurrentPageReport": element = _react2.default.createElement(_CurrentPageReport.CurrentPageReport, { key: key, page: _this2.getPage(), pageCount: _this2.getPageCount() }); break; default: element = null }return element }), leftContent = this.props.leftContent && _react2.default.createElement("div", { className: "ui-paginator-left-content" }, this.props.leftContent), rightContent = this.props.rightContent && _react2.default.createElement("div", { className: "ui-paginator-right-content" }, this.props.rightContent); return _react2.default.createElement("div", { className: className, style: this.props.style }, leftContent, paginatorElements, rightContent) } }]), Paginator }(_react.Component); Paginator.defaultProps = { totalRecords: 0, rows: 0, first: 0, pageLinkSize: 5, rowsPerPageOptions: null, style: null, className: null, template: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown", onPageChange: null, leftContent: null, rightContent: null }, Paginator.propsTypes = { totalRecords: _propTypes2.default.number, rows: _propTypes2.default.number, first: _propTypes2.default.number, pageLinkSize: _propTypes2.default.number, rowsPerPageOptions: _propTypes2.default.array, style: _propTypes2.default.object, className: _propTypes2.default.string, template: _propTypes2.default.string, onPageChange: _propTypes2.default.func, leftContent: _propTypes2.default.any, rightContent: _propTypes2.default.any } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.FirstPageLink = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), FirstPageLink = exports.FirstPageLink = function (_Component) { function FirstPageLink() { return _classCallCheck(this, FirstPageLink), _possibleConstructorReturn(this, (FirstPageLink.__proto__ || Object.getPrototypeOf(FirstPageLink)).apply(this, arguments)) } return _inherits(FirstPageLink, _Component), _createClass(FirstPageLink, [{ key: "render", value: function () { var className = (0, _classnames2.default)("ui-paginator-first ui-paginator-element ui-state-default ui-corner-all", { "ui-state-disabled": this.props.disabled }); return _react2.default.createElement("a", { className: className, onClick: this.props.onClick, tabIndex: this.props.disabled ? -1 : null }, _react2.default.createElement("span", { className: "ui-paginator-icon pi pi-step-backward" })) } }]), FirstPageLink }(_react.Component); FirstPageLink.defaultProps = { disabled: !1, onClick: null }, FirstPageLink.propsTypes = { disabled: _propTypes2.default.bool, onClick: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.NextPageLink = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), NextPageLink = exports.NextPageLink = function (_Component) { function NextPageLink() { return _classCallCheck(this, NextPageLink), _possibleConstructorReturn(this, (NextPageLink.__proto__ || Object.getPrototypeOf(NextPageLink)).apply(this, arguments)) } return _inherits(NextPageLink, _Component), _createClass(NextPageLink, [{ key: "render", value: function () { var className = (0, _classnames2.default)("ui-paginator-next ui-paginator-element ui-state-default ui-corner-all", { "ui-state-disabled": this.props.disabled }); return _react2.default.createElement("a", { className: className, onClick: this.props.onClick, tabIndex: this.props.disabled ? -1 : null }, _react2.default.createElement("span", { className: "ui-paginator-icon pi pi-caret-right" })) } }]), NextPageLink }(_react.Component); NextPageLink.defaultProps = { disabled: !1, onClick: null }, NextPageLink.propsTypes = { disabled: _propTypes2.default.bool, onClick: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.PrevPageLink = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), PrevPageLink = exports.PrevPageLink = function (_Component) { function PrevPageLink() { return _classCallCheck(this, PrevPageLink), _possibleConstructorReturn(this, (PrevPageLink.__proto__ || Object.getPrototypeOf(PrevPageLink)).apply(this, arguments)) } return _inherits(PrevPageLink, _Component), _createClass(PrevPageLink, [{ key: "render", value: function () { var className = (0, _classnames2.default)("ui-paginator-prev ui-paginator-element ui-state-default ui-corner-all", { "ui-state-disabled": this.props.disabled }); return _react2.default.createElement("a", { className: className, onClick: this.props.onClick, tabIndex: this.props.disabled ? -1 : null }, _react2.default.createElement("span", { className: "ui-paginator-icon pi pi-caret-left" })) } }]), PrevPageLink }(_react.Component); PrevPageLink.defaultProps = { disabled: !1, onClick: null }, PrevPageLink.propsTypes = { disabled: _propTypes2.default.bool, onClick: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.LastPageLink = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), LastPageLink = exports.LastPageLink = function (_Component) { function LastPageLink() { return _classCallCheck(this, LastPageLink), _possibleConstructorReturn(this, (LastPageLink.__proto__ || Object.getPrototypeOf(LastPageLink)).apply(this, arguments)) } return _inherits(LastPageLink, _Component), _createClass(LastPageLink, [{ key: "render", value: function () { var className = (0, _classnames2.default)("ui-paginator-last ui-paginator-element ui-state-default ui-corner-all", { "ui-state-disabled": this.props.disabled }); return _react2.default.createElement("a", { className: className, onClick: this.props.onClick, tabIndex: this.props.disabled ? -1 : null }, _react2.default.createElement("span", { className: "ui-paginator-icon pi pi-step-forward" })) } }]), LastPageLink }(_react.Component); LastPageLink.defaultProps = { disabled: !1, onClick: null }, LastPageLink.propsTypes = { disabled: _propTypes2.default.bool, onClick: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.PageLinks = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), PageLinks = exports.PageLinks = function (_Component) { function PageLinks() { return _classCallCheck(this, PageLinks), _possibleConstructorReturn(this, (PageLinks.__proto__ || Object.getPrototypeOf(PageLinks)).apply(this, arguments)) } return _inherits(PageLinks, _Component), _createClass(PageLinks, [{ key: "onPageLinkClick", value: function (event, pageLink) { this.props.onClick && this.props.onClick({ originalEvent: event, value: pageLink }), event.preventDefault() } }, { key: "render", value: function () { var _this2 = this, elements = this.props.value.map(function (pageLink, i) { var pageClassName = (0, _classnames2.default)("ui-paginator-page ui-paginator-element ui-state-default ui-corner-all", { "ui-state-active": pageLink - 1 === _this2.props.page }); return _react2.default.createElement("a", { key: pageLink, className: pageClassName, onClick: function (e) { return _this2.onPageLinkClick(e, pageLink) } }, pageLink) }); return _react2.default.createElement("span", { className: "ui-paginator-pages" }, elements) } }]), PageLinks }(_react.Component); PageLinks.defaultProps = { value: null, page: null, links: null }, PageLinks.propsTypes = { value: _propTypes2.default.array, page: _propTypes2.default.number, onClick: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.RowsPerPageDropdown = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _Dropdown = __webpack_require__(93), RowsPerPageDropdown = exports.RowsPerPageDropdown = function (_Component) { function RowsPerPageDropdown() { return _classCallCheck(this, RowsPerPageDropdown), _possibleConstructorReturn(this, (RowsPerPageDropdown.__proto__ || Object.getPrototypeOf(RowsPerPageDropdown)).apply(this, arguments)) } return _inherits(RowsPerPageDropdown, _Component), _createClass(RowsPerPageDropdown, [{ key: "render", value: function () { if (this.props.options) { var options = this.props.options.map(function (opt, i) { return { label: opt, value: opt } }); return _react2.default.createElement(_Dropdown.Dropdown, { value: this.props.value, options: options, onChange: this.props.onChange }) } return null } }]), RowsPerPageDropdown }(_react.Component); RowsPerPageDropdown.defaultProps = { options: null, value: null, onChange: null }, RowsPerPageDropdown.propsTypes = { options: _propTypes2.default.array, value: _propTypes2.default.number, onChange: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.Dropdown = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler), _ObjectUtils = __webpack_require__(95), _ObjectUtils2 = _interopRequireDefault(_ObjectUtils), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _DropdownPanel = __webpack_require__(96), _DropdownItem = __webpack_require__(98), Dropdown = exports.Dropdown = function (_Component) { function Dropdown(props) { _classCallCheck(this, Dropdown); var _this = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, props)); return _this.state = { filter: "" }, _this.onClick = _this.onClick.bind(_this), _this.onInputFocus = _this.onInputFocus.bind(_this), _this.onInputBlur = _this.onInputBlur.bind(_this), _this.onInputKeyDown = _this.onInputKeyDown.bind(_this), _this.onEditableInputClick = _this.onEditableInputClick.bind(_this), _this.onEditableInputChange = _this.onEditableInputChange.bind(_this), _this.onEditableInputFocus = _this.onEditableInputFocus.bind(_this), _this.onOptionClick = _this.onOptionClick.bind(_this), _this.onFilterInputChange = _this.onFilterInputChange.bind(_this), _this.onFilterInputKeyDown = _this.onFilterInputKeyDown.bind(_this), _this.panelClick = _this.panelClick.bind(_this), _this.clear = _this.clear.bind(_this), _this } return _inherits(Dropdown, _Component), _createClass(Dropdown, [{ key: "onClick", value: function (event) { var _this2 = this; if (!this.props.disabled) { this.documentClickListener && (this.selfClick = !0); var clearClick = _DomHandler2.default.hasClass(event.target, "ui-dropdown-clear-icon"); this.overlayClick || this.editableInputClick || clearClick || (this.focusInput.focus(), this.panel.element.offsetParent ? this.hide() : (this.show(), this.props.filter && setTimeout(function () { _this2.filterInput.focus() }, 200))), this.editableInputClick && (this.expeditableInputClick = !1) } } }, { key: "panelClick", value: function () { this.overlayClick = !0 } }, { key: "onInputFocus", value: function (event) { _DomHandler2.default.addClass(this.container, "ui-state-focus") } }, { key: "onInputBlur", value: function (event) { _DomHandler2.default.removeClass(this.container, "ui-state-focus") } }, { key: "onUpKey", value: function (event) { if (!this.panel.element.offsetParent && event.altKey) this.show(); else { var selectedItemIndex = this.findOptionIndex(this.props.value); if (selectedItemIndex !== -1) { var nextItemIndex = selectedItemIndex + 1; nextItemIndex !== this.props.options.length && this.selectItem({ originalEvent: event, option: this.props.options[nextItemIndex] }) } selectedItemIndex === -1 && this.selectItem({ originalEvent: event, option: this.props.options[0] }) } event.preventDefault() } }, { key: "onDownKey", value: function (event) { var selectedItemIndex = this.findOptionIndex(this.props.value); if (selectedItemIndex > 0) { var prevItemIndex = selectedItemIndex - 1; this.selectItem({ originalEvent: event, option: this.props.options[prevItemIndex] }) } event.preventDefault() } }, { key: "onInputKeyDown", value: function (event) { switch (event.which) { case 40: this.onUpKey(event); break; case 38: this.onDownKey(event); break; case 32: this.panel.element.offsetParent || (this.show(), event.preventDefault()); break; case 13: this.hide(), this.unbindDocumentClickListener(), event.preventDefault(); break; case 27: case 9: this.hide(), this.unbindDocumentClickListener() } } }, { key: "onEditableInputClick", value: function (event) { this.editableInputClick = !0, this.bindDocumentClickListener() } }, { key: "onEditableInputChange", value: function (event) { this.props.onChange({ originalEvent: event.originalEvent, value: event.target.value }) } }, { key: "onEditableInputFocus", value: function (event) { _DomHandler2.default.addClass(this.container, "ui-state-focus"), this.hide() } }, { key: "onOptionClick", value: function (event) { this.selectItem(event), this.focusInput.focus(), this.hide(), event.originalEvent.stopPropagation() } }, { key: "onFilterInputChange", value: function (event) { this.setState({ filter: event.target.value }) } }, { key: "onFilterInputKeyDown", value: function (event) { switch (event.which) { case 40: this.onUpKey(event); break; case 38: this.onDownKey(event); break; case 13: event.preventDefault() } } }, { key: "clear", value: function (event) { this.props.onChange({ originalEvent: event, value: null }), this.updateEditableLabel() } }, { key: "selectItem", value: function (event) { var selectedOption = this.findOption(this.props.value); selectedOption !== event.option && (this.updateEditableLabel(event.option), this.props.onChange({ originalEvent: event.originalEvent, value: this.props.optionLabel ? event.option : event.option.value })) } }, { key: "findOptionIndex", value: function (value) { var index = -1; if (this.props.options) for (var i = 0; i < this.props.options.length; i++) { var optionValue = this.props.optionLabel ? this.props.options[i] : this.props.options[i].value; if (null === value && null == optionValue || _ObjectUtils2.default.equals(value, optionValue, this.props.dataKey)) { index = i; break } } return index } }, { key: "findOption", value: function (value) { var index = this.findOptionIndex(value); return index !== -1 ? this.props.options[index] : null } }, { key: "show", value: function () { this.panel.element.style.zIndex = String(_DomHandler2.default.generateZIndex()), this.panel.element.style.display = "block", this.alignPanel(), _DomHandler2.default.fadeIn(this.panel.element, 250), this.bindDocumentClickListener() } }, { key: "hide", value: function () { this.panel.element.style.display = "none", this.unbindDocumentClickListener(), this.clearClickState() } }, { key: "alignPanel", value: function () { this.props.appendTo ? (_DomHandler2.default.absolutePosition(this.panel.element, this.container), this.panel.element.style.minWidth = _DomHandler2.default.getWidth(this.container) + "px") : _DomHandler2.default.relativePosition(this.panel.element, this.container) } }, { key: "bindDocumentClickListener", value: function () { var _this3 = this; this.documentClickListener || (this.documentClickListener = function () { _this3.selfClick || _this3.overlayClick || _this3.hide(), _this3.clearClickState() }, document.addEventListener("click", this.documentClickListener)) } }, { key: "unbindDocumentClickListener", value: function () { this.documentClickListener && (document.removeEventListener("click", this.documentClickListener), this.documentClickListener = null) } }, { key: "clearClickState", value: function () { this.selfClick = !1, this.editableInputClick = !1, this.overlayClick = !1 } }, { key: "updateEditableLabel", value: function (option) { this.editableInput && (this.editableInput.value = option ? this.getOptionLabel(option) : this.props.value || ""); } }, { key: "filter", value: function (option) { var filterValue = this.state.filter.trim().toLowerCase(), optionLabel = this.getOptionLabel(option); return optionLabel.toLowerCase().indexOf(filterValue.toLowerCase()) > -1 } }, { key: "hasFilter", value: function () { return this.state.filter && this.state.filter.trim().length > 0 } }, { key: "renderHiddenSelect", value: function () { var _this4 = this; if (this.props.autoWidth) { var options = this.props.options && this.props.options.map(function (option, i) { return _react2.default.createElement("option", { key: _this4.getOptionLabel(option), value: option.value }, _this4.getOptionLabel(option)) }); return _react2.default.createElement("div", { className: "ui-helper-hidden-accessible" }, _react2.default.createElement("select", { ref: function (el) { return _this4.nativeSelect = el }, required: this.props.required, tabIndex: "-1", "aria-hidden": "true" }, options)) } return null } }, { key: "renderKeyboardHelper", value: function () { var _this5 = this; return _react2.default.createElement("div", { className: "ui-helper-hidden-accessible" }, _react2.default.createElement("input", { ref: function (el) { return _this5.focusInput = el }, id: this.props.inputId, type: "text", role: "listbox", onFocus: this.onInputFocus, onBlur: this.onInputBlur, onKeyDown: this.onInputKeyDown, disabled: this.props.disabled, tabIndex: this.props.tabIndex, autoFocus: this.props.autoFocus })) } }, { key: "renderLabel", value: function (label) { var _this6 = this; if (this.props.editable) { var value = label || this.props.value || ""; return _react2.default.createElement("input", { ref: function (el) { return _this6.editableInput = el }, type: "text", defaultValue: value, className: "ui-dropdown-label ui-inputtext ui-corner-all", disabled: this.props.disabled, placeholder: this.props.placeholder, onClick: this.onEditableInputClick, onInput: this.onEditableInputChange, onFocus: this.onEditableInputFocus, onBlur: this.onInputBlur }) } var className = (0, _classnames2.default)("ui-dropdown-label ui-inputtext ui-corner-all", { "ui-placeholder": null === label && this.props.placeholder, "ui-dropdown-label-empty": null === label && !this.props.placeholder }); return _react2.default.createElement("label", { className: className }, label || this.props.placeholder || "empty") } }, { key: "renderClearIcon", value: function () { return this.props.value && this.props.showClear && !this.props.disabled ? _react2.default.createElement("i", { className: "ui-dropdown-clear-icon pi pi-times", onClick: this.clear }) : null } }, { key: "renderDropdownIcon", value: function () { return _react2.default.createElement("div", { className: "ui-dropdown-trigger ui-state-default ui-corner-right" }, _react2.default.createElement("span", { className: "ui-dropdown-trigger-icon pi pi-caret-down ui-clickable" })) } }, { key: "renderItems", value: function (selectedOption) { var _this7 = this, items = this.props.options; return items && this.hasFilter() && (items = items && items.filter(function (option) { return _this7.filter(option) })), items ? items.map(function (option, index) { var optionLabel = _this7.getOptionLabel(option); return _react2.default.createElement(_DropdownItem.DropdownItem, { key: optionLabel, label: optionLabel, option: option, template: _this7.props.itemTemplate, selected: selectedOption === option, onClick: _this7.onOptionClick }) }) : null } }, { key: "renderFilter", value: function () { var _this8 = this; return this.props.filter ? _react2.default.createElement("div", { className: "ui-dropdown-filter-container" }, _react2.default.createElement("input", { ref: function (el) { return _this8.filterInput = el }, type: "text", autoComplete: "off", className: "ui-dropdown-filter ui-inputtext ui-widget ui-state-default ui-corner-all", placeholder: this.props.filterPlaceholder, onKeyDown: this.onFilterInputKeyDown, onChange: this.onFilterInputChange }), _react2.default.createElement("span", { className: "ui-dropdown-filter-icon pi pi-search" })) : null } }, { key: "getOptionLabel", value: function (option) { return this.props.optionLabel ? _ObjectUtils2.default.resolveFieldData(option, this.props.optionLabel) : option.label } }, { key: "componentDidMount", value: function () { var _this9 = this; this.props.autoWidth && setTimeout(function () { _this9.props.style && (_this9.props.style.width || _this9.props.style["min-width"]) || (_this9.container.style.width = _this9.nativeSelect.offsetWidth + 30 + "px") }, 0) } }, { key: "componentWillUnmount", value: function () { this.unbindDocumentClickListener() } }, { key: "componentDidUpdate", value: function (prevProps, prevState) { if (this.props.filter && this.alignPanel(), this.panel.element.offsetParent) { var highlightItem = _DomHandler2.default.findSingle(this.panel.element, "li.ui-state-highlight"); highlightItem && _DomHandler2.default.scrollInView(this.panel.itemsWrapper, highlightItem) } } }, { key: "render", value: function () { var _this10 = this, className = (0, _classnames2.default)("ui-dropdown ui-widget ui-state-default ui-corner-all ui-helper-clearfix", this.props.className, { "ui-state-disabled": this.props.disabled, "ui-dropdown-clearable": this.props.showClear && !this.props.disabled }), selectedOption = this.findOption(this.props.value), label = selectedOption ? this.getOptionLabel(selectedOption) : null, hiddenSelect = this.renderHiddenSelect(), keyboardHelper = this.renderKeyboardHelper(), labelElement = this.renderLabel(label), dropdownIcon = this.renderDropdownIcon(), items = this.renderItems(selectedOption), filterElement = this.renderFilter(), clearIcon = this.renderClearIcon(); if (this.props.editable && this.editableInput) { var value = label || this.props.value || ""; this.editableInput.value = value } return _react2.default.createElement("div", { id: this.props.id, ref: function (el) { return _this10.container = el }, className: className, style: this.props.style, onClick: this.onClick, onMouseDown: this.props.onMouseDown, onContextMenu: this.props.onContextMenu }, hiddenSelect, keyboardHelper, labelElement, clearIcon, dropdownIcon, _react2.default.createElement(_DropdownPanel.DropdownPanel, { ref: function (el) { return _this10.panel = el }, appendTo: this.props.appendTo, panelStyle: this.props.panelStyle, panelClassName: this.props.panelClassName, scrollHeight: this.props.scrollHeight, onClick: this.panelClick, filter: filterElement }, items)) } }]), Dropdown }(_react.Component); Dropdown.defaultProps = { id: null, value: null, options: null, optionLabel: null, itemTemplate: null, style: null, className: null, autoWidth: !0, scrollHeight: "200px", filter: !1, filterPlaceholder: null, editable: !1, placeholder: null, required: !1, disabled: !1, appendTo: null, tabIndex: null, autoFocus: !1, panelClassName: null, panelStyle: null, dataKey: null, inputId: null, showClear: !1, onChange: null, onMouseDown: null, onContextMenu: null }, Dropdown.propTypes = { id: _propTypes2.default.string, value: _propTypes2.default.any, options: _propTypes2.default.array, optionLabel: _propTypes2.default.string, itemTemplate: _propTypes2.default.func, style: _propTypes2.default.object, className: _propTypes2.default.string, autoWidth: _propTypes2.default.bool, scrollHeight: _propTypes2.default.string, filter: _propTypes2.default.bool, filterPlaceholder: _propTypes2.default.string, editable: _propTypes2.default.bool, placeholder: _propTypes2.default.string, required: _propTypes2.default.bool, disabled: _propTypes2.default.bool, appendTo: _propTypes2.default.any, tabIndex: _propTypes2.default.number, autoFocus: _propTypes2.default.bool, lazy: _propTypes2.default.bool, panelClassName: _propTypes2.default.string, panelstyle: _propTypes2.default.object, dataKey: _propTypes2.default.string, inputId: _propTypes2.default.string, showClear: _propTypes2.default.bool, onChange: _propTypes2.default.func, onMouseDown: _propTypes2.default.func, onContextMenu: _propTypes2.default.func } }, function(module, exports) { "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(exports, "__esModule", { value: !0 }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), DomHandler = function () { function DomHandler() { _classCallCheck(this, DomHandler) } return _createClass(DomHandler, null, [{ key: "innerWidth", value: function (el) { var width = el.offsetWidth, style = getComputedStyle(el); return width += parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) } }, { key: "width", value: function width(el) { var width = el.offsetWidth, style = getComputedStyle(el); return width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) } }, { key: "getWindowScrollTop", value: function () { var doc = document.documentElement; return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) } }, { key: "getWindowScrollLeft", value: function () { var doc = document.documentElement; return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0) } }, { key: "getOuterWidth", value: function (el, margin) { var width = el.offsetWidth; if (margin) { var style = getComputedStyle(el); width += parseFloat(style.marginLeft) + parseFloat(style.marginRight) } return width } }, { key: "getOuterHeight", value: function (el, margin) { var height = el.offsetHeight; if (margin) { var style = getComputedStyle(el); height += parseFloat(style.marginTop) + parseFloat(style.marginBottom) } return height } }, { key: "getViewport", value: function () { var win = window, d = document, e = d.documentElement, g = d.getElementsByTagName("body")[0], w = win.innerWidth || e.clientWidth || g.clientWidth, h = win.innerHeight || e.clientHeight || g.clientHeight; return { width: w, height: h } } }, { key: "getOffset", value: function (el) { var rect = el.getBoundingClientRect(); return { top: rect.top + document.body.scrollTop, left: rect.left + document.body.scrollLeft } } }, { key: "generateZIndex", value: function () { return this.zindex = this.zindex || 999, ++this.zindex } }, { key: "getCurrentZIndex", value: function () { return this.zindex } }, { key: "index", value: function (element) { for (var children = element.parentNode.childNodes, num = 0, i = 0; i < children.length; i++) { if (children[i] === element) return num; 1 === children[i].nodeType && num++ } return -1 } }, { key: "addMultipleClasses", value: function (element, className) { if (element.classList) for (var styles = className.split(" "), i = 0; i < styles.length; i++)element.classList.add(styles[i]); else for (var _styles = className.split(" "), _i = 0; _i < _styles.length; _i++)element.className += " " + _styles[_i] } }, { key: "addClass", value: function (element, className) { element.classList ? element.classList.add(className) : element.className += " " + className } }, { key: "removeClass", value: function (element, className) { element.classList ? element.classList.remove(className) : element.className = element.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"), " ") } }, { key: "hasClass", value: function (element, className) { return element.classList ? element.classList.contains(className) : new RegExp("(^| )" + className + "( |$)", "gi").test(element.className) } }, { key: "find", value: function (element, selector) { return element.querySelectorAll(selector) } }, { key: "findSingle", value: function (element, selector) { return element.querySelector(selector) } }, { key: "getHeight", value: function (el) { var height = el.offsetHeight, style = getComputedStyle(el); return height -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth) } }, { key: "getWidth", value: function (el) { var width = el.offsetWidth, style = getComputedStyle(el); return width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth) } }, { key: "absolutePosition", value: function (element, target) { var elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element), elementOuterHeight = elementDimensions.height, elementOuterWidth = elementDimensions.width, targetOuterHeight = target.offsetHeight, targetOuterWidth = target.offsetWidth, targetOffset = target.getBoundingClientRect(), windowScrollTop = this.getWindowScrollTop(), windowScrollLeft = this.getWindowScrollLeft(), viewport = this.getViewport(), top = void 0, left = void 0; top = targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height ? targetOffset.top + windowScrollTop - elementOuterHeight : targetOuterHeight + targetOffset.top + windowScrollTop, left = targetOffset.left + targetOuterWidth + elementOuterWidth > viewport.width ? targetOffset.left + windowScrollLeft + targetOuterWidth - elementOuterWidth : targetOffset.left + windowScrollLeft, element.style.top = top + "px", element.style.left = left + "px" } }, { key: "relativePosition", value: function (element, target) { var top, left, elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element), targetHeight = target.offsetHeight, targetWidth = target.offsetWidth, targetOffset = target.getBoundingClientRect(), viewport = this.getViewport(); top = targetOffset.top + targetHeight + elementDimensions.height > viewport.height ? -1 * elementDimensions.height : targetHeight, left = targetOffset.left + elementDimensions.width > viewport.width ? targetWidth - elementDimensions.width : 0, element.style.top = top + "px", element.style.left = left + "px" } }, { key: "getHiddenElementOuterHeight", value: function (element) { element.style.visibility = "hidden", element.style.display = "block"; var elementHeight = element.offsetHeight; return element.style.display = "none", element.style.visibility = "visible", elementHeight } }, { key: "getHiddenElementOuterWidth", value: function (element) { element.style.visibility = "hidden", element.style.display = "block"; var elementWidth = element.offsetWidth; return element.style.display = "none", element.style.visibility = "visible", elementWidth } }, { key: "getHiddenElementDimensions", value: function (element) { var dimensions = {}; return element.style.visibility = "hidden", element.style.display = "block", dimensions.width = element.offsetWidth, dimensions.height = element.offsetHeight, element.style.display = "none", element.style.visibility = "visible", dimensions } }, { key: "fadeIn", value: function (element, duration) { element.style.opacity = 0; var last = +new Date, opacity = 0, tick = function tick() { opacity = +element.style.opacity + ((new Date).getTime() - last) / duration, element.style.opacity = opacity, last = +new Date, +opacity < 1 && (window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 16)) }; tick() } }, { key: "fadeOut", value: function (element, ms) { var opacity = 1, interval = 50, duration = ms, gap = interval / duration, fading = setInterval(function () { opacity -= gap, opacity <= 0 && (opacity = 0, clearInterval(fading)), element.style.opacity = opacity }, interval) } }, { key: "getUserAgent", value: function () { return navigator.userAgent } }, { key: "appendChild", value: function (element, target) { if (this.isElement(target)) target.appendChild(element); else { if (!target.el || !target.el.nativeElement) throw new Error("Cannot append " + target + " to " + element); target.el.nativeElement.appendChild(element) } } }, { key: "scrollInView", value: function (container, item) { var borderTopValue = getComputedStyle(container).getPropertyValue("borderTopWidth"), borderTop = borderTopValue ? parseFloat(borderTopValue) : 0, paddingTopValue = getComputedStyle(container).getPropertyValue("paddingTop"), paddingTop = paddingTopValue ? parseFloat(paddingTopValue) : 0, containerRect = container.getBoundingClientRect(), itemRect = item.getBoundingClientRect(), offset = itemRect.top + document.body.scrollTop - (containerRect.top + document.body.scrollTop) - borderTop - paddingTop, scroll = container.scrollTop, elementHeight = container.clientHeight, itemHeight = this.getOuterHeight(item); offset < 0 ? container.scrollTop = scroll + offset : offset + itemHeight > elementHeight && (container.scrollTop = scroll + offset - elementHeight + itemHeight) } }, { key: "clearSelection", value: function () { if (window.getSelection) window.getSelection().empty ? window.getSelection().empty() : window.getSelection().removeAllRanges && window.getSelection().rangeCount > 0 && window.getSelection().getRangeAt(0).getClientRects().length > 0 && window.getSelection().removeAllRanges(); else if (document.selection && document.selection.empty) try { document.selection.empty() } catch (error) { } } }, { key: "calculateScrollbarWidth", value: function () { if (null != this.calculatedScrollbarWidth) return this.calculatedScrollbarWidth; var scrollDiv = document.createElement("div"); scrollDiv.className = "ui-scrollbar-measure", document.body.appendChild(scrollDiv); var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; return document.body.removeChild(scrollDiv), this.calculatedScrollbarWidth = scrollbarWidth, scrollbarWidth } }, { key: "getBrowser", value: function () { if (!this.browser) { var matched = this.resolveUserAgent(); this.browser = {}, matched.browser && (this.browser[matched.browser] = !0, this.browser.version = matched.version), this.browser.chrome ? this.browser.webkit = !0 : this.browser.webkit && (this.browser.safari = !0) } return this.browser } }, { key: "resolveUserAgent", value: function () { var ua = navigator.userAgent.toLowerCase(), match = /(chrome)[ ]([\w.]+)/.exec(ua) || /(webkit)[ ]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ ]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; return { browser: match[1] || "", version: match[2] || "0" } } }]), DomHandler }(); exports.default = DomHandler }, function(module, exports) { "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(exports, "__esModule", { value: !0 }); var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }, _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), ObjectUtils = function () { function ObjectUtils() { _classCallCheck(this, ObjectUtils) } return _createClass(ObjectUtils, null, [{ key: "equals", value: function (obj1, obj2, field) { return field ? this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field) : this.equalsByValue(obj1, obj2) } }, { key: "equalsByValue", value: function (obj1, obj2) { if (null === obj1 && null === obj2) return !0; if (null === obj1 || null === obj2) return !1; if (obj1 === obj2) return delete obj1._$visited, !0; if ("object" === ("undefined" == typeof obj1 ? "undefined" : _typeof(obj1)) && "object" === ("undefined" == typeof obj2 ? "undefined" : _typeof(obj2))) { obj1._$visited = !0; for (var p in obj1) if ("_$visited" !== p) { if (obj1.hasOwnProperty(p) !== obj2.hasOwnProperty(p)) return !1; switch (_typeof(obj1[p])) { case "object": if (obj1[p] && obj1[p]._$visited || !this.equals(obj1[p], obj2[p])) return !1; break; case "function": if ("undefined" == typeof obj2[p] || "compare" !== p && obj1[p].toString() !== obj2[p].toString()) return !1; break; default: if (obj1[p] !== obj2[p]) return !1 } } for (var pp in obj2) if ("undefined" == typeof obj1[pp]) return !1; return delete obj1._$visited, !0 } return !1 } }, { key: "resolveFieldData", value: function (data, field) { if (data && field) { if (field.indexOf(".") === -1) return data[field]; for (var fields = field.split("."), value = data, i = 0, len = fields.length; i < len; ++i)value = value[fields[i]]; return value } return null } }, { key: "filter", value: function (value, fields, filterValue) { var filteredItems = []; if (value) { var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for (var _step, _iterator = value[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) { var item = _step.value, _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0; try { for (var _step2, _iterator2 = fields[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) { var field = _step2.value; if (String(this.resolveFieldData(item, field)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) { filteredItems.push(item); break } } } catch (err) { _didIteratorError2 = !0, _iteratorError2 = err } finally { try { !_iteratorNormalCompletion2 && _iterator2.return && _iterator2.return() } finally { if (_didIteratorError2) throw _iteratorError2 } } } } catch (err) { _didIteratorError = !0, _iteratorError = err } finally { try { !_iteratorNormalCompletion && _iterator.return && _iterator.return() } finally { if (_didIteratorError) throw _iteratorError } } } return filteredItems } }, { key: "reorderArray", value: function (value, from, to) { var target = void 0; if (value && from !== to) { if (to >= value.length) for (target = to - value.length; target-- + 1;)value.push(void 0); value.splice(to, 0, value.splice(from, 1)[0]) } } }, { key: "findIndexInList", value: function (value, list) { var index = -1; if (list) for (var i = 0; i < list.length; i++)if (list[i] === value) { index = i; break } return index } }]), ObjectUtils }(); ObjectUtils.filterConstraints = { startsWith: function (value, filter) { if (void 0 === filter || null === filter || "" === filter.trim()) return !0; if (void 0 === value || null === value) return !1; var filterValue = filter.toLowerCase(); return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue }, contains: function (value, filter) { return void 0 === filter || null === filter || "string" == typeof filter && "" === filter.trim() || void 0 !== value && null !== value && value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1 }, endsWith: function (value, filter) { if (void 0 === filter || null === filter || "" === filter.trim()) return !0; if (void 0 === value || null === value) return !1; var filterValue = filter.toString().toLowerCase(); return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1 }, equals: function (value, filter) { return void 0 === filter || null === filter || "string" == typeof filter && "" === filter.trim() || void 0 !== value && null !== value && value.toString().toLowerCase() === filter.toString().toLowerCase() }, notEquals: function (value, filter) { return void 0 !== filter && null !== filter && ("string" != typeof filter || "" !== filter.trim()) && (void 0 === value || null === value || value.toString().toLowerCase() !== filter.toString().toLowerCase()) }, in: function (value, filter) { if (void 0 === filter || null === filter || 0 === filter.length) return !0; if (void 0 === value || null === value) return !1; for (var i = 0; i < filter.length; i++)if (filter[i] === value) return !0; return !1 } }, exports.default = ObjectUtils }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.DropdownPanel = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _reactDom = __webpack_require__(97), _reactDom2 = _interopRequireDefault(_reactDom), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), DropdownPanel = exports.DropdownPanel = function (_Component) { function DropdownPanel() { return _classCallCheck(this, DropdownPanel), _possibleConstructorReturn(this, (DropdownPanel.__proto__ || Object.getPrototypeOf(DropdownPanel)).apply(this, arguments)) } return _inherits(DropdownPanel, _Component), _createClass(DropdownPanel, [{ key: "renderElement", value: function () { var _this2 = this, className = (0, _classnames2.default)("ui-dropdown-panel ui-widget-content ui-corner-all ui-helper-hidden ui-shadow", this.props.panelClassName); return _react2.default.createElement("div", { ref: function (el) { return _this2.element = el }, className: className, style: this.props.panelStyle, onClick: this.props.onClick }, this.props.filter, _react2.default.createElement("div", { ref: function (el) { return _this2.itemsWrapper = el }, className: "ui-dropdown-items-wrapper", style: { maxHeight: this.props.scrollHeight || "auto" } }, _react2.default.createElement("ul", { className: "ui-dropdown-items ui-dropdown-list ui-widget-content ui-widget ui-corner-all ui-helper-reset" }, this.props.children))) } }, { key: "render", value: function () { var element = this.renderElement(); return this.props.appendTo ? _reactDom2.default.createPortal(element, this.props.appendTo) : element } }]), DropdownPanel }(_react.Component); DropdownPanel.defaultProps = { appendTo: null, filter: null, scrollHeight: null, panelClassName: null, panelStyle: null, onClick: null }, DropdownPanel.propTypes = { appendTo: _propTypes2.default.object, filter: _propTypes2.default.element, scrollHeight: _propTypes2.default.string, panelClassName: _propTypes2.default.string, panelstyle: _propTypes2.default.object, onClick: _propTypes2.default.func } }, function(module, exports) { module.exports = ReactDOM }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.DropdownItem = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), DropdownItem = exports.DropdownItem = function (_Component) { function DropdownItem(props) { _classCallCheck(this, DropdownItem); var _this = _possibleConstructorReturn(this, (DropdownItem.__proto__ || Object.getPrototypeOf(DropdownItem)).call(this, props)); return _this.onClick = _this.onClick.bind(_this), _this } return _inherits(DropdownItem, _Component), _createClass(DropdownItem, [{ key: "onClick", value: function (event) { this.props.onClick && this.props.onClick({ originalEvent: event, option: this.props.option }) } }, { key: "render", value: function () { var className = (0, _classnames2.default)("ui-dropdown-item ui-corner-all", { "ui-state-highlight": this.props.selected, "ui-dropdown-item-empty": !this.props.label || 0 === this.props.label.length }), content = this.props.template ? this.props.template(this.props.option) : this.props.label; return _react2.default.createElement("li", { className: className, onClick: this.onClick }, content) } }]), DropdownItem }(_react.Component); DropdownItem.defaultProps = { option: null, label: null, template: null, selected: !1, onClick: null }, DropdownItem.propTypes = { option: _propTypes2.default.object, label: _propTypes2.default.any, template: _propTypes2.default.func, selected: _propTypes2.default.bool, onClick: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.CurrentPageReport = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), CurrentPageReport = exports.CurrentPageReport = function (_Component) { function CurrentPageReport() { return _classCallCheck(this, CurrentPageReport), _possibleConstructorReturn(this, (CurrentPageReport.__proto__ || Object.getPrototypeOf(CurrentPageReport)).apply(this, arguments)) } return _inherits(CurrentPageReport, _Component), _createClass(CurrentPageReport, [{ key: "render", value: function () { var text = this.props.template.replace("{currentPage}", this.props.page + 1).replace("{totalPages}", this.props.pageCount); return _react2.default.createElement("span", { className: "ui-paginator-current" }, text) } }]), CurrentPageReport }(_react.Component); CurrentPageReport.defaultProps = { pageCount: null, page: null, template: "({currentPage} of {totalPages})" }, CurrentPageReport.propsTypes = { pageCount: _propTypes2.default.number, page: _propTypes2.default.number, template: _propTypes2.default.string } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.TableHeader = void 0; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]) } return target }, _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _HeaderCell = __webpack_require__(101); exports.TableHeader = function (_Component) { function TableHeader() { return _classCallCheck(this, TableHeader), _possibleConstructorReturn(this, (TableHeader.__proto__ || Object.getPrototypeOf(TableHeader)).apply(this, arguments)) } return _inherits(TableHeader, _Component), _createClass(TableHeader, [{ key: "createHeaderCells", value: function (root, column, i) { var _this2 = this, children = _react2.default.Children.toArray(root.props.children); return _react2.default.Children.map(children, function (column, i) { return _react2.default.createElement(_HeaderCell.HeaderCell, _extends({ key: i }, column.props, { onSort: _this2.props.onSort, sortField: _this2.props.sortField, sortOrder: _this2.props.sortOrder, multiSortMeta: _this2.props.multiSortMeta, resizableColumns: _this2.props.resizableColumns, onColumnResizeStart: _this2.props.onColumnResizeStart, onFilter: _this2.props.onFilter, onHeaderCheckboxClick: _this2.props.onHeaderCheckboxClick, headerCheckboxSelected: _this2.props.headerCheckboxSelected, reorderableColumns: _this2.props.reorderableColumns, onDragStart: _this2.props.onColumnDragStart, onDragOver: _this2.props.onColumnDragOver, onDragLeave: _this2.props.onColumnDragLeave, onDrop: _this2.props.onColumnDrop, filters: _this2.props.filters })) }) } }, { key: "render", value: function () { var _this3 = this, content = void 0; if (this.props.columnGroup) { var rows = _react2.default.Children.toArray(this.props.columnGroup.props.children); content = rows.map(function (row, i) { return _react2.default.createElement("tr", { key: i, className: "ui-state-default" }, _this3.createHeaderCells(row)) }) } else content = _react2.default.createElement("tr", { className: "ui-state-default" }, this.createHeaderCells(this)); return _react2.default.createElement("thead", { className: "ui-datatable-thead" }, content) } }]), TableHeader }(_react.Component) }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.HeaderCell = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _InputText = __webpack_require__(102), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _RowCheckbox = __webpack_require__(104), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler); exports.HeaderCell = function (_Component) { function HeaderCell(props) { _classCallCheck(this, HeaderCell); var _this = _possibleConstructorReturn(this, (HeaderCell.__proto__ || Object.getPrototypeOf(HeaderCell)).call(this, props)); return _this.onClick = _this.onClick.bind(_this), _this.onFilterInput = _this.onFilterInput.bind(_this), _this.onMouseDown = _this.onMouseDown.bind(_this), _this.onResizerMouseDown = _this.onResizerMouseDown.bind(_this), _this } return _inherits(HeaderCell, _Component), _createClass(HeaderCell, [{ key: "onClick", value: function (e) { if (this.props.sortable) { var targetNode = e.target; (_DomHandler2.default.hasClass(targetNode, "ui-sortable-column") || _DomHandler2.default.hasClass(targetNode, "ui-column-title") || _DomHandler2.default.hasClass(targetNode, "ui-sortable-column-icon")) && this.props.onSort({ originalEvent: e, sortField: this.props.field, sortFunction: this.props.sortFunction, sortable: this.props.sortable }) } } }, { key: "onFilterInput", value: function (e) { var _this2 = this; if (this.props.filter && this.props.onFilter) { this.filterTimeout && clearTimeout(this.filterTimeout); var filterValue = e.target.value; this.filterTimeout = setTimeout(function () { _this2.props.onFilter({ value: filterValue, field: _this2.props.field, matchMode: _this2.props.filterMatchMode }), _this2.filterTimeout = null }, this.filterDelay) } } }, { key: "onResizerMouseDown", value: function (event) { this.props.resizableColumns && this.props.onColumnResizeStart && this.props.onColumnResizeStart({ originalEvent: event, columnEl: event.target.parentElement }) } }, { key: "onMouseDown", value: function (event) { this.props.reorderableColumns && ("INPUT" !== event.target.nodeName ? this.el.draggable = !0 : "INPUT" === event.target.nodeName && (this.el.draggable = !1)) } }, { key: "getMultiSortMetaData", value: function () { if (this.props.multiSortMeta) for (var i = 0; i < this.props.multiSortMeta.length; i++)if (this.props.multiSortMeta[i].field === this.props.field) return this.props.multiSortMeta[i]; return null } }, { key: "render", value: function () { var _this3 = this, multiSortMetaData = this.getMultiSortMetaData(), singleSorted = this.props.field === this.props.sortField, multipleSorted = null !== multiSortMetaData, sortOrder = 0, resizer = this.props.resizableColumns && _react2.default.createElement("span", { className: "ui-column-resizer ui-clickable", onMouseDown: this.onResizerMouseDown }), sortIconElement = void 0, filterElement = void 0, headerCheckbox = void 0; singleSorted ? sortOrder = this.props.sortOrder : multipleSorted && (sortOrder = multiSortMetaData.order); var sorted = this.props.sortable && (singleSorted || multipleSorted), className = (0, _classnames2.default)("ui-state-default ui-unselectable-text", { "ui-sortable-column": this.props.sortable, "ui-state-active": sorted, "ui-resizable-column": this.props.resizableColumns, "ui-selection-column": this.props.selectionMode }, this.props.headerClassName || this.props.className); if (this.props.sortable) { var sortIcon = sorted ? sortOrder < 0 ? "pi-sort-down" : "pi-sort-up" : "pi-sort"; sortIconElement = _react2.default.createElement("span", { className: (0, _classnames2.default)("ui-sortable-column-icon pi pi-fw", sortIcon) }) } return this.props.filter && (filterElement = this.props.filterElement || _react2.default.createElement(_InputText.InputText, { onInput: this.onFilterInput, type: this.props.filterType, defaultValue: this.props.filters && this.props.filters[this.props.field] ? this.props.filters[this.props.field].value : null, className: "ui-column-filter", placeholder: this.props.filterPlaceholder, maxLength: this.props.filterMaxLength })), "multiple" === this.props.selectionMode && (headerCheckbox = _react2.default.createElement(_RowCheckbox.RowCheckbox, { onClick: this.props.onHeaderCheckboxClick, selected: this.props.headerCheckboxSelected })), _react2.default.createElement("th", { ref: function (el) { return _this3.el = el }, className: className, style: this.props.headerStyle || this.props.style, onClick: this.onClick, onMouseDown: this.onMouseDown, colSpan: this.props.colSpan, rowSpan: this.props.rowSpan, onDragStart: this.props.onDragStart, onDragOver: this.props.onDragOver, onDragLeave: this.props.onDragLeave, onDrop: this.props.onDrop }, resizer, _react2.default.createElement("span", { className: "ui-column-title" }, this.props.header), sortIconElement, filterElement, headerCheckbox) } }]), HeaderCell }(_react.Component) }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.InputText = void 0; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]) } return target }, _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _KeyFilter = __webpack_require__(103), _KeyFilter2 = _interopRequireDefault(_KeyFilter), InputText = exports.InputText = function (_Component) { function InputText(props) { _classCallCheck(this, InputText); var _this = _possibleConstructorReturn(this, (InputText.__proto__ || Object.getPrototypeOf(InputText)).call(this, props)); return _this.onInput = _this.onInput.bind(_this), _this.onKeyPress = _this.onKeyPress.bind(_this), _this } return _inherits(InputText, _Component), _createClass(InputText, [{ key: "onKeyPress", value: function (event) { this.props.onKeyPress && this.props.onKeyPress(event), this.props.keyfilter && _KeyFilter2.default.onKeyPress(event, this.props.keyfilter, this.props.validateOnly) } }, { key: "onInput", value: function (e) { var validatePattern = !0; this.props.keyfilter && this.props.validateOnly && (validatePattern = _KeyFilter2.default.validate(e, this.props.keyfilter)), this.props.onInput && this.props.onInput(e, validatePattern), this.updateFilledState(e.target.value) } }, { key: "updateFilledState", value: function (val) { val && val.length ? this.inputEl.classList.add("ui-state-filled") : this.inputEl.classList.remove("ui-state-filled") } }, { key: "componentDidMount", value: function () { var _value = this.props.value || this.props.defaultValue; this.updateFilledState(_value) } }, { key: "componentDidUpdate", value: function (prevProps, prevState, snapshot) { prevProps.value !== this.props.value && this.updateFilledState(this.props.value) } }, { key: "render", value: function () { var _this2 = this, className = (0, _classnames2.default)("ui-inputtext ui-state-default ui-corner-all ui-widget", this.props.className, { "ui-state-disabled": this.props.disabled }), inputProps = Object.assign({}, this.props); return delete inputProps.onInput, delete inputProps.onKeyPress, delete inputProps.keyfilter, delete inputProps.validateOnly, _react2.default.createElement("input", _extends({ ref: function (el) { return _this2.inputEl = el } }, inputProps, { className: className, onInput: this.onInput, onKeyPress: this.onKeyPress })) } }]), InputText }(_react.Component); InputText.defaultProps = { onInput: null, onKeyPress: null, keyfilter: null, validateOnly: !1 }, InputText.propTypes = { onInput: _propTypes2.default.func, onKeyPress: _propTypes2.default.func, keyfilter: _propTypes2.default.any, validateOnly: _propTypes2.default.bool } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(exports, "__esModule", { value: !0 }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler), KeyFilter = function () { function KeyFilter() { _classCallCheck(this, KeyFilter) } return _createClass(KeyFilter, null, [{ key: "isNavKeyPress", value: function (e) { var k = e.keyCode; return k = _DomHandler2.default.getBrowser().safari ? KeyFilter.SAFARI_KEYS[k] || k : k, k >= 33 && k <= 40 || k === KeyFilter.KEYS.RETURN || k === KeyFilter.KEYS.TAB || k === KeyFilter.KEYS.ESC } }, { key: "isSpecialKey", value: function (e) { var k = e.keyCode; return 9 === k || 13 === k || 27 === k || 16 === k || 17 === k || k >= 18 && k <= 20 || _DomHandler2.default.getBrowser().opera && !e.shiftKey && (8 === k || k >= 33 && k <= 35 || k >= 36 && k <= 39 || k >= 44 && k <= 45) } }, { key: "getKey", value: function (e) { var k = e.keyCode || e.charCode; return _DomHandler2.default.getBrowser().safari ? KeyFilter.SAFARI_KEYS[k] || k : k } }, { key: "getCharCode", value: function (e) { return e.charCode || e.keyCode || e.which } }, { key: "onKeyPress", value: function (e, keyfilter, validateOnly) { if (!validateOnly) { this.regex = KeyFilter.DEFAULT_MASKS[keyfilter] ? KeyFilter.DEFAULT_MASKS[keyfilter] : keyfilter; var browser = _DomHandler2.default.getBrowser(); if (!e.ctrlKey && !e.altKey) { var k = this.getKey(e); if (!browser.mozilla || !(this.isNavKeyPress(e) || k === KeyFilter.KEYS.BACKSPACE || k === KeyFilter.KEYS.DELETE && 0 === e.charCode)) { var c = this.getCharCode(e), cc = String.fromCharCode(c), ok = !0; (!browser.mozilla || !this.isSpecialKey(e) && cc) && (ok = this.regex.test(cc), ok || e.preventDefault()) } } } } }, { key: "validate", value: function (e, keyfilter) { var value = e.target.value, validatePattern = !0; return value && !keyfilter.test(value) && (validatePattern = !1), validatePattern } }]), KeyFilter }(); KeyFilter.DEFAULT_MASKS = { pint: /[\d]/, int: /[\d\-]/, pnum: /[\d\.]/, money: /[\d\.\s,]/, num: /[\d\-\.]/, hex: /[0-9a-f]/i, email: /[a-z0-9_\.\-@]/i, alpha: /[a-z_]/i, alphanum: /[a-z0-9_]/i }, KeyFilter.KEYS = { TAB: 9, RETURN: 13, ESC: 27, BACKSPACE: 8, DELETE: 46 }, KeyFilter.SAFARI_KEYS = { 63234: 37, 63235: 39, 63232: 38, 63233: 40, 63276: 33, 63277: 34, 63272: 46, 63273: 36, 63275: 35 }, exports.default = KeyFilter }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.RowCheckbox = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), RowCheckbox = exports.RowCheckbox = function (_Component) { function RowCheckbox(props) { _classCallCheck(this, RowCheckbox); var _this = _possibleConstructorReturn(this, (RowCheckbox.__proto__ || Object.getPrototypeOf(RowCheckbox)).call(this, props)); return _this.onClick = _this.onClick.bind(_this), _this } return _inherits(RowCheckbox, _Component), _createClass(RowCheckbox, [{ key: "onClick", value: function (event) { this.props.onClick && this.props.onClick({ originalEvent: event, data: this.props.rowData, checked: this.props.selected }) } }, { key: "render", value: function () { var className = (0, _classnames2.default)("ui-chkbox-box ui-widget ui-corner-all ui-state-default", { "ui-state-active": this.props.selected }), iconClassName = (0, _classnames2.default)("ui-chkbox-icon ui-clickable", { "pi pi-check": this.props.selected }); return _react2.default.createElement("div", { className: "ui-chkbox ui-widget" }, _react2.default.createElement("div", { className: "ui-helper-hidden-accessible" }, _react2.default.createElement("input", { type: "checkbox" })), _react2.default.createElement("div", { className: className, onClick: this.onClick }, _react2.default.createElement("span", { className: iconClassName }))) } }]), RowCheckbox }(_react.Component); RowCheckbox.defaultProps = { rowData: null, onClick: null }, RowCheckbox.propTypes = { rowData: _propTypes2.default.object, onClick: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.TableBody = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _BodyRow = __webpack_require__(106), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler), _ObjectUtils = __webpack_require__(95), _ObjectUtils2 = _interopRequireDefault(_ObjectUtils); exports.TableBody = function (_Component) { function TableBody(props) { _classCallCheck(this, TableBody); var _this = _possibleConstructorReturn(this, (TableBody.__proto__ || Object.getPrototypeOf(TableBody)).call(this, props)); return _this.onRowClick = _this.onRowClick.bind(_this), _this.onRowRightClick = _this.onRowRightClick.bind(_this), _this.onRowTouchEnd = _this.onRowTouchEnd.bind(_this), _this.onRowToggle = _this.onRowToggle.bind(_this), _this.onRadioClick = _this.onRadioClick.bind(_this), _this.onCheckboxClick = _this.onCheckboxClick.bind(_this), _this.onRowDragEnd = _this.onRowDragEnd.bind(_this), _this.onRowDragLeave = _this.onRowDragLeave.bind(_this), _this.onRowDrop = _this.onRowDrop.bind(_this), _this } return _inherits(TableBody, _Component), _createClass(TableBody, [{ key: "onRowClick", value: function (event) { var targetNode = event.originalEvent.target.nodeName; if ("INPUT" !== targetNode && "BUTTON" !== targetNode && "A" !== targetNode && !_DomHandler2.default.hasClass(event.originalEvent.target, "ui-clickable")) { if (this.props.onRowClick && this.props.onRowClick(event), this.props.selectionMode) { var rowData = event.data, rowIndex = event.index; if (this.isMultipleSelectionMode() && event.originalEvent.shiftKey && null !== this.anchorRowIndex) _DomHandler2.default.clearSelection(); else { var selected = this.isSelected(rowData), metaSelection = !this.rowTouched && this.props.metaKeySelection; this.anchorRowIndex = rowIndex, this.rangeRowIndex = rowIndex; var selection = void 0; if (metaSelection) { var metaKey = event.originalEvent.metaKey || event.originalEvent.ctrlKey; if (selected && metaKey) { if (this.isSingleSelectionMode()) selection = null; else { var selectionIndex = this.findIndexInSelection(rowData); selection = this.props.selection.filter(function (val, i) { return i !== selectionIndex }) } this.props.onRowUnselect && this.onRowUnselect({ originalEvent: event.originalEvent, data: rowData, type: "row" }) } else this.isSingleSelectionMode() ? selection = rowData : this.isMultipleSelectionMode() && (selection = metaKey && this.props.selection ? [].concat(_toConsumableArray(this.props.selection)) : [], selection = [].concat(_toConsumableArray(selection), [rowData])), this.props.onRowSelect && this.props.onRowSelect({ originalEvent: event.originalEvent, data: rowData, type: "row" }) } else if (this.isSingleSelectionMode()) selected ? (selection = null, this.props.onRowUnselect && this.onRowUnselect({ originalEvent: event.originalEvent, data: rowData, type: "row" })) : (selection = rowData, this.props.onRowSelect && this.props.onRowSelect({ originalEvent: event.originalEvent, data: rowData, type: "row" })); else if (selected) { var _selectionIndex = this.findIndexInSelection(rowData); selection = this.props.selection.filter(function (val, i) { return i !== _selectionIndex }), this.props.onRowSelect && this.props.onRowSelect({ originalEvent: event.originalEvent, data: rowData, type: "row" }) } else selection = [].concat(_toConsumableArray(this.props.selection || []), [rowData]), this.props.onRowSelect && this.props.onRowSelect({ originalEvent: event.originalEvent, data: rowData, type: "row" }); this.props.onSelectionChange({ originalEvent: event.originalEvent, data: selection }) } } this.rowTouched = !1 } } }, { key: "onRowTouchEnd", value: function (event) { this.rowTouched = !0 } }, { key: "onRowRightClick", value: function (event) { if (this.props.contextMenu) { var selectionIndex = this.findIndexInSelection(event.data), selected = selectionIndex !== -1, selection = void 0; selected || (this.isSingleSelectionMode() ? selection = event.data : this.isMultipleSelectionMode() && (selection = [event.data]), this.props.onSelectionChange({ originalEvent: event.originalEvent, data: selection })), this.props.contextMenu.show(event.originalEvent), this.props.onContextMenuSelect && this.props.onContextMenuSelect({ originalEvent: event.originalEvent, data: event.data }), event.originalEvent.preventDefault() } } }, { key: "onRadioClick", value: function (event) { var rowData = event.data, selection = void 0; this.isSelected(rowData) ? (selection = null, this.props.onRowUnselect && this.onRowUnselect({ originalEvent: event.originalEvent, data: rowData, type: "radio" })) : (selection = rowData, this.props.onRowSelect && this.props.onRowSelect({ originalEvent: event.originalEvent, data: rowData, type: "radio" })), this.props.onSelectionChange({ originalEvent: event.originalEvent, data: selection }) } }, { key: "onCheckboxClick", value: function (event) { var rowData = event.data, selection = void 0; if (this.isSelected(rowData)) { var selectionIndex = this.findIndexInSelection(rowData); selection = this.props.selection.filter(function (val, i) { return i !== selectionIndex }), this.props.onRowSelect && this.props.onRowSelect({ originalEvent: event.originalEvent, data: rowData, type: "checkbox" }) } else selection = [].concat(_toConsumableArray(this.props.selection || []), [rowData]), this.props.onRowSelect && this.props.onRowSelect({ originalEvent: event.originalEvent, data: rowData, type: "checkbox" }); this.props.onSelectionChange({ originalEvent: event.originalEvent, data: selection }) } }, { key: "isSingleSelectionMode", value: function () { return "single" === this.props.selectionMode } }, { key: "isMultipleSelectionMode", value: function () { return "multiple" === this.props.selectionMode } }, { key: "isSelected", value: function (rowData) { return !(!rowData || !this.props.selection) && (this.props.selection instanceof Array ? this.findIndexInSelection(rowData) > -1 : this.equals(rowData, this.props.selection)) } }, { key: "equals", value: function (data1, data2) { return "equals" === this.props.compareSelectionBy ? data1 === data2 : _ObjectUtils2.default.equals(data1, data2, this.props.dataKey) } }, { key: "findIndexInSelection", value: function (rowData) { var index = -1; if (this.props.selection) for (var i = 0; i < this.props.selection.length; i++)if (this.equals(rowData, this.props.selection[i])) { index = i; break } return index } }, { key: "onRowToggle", value: function (event) { var expandedRowIndex = this.findExpandedRowIndex(event.data), expandedRows = this.props.expandedRows ? [].concat(_toConsumableArray(this.props.expandedRows)) : []; expandedRowIndex !== -1 ? (expandedRows = expandedRows.filter(function (val, i) { return i !== expandedRowIndex }), this.props.onRowCollapse && this.props.onRowCollapse({ originalEvent: event, data: event.data })) : (expandedRows.push(event.data), this.props.onRowExpand && this.props.onRowExpand({ originalEvent: event, data: event.data })), this.props.onRowToggle({ data: expandedRows }) } }, { key: "findExpandedRowIndex", value: function (row) { var index = -1; if (this.props.expandedRows) for (var i = 0; i < this.props.expandedRows.length; i++)if (this.props.expandedRows[i] === row) { index = i; break } return index } }, { key: "isRowExpanded", value: function (row) { return this.findExpandedRowIndex(row) !== -1 } }, { key: "isSelectionEnabled", value: function () { if (this.props.selectionMode || null != this.props.frozenSelectionMode) return !0; if (!Array.isArray(this.props.children)) return null != this.props.children.selectionMode; var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for (var _step, _iterator = this.props.children[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) { var col = _step.value; if (col.props.selectionMode) return !0 } } catch (err) { _didIteratorError = !0, _iteratorError = err } finally { try { !_iteratorNormalCompletion && _iterator.return && _iterator.return() } finally { if (_didIteratorError) throw _iteratorError } } return !1 } }, { key: "onRowDragStart", value: function (event, index) { this.rowDragging = !0, this.draggedRowIndex = index, event.dataTransfer.setData("text", "b") } }, { key: "onRowDragEnd", value: function (event, index) { this.rowDragging = !1, this.draggedRowIndex = null, this.droppedRowIndex = null } }, { key: "onRowDragOver", value: function (event, index) { if (this.rowDragging && this.draggedRowIndex !== index) { var rowElement = event.rowElement, rowY = _DomHandler2.default.getOffset(rowElement).top + _DomHandler2.default.getWindowScrollTop(), pageY = event.originalEvent.pageY, rowMidY = rowY + _DomHandler2.default.getOuterHeight(rowElement) / 2, prevRowElement = rowElement.previousElementSibling; pageY < rowMidY ? (_DomHandler2.default.removeClass(rowElement, "ui-datatable-dragpoint-bottom"), this.droppedRowIndex = index, prevRowElement ? _DomHandler2.default.addClass(prevRowElement, "ui-datatable-dragpoint-bottom") : _DomHandler2.default.addClass(rowElement, "ui-datatable-dragpoint-top")) : (prevRowElement ? _DomHandler2.default.removeClass(prevRowElement, "ui-datatable-dragpoint-bottom") : _DomHandler2.default.addClass(rowElement, "ui-datatable-dragpoint-top"), this.droppedRowIndex = index + 1, _DomHandler2.default.addClass(rowElement, "ui-datatable-dragpoint-bottom")) } } }, { key: "onRowDragLeave", value: function (event) { var rowElement = event.rowElement, prevRowElement = rowElement.previousElementSibling; prevRowElement && _DomHandler2.default.removeClass(prevRowElement, "ui-datatable-dragpoint-bottom"), _DomHandler2.default.removeClass(rowElement, "ui-datatable-dragpoint-bottom"), _DomHandler2.default.removeClass(rowElement, "ui-datatable-dragpoint-top") } }, { key: "onRowDrop", value: function (event) { if (null != this.droppedRowIndex) { var dropIndex = this.draggedRowIndex > this.droppedRowIndex ? this.droppedRowIndex : 0 === this.droppedRowIndex ? 0 : this.droppedRowIndex - 1, val = [].concat(_toConsumableArray(this.props.value)); _ObjectUtils2.default.reorderArray(val, this.draggedRowIndex, dropIndex), this.props.onRowReorder && this.props.onRowReorder({ originalEvent: event, value: val, dragIndex: this.draggedRowIndex, dropIndex: this.droppedRowIndex }) } this.onRowDragLeave(event), this.onRowDragEnd(event) } }, { key: "renderRowGroupHeader", value: function (rowData, index) { return _react2.default.createElement("tr", { key: index + "_rowgroupheader", className: "ui-widget-header ui-rowgroup-header" }, _react2.default.createElement("td", { colSpan: _react2.default.Children.count(this.props.children) }, _react2.default.createElement("span", { className: "ui-rowgroup-header-name" }, this.props.rowGroupHeaderTemplate(rowData, index)))) } }, { key: "renderRowGroupFooter", value: function (rowData, index) { return _react2.default.createElement("tr", { key: index + "_rowgroupfooter", className: "ui-widget-header ui-rowgroup-footer" }, this.props.rowGroupFooterTemplate(rowData, index)) } }, { key: "render", value: function () { var _this2 = this, className = (0, _classnames2.default)("ui-datatable-data ui-widget-content", { "ui-datatable-hoverable-rows": this.props.selectionMode }), rows = void 0, rpp = this.props.rows || 0, first = this.props.first || 0, selectionEnabled = this.isSelectionEnabled(), rowGroupMode = this.props.rowGroupMode, hasSubheaderGrouping = rowGroupMode && "subheader" === rowGroupMode, rowSpanGrouping = rowGroupMode && "rowspan" === rowGroupMode; if (this.props.value && this.props.value.length) { rows = []; for (var startIndex = this.props.lazy ? 0 : first, endIndex = this.props.virtualScroll ? startIndex + 2 * rpp : startIndex + rpp || this.props.value.length, _loop = function (i) { if (i >= _this2.props.value.length) return "break"; var rowData = _this2.props.value[i], expanded = _this2.isRowExpanded(rowData), selected = !!selectionEnabled && _this2.isSelected(_this2.props.value[i]), groupRowSpan = void 0; if (hasSubheaderGrouping) { var currentRowFieldData = _ObjectUtils2.default.resolveFieldData(rowData, _this2.props.groupField), previousRowFieldData = _ObjectUtils2.default.resolveFieldData(_this2.props.value[i - 1], _this2.props.groupField); 0 !== i && currentRowFieldData === previousRowFieldData || rows.push(_this2.renderRowGroupHeader(rowData, i)) } if (rowSpanGrouping) { var rowSpanIndex = i, _currentRowFieldData = _ObjectUtils2.default.resolveFieldData(rowData, _this2.props.sortField), shouldCountRowSpan = 0 === i || _ObjectUtils2.default.resolveFieldData(_this2.props.value[i - 1], _this2.props.sortField) !== _currentRowFieldData; if (shouldCountRowSpan) { var nextRowFieldData = _currentRowFieldData; for (groupRowSpan = 0; _currentRowFieldData === nextRowFieldData;) { groupRowSpan++; var nextRowData = _this2.props.value[++rowSpanIndex]; if (!nextRowData) break; nextRowFieldData = _ObjectUtils2.default.resolveFieldData(nextRowData, _this2.props.sortField) } } } var bodyRow = _react2.default.createElement(_BodyRow.BodyRow, { key: i, value: _this2.props.value, rowData: rowData, rowIndex: i, onClick: _this2.onRowClick, onDoubleClick: _this2.props.onRowDoubleClick, onRightClick: _this2.onRowRightClick, onTouchEnd: _this2.onRowTouchEnd, onRowToggle: _this2.onRowToggle, expanded: expanded, responsive: _this2.props.responsive, onRadioClick: _this2.onRadioClick, onCheckboxClick: _this2.onCheckboxClick, selected: selected, rowClassName: _this2.props.rowClassName, sortField: _this2.props.sortField, rowGroupMode: _this2.props.rowGroupMode, groupRowSpan: groupRowSpan, onDragStart: function (e) { return _this2.onRowDragStart(e, i) }, onDragEnd: _this2.onRowDragEnd, onDragOver: function (e) { return _this2.onRowDragOver(e, i) }, onDragLeave: _this2.onRowDragLeave, onDrop: _this2.onRowDrop }, _this2.props.children); if (rows.push(bodyRow), expanded) { var expandedRowContent = _this2.props.rowExpansionTemplate(rowData), expandedRow = _react2.default.createElement("tr", { className: "ui-widget-content", key: i + "_expanded" }, _react2.default.createElement("td", { colSpan: _this2.props.children.length }, expandedRowContent)); rows.push(expandedRow) } if (hasSubheaderGrouping) { var _currentRowFieldData2 = _ObjectUtils2.default.resolveFieldData(rowData, _this2.props.groupField), _nextRowFieldData = _ObjectUtils2.default.resolveFieldData(_this2.props.value[i + 1], _this2.props.groupField); i !== _this2.props.value.length - 1 && _currentRowFieldData2 === _nextRowFieldData || rows.push(_this2.renderRowGroupFooter(rowData, i)) } }, i = startIndex; i < endIndex; i++) { var _ret = _loop(i); if ("break" === _ret) break } } else rows = _react2.default.createElement("tr", { className: "ui-widget-content ui-datatable-emptymessage" }, _react2.default.createElement("td", { colSpan: this.props.children.length }, this.props.emptyMessage)); return _react2.default.createElement("tbody", { className: className }, rows) } }]), TableBody }(_react.Component) }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.BodyRow = void 0; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]) } return target }, _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _BodyCell = __webpack_require__(107), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler); exports.BodyRow = function (_Component) { function BodyRow(props) { _classCallCheck(this, BodyRow); var _this = _possibleConstructorReturn(this, (BodyRow.__proto__ || Object.getPrototypeOf(BodyRow)).call(this, props)); return _this.onClick = _this.onClick.bind(_this), _this.onTouchEnd = _this.onTouchEnd.bind(_this), _this.onRightClick = _this.onRightClick.bind(_this), _this.onMouseDown = _this.onMouseDown.bind(_this), _this.onDragEnd = _this.onDragEnd.bind(_this), _this.onDragOver = _this.onDragOver.bind(_this), _this.onDragLeave = _this.onDragLeave.bind(_this), _this.onDrop = _this.onDrop.bind(_this), _this } return _inherits(BodyRow, _Component), _createClass(BodyRow, [{ key: "onClick", value: function (event) { this.props.onClick && this.props.onClick({ originalEvent: event, data: this.props.rowData, index: this.props.rowIndex }) } }, { key: "onTouchEnd", value: function (event) { this.props.onTouchEnd && this.props.onTouchEnd(event) } }, { key: "onRightClick", value: function (event) { this.props.onRightClick && this.props.onRightClick({ originalEvent: event, data: this.props.rowData, index: this.props.rowIndex }) } }, { key: "onMouseDown", value: function (event) { _DomHandler2.default.hasClass(event.target, "ui-table-reorderablerow-handle") ? event.currentTarget.draggable = !0 : event.currentTarget.draggable = !1 } }, { key: "onDragEnd", value: function (event) { this.props.onDragEnd && this.props.onDragEnd(event), event.currentTarget.draggable = !1 } }, { key: "onDragOver", value: function (event) { this.props.onDragOver && this.props.onDragOver({ originalEvent: event, rowElement: this.container }), event.preventDefault() } }, { key: "onDragLeave", value: function (event) { this.props.onDragLeave && this.props.onDragLeave({ originalEvent: event, rowElement: this.container }) } }, { key: "onDrop", value: function (event) { this.props.onDrop && this.props.onDrop({ originalEvent: event, rowElement: this.container }) } }, { key: "render", value: function () { var _this2 = this, columns = _react2.default.Children.toArray(this.props.children), conditionalStyles = { "ui-state-highlight": this.props.selected, "ui-datatable-even": this.props.rowIndex % 2 === 0, "ui-datatable-odd": this.props.rowIndex % 2 === 1 }; if (this.props.rowClassName) { var rowClassNameCondition = this.props.rowClassName(this.props.rowData); conditionalStyles = _extends({}, conditionalStyles, rowClassNameCondition) } for (var className = (0, _classnames2.default)("ui-widget-content", conditionalStyles), hasRowSpanGrouping = "rowspan" === this.props.rowGroupMode, cells = [], i = 0; i < columns.length; i++) { var column = columns[i], rowSpan = void 0; if (hasRowSpanGrouping && this.props.sortField === column.props.field) { if (!this.props.groupRowSpan) continue; rowSpan = this.props.groupRowSpan } var cell = _react2.default.createElement(_BodyCell.BodyCell, _extends({ key: i }, column.props, { value: this.props.value, rowSpan: rowSpan, rowData: this.props.rowData, rowIndex: this.props.rowIndex, onRowToggle: this.props.onRowToggle, expanded: this.props.expanded, onRadioClick: this.props.onRadioClick, onCheckboxClick: this.props.onCheckboxClick, responsive: this.props.responsive, selected: this.props.selected })); cells.push(cell) } return _react2.default.createElement("tr", { ref: function (el) { _this2.container = el }, className: className, onClick: this.onClick, onDoubleClick: this.props.onDoubleClick, onTouchEnd: this.onTouchEnd, onContextMenu: this.onRightClick, onMouseDown: this.onMouseDown, onDragStart: this.props.onDragStart, onDragEnd: this.onDragEnd, onDragOver: this.onDragOver, onDragLeave: this.onDragLeave, onDrop: this.onDrop }, cells) } }]), BodyRow }(_react.Component) }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.BodyCell = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _ObjectUtils = __webpack_require__(95), _ObjectUtils2 = _interopRequireDefault(_ObjectUtils), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler), _RowRadioButton = __webpack_require__(108), _RowCheckbox = __webpack_require__(104); exports.BodyCell = function (_Component) { function BodyCell(props) { _classCallCheck(this, BodyCell); var _this = _possibleConstructorReturn(this, (BodyCell.__proto__ || Object.getPrototypeOf(BodyCell)).call(this, props)); return _this.state = {}, _this.onExpanderClick = _this.onExpanderClick.bind(_this), _this.onClick = _this.onClick.bind(_this), _this.onKeyDown = _this.onKeyDown.bind(_this), _this.onEditorFocus = _this.onEditorFocus.bind(_this), _this } return _inherits(BodyCell, _Component), _createClass(BodyCell, [{ key: "onExpanderClick", value: function (event) { this.props.onRowToggle && this.props.onRowToggle({ originalEvent: event, data: this.props.rowData }), event.preventDefault() } }, { key: "onKeyDown", value: function (event) { 13 !== event.which && 9 !== event.which || this.switchCellToViewMode() } }, { key: "onClick", value: function (event) { this.props.editor && (this.setState({ editing: !0 }), this.documentEditListener ? this.cellClick = !0 : this.bindDocumentEditListener()) } }, { key: "onEditorFocus", value: function (event) { this.onClick(event) } }, { key: "bindDocumentEditListener", value: function () { var _this2 = this; this.documentEditListener || (this.documentEditListener = function (event) { _this2.cellClick || _this2.switchCellToViewMode(), _this2.cellClick = !1 }, document.addEventListener("click", this.documentEditListener)) } }, { key: "closeCell", value: function () { this.setState({ editing: !1 }), this.unbindDocumentEditListener() } }, { key: "switchCellToViewMode", value: function () { if (this.props.editorValidator) { var valid = this.props.editorValidator(this.props); valid && this.closeCell() } else this.closeCell() } }, { key: "unbindDocumentEditListener", value: function () { this.documentEditListener && (document.removeEventListener("click", this.documentEditListener), this.documentEditListener = null) } }, { key: "componentDidUpdate", value: function () { var _this3 = this; if (this.container && this.props.editor) if (this.state.editing) { var focusable = _DomHandler2.default.findSingle(this.container, "input"); focusable && (focusable.setAttribute("data-isCellEditing", !0), focusable.focus()), this.keyHelper.tabIndex = -1 } else setTimeout(function () { _this3.keyHelper.removeAttribute("tabindex") }, 50) } }, { key: "render", value: function () { var _this4 = this, content = void 0, header = void 0, cellClassName = (0, _classnames2.default)(this.props.bodyClassName || this.props.className, { "ui-selection-column": this.props.selectionMode, "ui-editable-column": this.props.editor, "ui-cell-editing": this.state.editing }); if (this.props.expander) { var iconClassName = (0, _classnames2.default)("ui-row-toggler pi pi-fw ui-clickable", { "pi-chevron-circle-down": this.props.expanded, "pi-chevron-circle-right": !this.props.expanded }); content = _react2.default.createElement("a", { onClick: this.onExpanderClick }, _react2.default.createElement("span", { className: iconClassName })) } else if (this.props.selectionMode) content = "single" === this.props.selectionMode ? _react2.default.createElement(_RowRadioButton.RowRadioButton, { onClick: this.props.onRadioClick, rowData: this.props.rowData, selected: this.props.selected }) : _react2.default.createElement(_RowCheckbox.RowCheckbox, { onClick: this.props.onCheckboxClick, rowData: this.props.rowData, selected: this.props.selected }); else if (this.props.rowReorder) { var reorderIcon = (0, _classnames2.default)("ui-table-reorderablerow-handle", this.props.rowReorderIcon); content = _react2.default.createElement("i", { className: reorderIcon }) } else if (this.state.editing) { if (!this.props.editor) throw new Error("Editor is not found on column."); content = this.props.editor(this.props) } else content = this.props.body ? this.props.body(this.props.rowData, this.props) : _ObjectUtils2.default.resolveFieldData(this.props.rowData, this.props.field); this.props.responsive && (header = _react2.default.createElement("span", { className: "ui-column-title" }, this.props.header)); var editorKeyHelper = this.props.editor && _react2.default.createElement("a", { href: "#", ref: function (el) { _this4.keyHelper = el }, className: "ui-cell-editor-key-helper ui-helper-hidden-accessible", onFocus: this.onEditorFocus }, _react2.default.createElement("span", null)); return _react2.default.createElement("td", { ref: function (el) { _this4.container = el }, className: cellClassName, style: this.props.bodyStyle || this.props.style, onClick: this.onClick, onKeyDown: this.onKeyDown, rowSpan: this.props.rowSpan }, header, editorKeyHelper, _react2.default.createElement("span", { className: "ui-cell-data" }, content)) } }]), BodyCell }(_react.Component) }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.RowRadioButton = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), RowRadioButton = exports.RowRadioButton = function (_Component) { function RowRadioButton(props) { _classCallCheck(this, RowRadioButton); var _this = _possibleConstructorReturn(this, (RowRadioButton.__proto__ || Object.getPrototypeOf(RowRadioButton)).call(this, props)); return _this.onClick = _this.onClick.bind(_this), _this } return _inherits(RowRadioButton, _Component), _createClass(RowRadioButton, [{ key: "onClick", value: function (event) { this.props.onClick && this.props.onClick({ originalEvent: event, data: this.props.rowData }) } }, { key: "render", value: function () { var className = (0, _classnames2.default)("ui-radiobutton-box ui-widget ui-radiobutton-relative ui-state-default", { "ui-state-active": this.props.selected }), iconClassName = (0, _classnames2.default)("ui-radiobutton-icon ui-clickable", { "pi pi-circle-on": this.props.selected }); return _react2.default.createElement("div", { className: "ui-radiobutton ui-widget" }, _react2.default.createElement("div", { className: "ui-helper-hidden-accessible" }, _react2.default.createElement("input", { type: "radio" })), _react2.default.createElement("div", { className: className, onClick: this.onClick }, _react2.default.createElement("span", { className: iconClassName }))) } }]), RowRadioButton }(_react.Component); RowRadioButton.defaultProps = { rowData: null, onClick: null, selected: !1 }, RowRadioButton.propTypes = { rowData: _propTypes2.default.object, onClick: _propTypes2.default.func, selected: _propTypes2.default.bool } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.TableFooter = void 0; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]) } return target }, _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _FooterCell = __webpack_require__(110); exports.TableFooter = function (_Component) { function TableFooter() { return _classCallCheck(this, TableFooter), _possibleConstructorReturn(this, (TableFooter.__proto__ || Object.getPrototypeOf(TableFooter)).apply(this, arguments)) } return _inherits(TableFooter, _Component), _createClass(TableFooter, [{ key: "createFooterCells", value: function (root, column, i) { var children = _react2.default.Children.toArray(root.props.children); return _react2.default.Children.map(children, function (column, i) { return _react2.default.createElement(_FooterCell.FooterCell, _extends({ key: i }, column.props)) }) } }, { key: "render", value: function () { var _this2 = this, content = void 0; if (this.props.columnGroup) { var rows = _react2.default.Children.toArray(this.props.columnGroup.props.children); content = rows.map(function (row, i) { return _react2.default.createElement("tr", { key: i, className: "ui-state-default" }, _this2.createFooterCells(row)) }) } else content = _react2.default.createElement("tr", { className: "ui-state-default" }, this.createFooterCells(this)); return _react2.default.createElement("tfoot", { className: "ui-datatable-tfoot" }, content) } }]), TableFooter }(_react.Component) }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.FooterCell = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames); exports.FooterCell = function (_Component) { function FooterCell() { return _classCallCheck(this, FooterCell), _possibleConstructorReturn(this, (FooterCell.__proto__ || Object.getPrototypeOf(FooterCell)).apply(this, arguments)) } return _inherits(FooterCell, _Component), _createClass(FooterCell, [{ key: "render", value: function () { var className = (0, _classnames2.default)("ui-state-default", this.props.footerClassName || this.props.className); return _react2.default.createElement("td", { className: className, style: this.props.footerStyle || this.props.style, colSpan: this.props.colSpan, rowSpan: this.props.rowSpan }, this.props.footer) } }]), FooterCell }(_react.Component) }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.ScrollableView = void 0; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _react = __webpack_require__(1), _react2 = _interopRequireDefault(_react), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), _classnames = __webpack_require__(85), _classnames2 = _interopRequireDefault(_classnames), _DomHandler = __webpack_require__(94), _DomHandler2 = _interopRequireDefault(_DomHandler), ScrollableView = exports.ScrollableView = function (_Component) { function ScrollableView(props) { _classCallCheck(this, ScrollableView); var _this = _possibleConstructorReturn(this, (ScrollableView.__proto__ || Object.getPrototypeOf(ScrollableView)).call(this, props)); return _this.onHeaderScroll = _this.onHeaderScroll.bind(_this), _this.onBodyScroll = _this.onBodyScroll.bind(_this), _this } return _inherits(ScrollableView, _Component), _createClass(ScrollableView, [{ key: "componentDidMount", value: function () { this.setScrollHeight(), this.props.frozen ? this.scrollBody.style.paddingBottom = _DomHandler2.default.calculateScrollbarWidth() + "px" : this.alignScrollBar() } }, { key: "componentDidUpdate", value: function () { this.props.frozen || (this.alignScrollBar(), this.props.virtualScroll && (this.calculateRowHeight(), this.scrollTableWrapper.style.height = this.props.totalRecords * this.rowHeight + "px")), this.virtualScrollCallback && (this.virtualScrollCallback(), this.virtualScrollCallback = null) } }, { key: "setScrollHeight", value: function () { if (this.props.scrollHeight) if (this.props.scrollHeight.indexOf("%") !== -1) { var datatableContainer = this.findDataTableContainer(this.container); this.scrollBody.style.visibility = "hidden", this.scrollBody.style.height = "100px"; var containerHeight = _DomHandler2.default.getOuterHeight(datatableContainer), relativeHeight = _DomHandler2.default.getOuterHeight(datatableContainer.parentElement) * parseInt(this.props.scrollHeight, 10) / 100, staticHeight = containerHeight - 100, scrollBodyHeight = relativeHeight - staticHeight; this.scrollBody.style.height = "auto", this.scrollBody.style.maxHeight = scrollBodyHeight + "px", this.scrollBody.style.visibility = "visible" } else this.scrollBody.style.maxHeight = this.props.scrollHeight } }, { key: "findDataTableContainer", value: function (element) { if (element) { for (var el = element; el && !_DomHandler2.default.hasClass(el, "ui-datatable");)el = el.parentElement; return el } return null } }, { key: "onHeaderScroll", value: function () { this.scrollHeader.scrollLeft = 0 } }, { key: "onBodyScroll", value: function () { var _this2 = this, frozenView = this.container.previousElementSibling, frozenScrollBody = void 0; if (frozenView && (frozenScrollBody = _DomHandler2.default.findSingle(frozenView, ".ui-datatable-scrollable-body")), this.scrollHeaderBox.style.marginLeft = -1 * this.scrollBody.scrollLeft + "px", this.scrollFooterBox && (this.scrollFooterBox.style.marginLeft = -1 * this.scrollBody.scrollLeft + "px"), frozenScrollBody && (frozenScrollBody.scrollTop = this.scrollBody.scrollTop), this.props.virtualScroll) { var viewport = _DomHandler2.default.getOuterHeight(this.scrollBody), tableHeight = _DomHandler2.default.getOuterHeight(this.scrollTable), pageHeight = this.rowHeight * this.props.rows, virtualTableHeight = _DomHandler2.default.getOuterHeight(this.scrollTableWrapper), pageCount = virtualTableHeight / pageHeight || 1; if (this.scrollBody.scrollTop + viewport > parseFloat(this.scrollTable.style.top) + tableHeight || this.scrollBody.scrollTop < parseFloat(this.scrollTable.style.top)) { var page = Math.floor(this.scrollBody.scrollTop * pageCount / this.scrollBody.scrollHeight) + 1; this.props.onVirtualScroll && (this.props.onVirtualScroll({ page: page }), this.virtualScrollCallback = function () { _this2.scrollTable.style.top = (page - 1) * pageHeight + "px" }) } } } }, { key: "hasVerticalOverflow", value: function () { return _DomHandler2.default.getOuterHeight(this.scrollTable) > _DomHandler2.default.getOuterHeight(this.scrollBody) } }, { key: "alignScrollBar", value: function () { var scrollBarWidth = this.hasVerticalOverflow() ? _DomHandler2.default.calculateScrollbarWidth() : 0; this.scrollHeaderBox.style.marginRight = scrollBarWidth + "px", this.scrollFooterBox && (this.scrollFooterBox.style.marginRight = scrollBarWidth + "px") } }, { key: "calculateRowHeight", value: function () { var row = _DomHandler2.default.findSingle(this.scrollTable, "tr.ui-widget-content:not(.ui-datatable-emptymessage-row)"); row && (this.rowHeight = _DomHandler2.default.getOuterHeight(row)) } }, { key: "renderColGroup", value: function () { return this.props.columns && this.props.columns.length ? _react2.default.createElement("colgroup", { className: "ui-datatable-scrollable-colgroup" }, this.props.columns.map(function (col, i) { return _react2.default.createElement("col", { key: col.field + "_" + i }) })) : null } }, { key: "render", value: function () { var _this3 = this, className = (0, _classnames2.default)("ui-datatable-scrollable-view", { "ui-datatable-frozen-view": this.props.frozen }), width = this.props.frozen ? this.props.frozenWidth : this.props.unfrozenWidth, left = this.props.frozen ? null : this.props.frozenWidth, colGroup = this.renderColGroup(); return _react2.default.createElement("div", { className: className, style: { width: width, left: left }, ref: function (el) { _this3.container = el } }, _react2.default.createElement("div", { className: "ui-widget-header ui-datatable-scrollable-header", ref: function (el) { _this3.scrollHeader = el }, onScroll: this.onHeaderScroll }, _react2.default.createElement("div", { className: "ui-datatable-scrollable-header-box", ref: function (el) { _this3.scrollHeaderBox = el } }, _react2.default.createElement("table", null, this.props.header, this.props.frozenBody))), _react2.default.createElement("div", { className: "ui-datatable-scrollable-body", ref: function (el) { _this3.scrollBody = el }, onScroll: this.onBodyScroll }, _react2.default.createElement("div", { className: "ui-datatable-scrollable-table-wrapper", ref: function (el) { _this3.scrollTableWrapper = el } }, _react2.default.createElement("table", { ref: function (el) { _this3.scrollTable = el }, style: { top: "0" } }, colGroup, this.props.body))), _react2.default.createElement("div", { className: "ui-widget-header ui-datatable-scrollable-footer", ref: function (el) { _this3.scrollFooter = el } }, _react2.default.createElement("div", { className: "ui-datatable-scrollable-footer-box", ref: function (el) { _this3.scrollFooterBox = el } }, _react2.default.createElement("table", null, this.props.footer)))) } }]), ScrollableView }(_react.Component); ScrollableView.defaultProps = { header: null, body: null, footer: null, columns: null, frozen: null, frozenWidth: null, unfrozenWidth: null, frozenBody: null, virtualScroll: !1, rows: null, totalRecords: null, onVirtualScroll: null }, ScrollableView.propTypes = { header: _propTypes2.default.element, body: _propTypes2.default.element, footer: _propTypes2.default.element, columns: _propTypes2.default.array, frozen: _propTypes2.default.bool, frozenWidth: _propTypes2.default.string, unfrozenWidth: _propTypes2.default.string, frozenBody: _propTypes2.default.element, virtualScroll: _propTypes2.default.bool, rows: _propTypes2.default.number, totalRcords: _propTypes2.default.number, onVirtualScroll: _propTypes2.default.func } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }), exports.Column = void 0; var _react = __webpack_require__(1), _propTypes = __webpack_require__(82), _propTypes2 = _interopRequireDefault(_propTypes), Column = exports.Column = function (_Component) { function Column() { return _classCallCheck(this, Column), _possibleConstructorReturn(this, (Column.__proto__ || Object.getPrototypeOf(Column)).apply(this, arguments)) } return _inherits(Column, _Component), Column }(_react.Component); Column.defaultProps = { columnKey: null, field: null, sortField: null, header: null, body: null, footer: null, sortable: !1, sortFunction: null, filter: !1, filterMatchMode: "startsWith", filterPlaceholder: null, filterType: "text", filterMaxLength: null, filterElement: null, filterFunction: null, style: null, className: null, expander: !1, frozen: !1, selectionMode: null, colSpan: null, rowSpan: null, editor: null, editorValidator: null, rowReorder: !1, rowReorderIcon: "fa fa-bars" }, Column.propsTypes = { columnKey: _propTypes2.default.string, field: _propTypes2.default.string, sortField: _propTypes2.default.string, header: _propTypes2.default.any, body: _propTypes2.default.any, footer: _propTypes2.default.any, sortable: _propTypes2.default.any, sortFunction: _propTypes2.default.func, filter: _propTypes2.default.bool, filterMatchMode: _propTypes2.default.string, filterPlaceholder: _propTypes2.default.string, filterType: _propTypes2.default.string, filterMaxLength: _propTypes2.default.number, filterElement: _propTypes2.default.object, filterFunction: _propTypes2.default.func, style: _propTypes2.default.object, className: _propTypes2.default.string, expander: _propTypes2.default.bool, frozen: _propTypes2.default.bool, selectionMode: _propTypes2.default.string, colSpan: _propTypes2.default.number, rowSpan: _propTypes2.default.number, editor: _propTypes2.default.func, editorValidator: _propTypes2.default.func, rowReorder: _propTypes2.default.bool, rowReorderIcon: _propTypes2.default.string } }, function(module, exports, __webpack_require__) { (function (process, __filename, global, __dirname) {/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ "use strict"; var ts, __assign = this && this.__assign || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]) } return t }, __makeTemplateObject = this && this.__makeTemplateObject || function (cooked, raw) { return Object.defineProperty ? Object.defineProperty(cooked, "raw", { value: raw }) : cooked.raw = raw, cooked }, __extends = this && this.__extends || function () { var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b } || function (d, b) { for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]) }; return function (d, b) { function __() { this.constructor = d } extendStatics(d, b), d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __) } }(); !function (ts) { function diagnosticCategoryName(d, lowerCase) { void 0 === lowerCase && (lowerCase = !0); var name = DiagnosticCategory[d.category]; return lowerCase ? name.toLowerCase() : name } function _contextuallyTypePragmas(args) { return args } var Comparison; !function (Comparison) { Comparison[Comparison.LessThan = -1] = "LessThan", Comparison[Comparison.EqualTo = 0] = "EqualTo", Comparison[Comparison.GreaterThan = 1] = "GreaterThan" }(Comparison = ts.Comparison || (ts.Comparison = {})); var SyntaxKind; !function (SyntaxKind) { SyntaxKind[SyntaxKind.Unknown = 0] = "Unknown", SyntaxKind[SyntaxKind.EndOfFileToken = 1] = "EndOfFileToken", SyntaxKind[SyntaxKind.SingleLineCommentTrivia = 2] = "SingleLineCommentTrivia", SyntaxKind[SyntaxKind.MultiLineCommentTrivia = 3] = "MultiLineCommentTrivia", SyntaxKind[SyntaxKind.NewLineTrivia = 4] = "NewLineTrivia", SyntaxKind[SyntaxKind.WhitespaceTrivia = 5] = "WhitespaceTrivia", SyntaxKind[SyntaxKind.ShebangTrivia = 6] = "ShebangTrivia", SyntaxKind[SyntaxKind.ConflictMarkerTrivia = 7] = "ConflictMarkerTrivia", SyntaxKind[SyntaxKind.NumericLiteral = 8] = "NumericLiteral", SyntaxKind[SyntaxKind.StringLiteral = 9] = "StringLiteral", SyntaxKind[SyntaxKind.JsxText = 10] = "JsxText", SyntaxKind[SyntaxKind.JsxTextAllWhiteSpaces = 11] = "JsxTextAllWhiteSpaces", SyntaxKind[SyntaxKind.RegularExpressionLiteral = 12] = "RegularExpressionLiteral", SyntaxKind[SyntaxKind.NoSubstitutionTemplateLiteral = 13] = "NoSubstitutionTemplateLiteral", SyntaxKind[SyntaxKind.TemplateHead = 14] = "TemplateHead", SyntaxKind[SyntaxKind.TemplateMiddle = 15] = "TemplateMiddle", SyntaxKind[SyntaxKind.TemplateTail = 16] = "TemplateTail", SyntaxKind[SyntaxKind.OpenBraceToken = 17] = "OpenBraceToken", SyntaxKind[SyntaxKind.CloseBraceToken = 18] = "CloseBraceToken", SyntaxKind[SyntaxKind.OpenParenToken = 19] = "OpenParenToken", SyntaxKind[SyntaxKind.CloseParenToken = 20] = "CloseParenToken", SyntaxKind[SyntaxKind.OpenBracketToken = 21] = "OpenBracketToken", SyntaxKind[SyntaxKind.CloseBracketToken = 22] = "CloseBracketToken", SyntaxKind[SyntaxKind.DotToken = 23] = "DotToken", SyntaxKind[SyntaxKind.DotDotDotToken = 24] = "DotDotDotToken", SyntaxKind[SyntaxKind.SemicolonToken = 25] = "SemicolonToken", SyntaxKind[SyntaxKind.CommaToken = 26] = "CommaToken", SyntaxKind[SyntaxKind.LessThanToken = 27] = "LessThanToken", SyntaxKind[SyntaxKind.LessThanSlashToken = 28] = "LessThanSlashToken", SyntaxKind[SyntaxKind.GreaterThanToken = 29] = "GreaterThanToken", SyntaxKind[SyntaxKind.LessThanEqualsToken = 30] = "LessThanEqualsToken", SyntaxKind[SyntaxKind.GreaterThanEqualsToken = 31] = "GreaterThanEqualsToken", SyntaxKind[SyntaxKind.EqualsEqualsToken = 32] = "EqualsEqualsToken", SyntaxKind[SyntaxKind.ExclamationEqualsToken = 33] = "ExclamationEqualsToken", SyntaxKind[SyntaxKind.EqualsEqualsEqualsToken = 34] = "EqualsEqualsEqualsToken", SyntaxKind[SyntaxKind.ExclamationEqualsEqualsToken = 35] = "ExclamationEqualsEqualsToken", SyntaxKind[SyntaxKind.EqualsGreaterThanToken = 36] = "EqualsGreaterThanToken", SyntaxKind[SyntaxKind.PlusToken = 37] = "PlusToken", SyntaxKind[SyntaxKind.MinusToken = 38] = "MinusToken", SyntaxKind[SyntaxKind.AsteriskToken = 39] = "AsteriskToken", SyntaxKind[SyntaxKind.AsteriskAsteriskToken = 40] = "AsteriskAsteriskToken", SyntaxKind[SyntaxKind.SlashToken = 41] = "SlashToken", SyntaxKind[SyntaxKind.PercentToken = 42] = "PercentToken", SyntaxKind[SyntaxKind.PlusPlusToken = 43] = "PlusPlusToken", SyntaxKind[SyntaxKind.MinusMinusToken = 44] = "MinusMinusToken", SyntaxKind[SyntaxKind.LessThanLessThanToken = 45] = "LessThanLessThanToken", SyntaxKind[SyntaxKind.GreaterThanGreaterThanToken = 46] = "GreaterThanGreaterThanToken", SyntaxKind[SyntaxKind.GreaterThanGreaterThanGreaterThanToken = 47] = "GreaterThanGreaterThanGreaterThanToken", SyntaxKind[SyntaxKind.AmpersandToken = 48] = "AmpersandToken", SyntaxKind[SyntaxKind.BarToken = 49] = "BarToken", SyntaxKind[SyntaxKind.CaretToken = 50] = "CaretToken", SyntaxKind[SyntaxKind.ExclamationToken = 51] = "ExclamationToken", SyntaxKind[SyntaxKind.TildeToken = 52] = "TildeToken", SyntaxKind[SyntaxKind.AmpersandAmpersandToken = 53] = "AmpersandAmpersandToken", SyntaxKind[SyntaxKind.BarBarToken = 54] = "BarBarToken", SyntaxKind[SyntaxKind.QuestionToken = 55] = "QuestionToken", SyntaxKind[SyntaxKind.ColonToken = 56] = "ColonToken", SyntaxKind[SyntaxKind.AtToken = 57] = "AtToken", SyntaxKind[SyntaxKind.EqualsToken = 58] = "EqualsToken", SyntaxKind[SyntaxKind.PlusEqualsToken = 59] = "PlusEqualsToken", SyntaxKind[SyntaxKind.MinusEqualsToken = 60] = "MinusEqualsToken", SyntaxKind[SyntaxKind.AsteriskEqualsToken = 61] = "AsteriskEqualsToken", SyntaxKind[SyntaxKind.AsteriskAsteriskEqualsToken = 62] = "AsteriskAsteriskEqualsToken", SyntaxKind[SyntaxKind.SlashEqualsToken = 63] = "SlashEqualsToken", SyntaxKind[SyntaxKind.PercentEqualsToken = 64] = "PercentEqualsToken", SyntaxKind[SyntaxKind.LessThanLessThanEqualsToken = 65] = "LessThanLessThanEqualsToken", SyntaxKind[SyntaxKind.GreaterThanGreaterThanEqualsToken = 66] = "GreaterThanGreaterThanEqualsToken", SyntaxKind[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken = 67] = "GreaterThanGreaterThanGreaterThanEqualsToken", SyntaxKind[SyntaxKind.AmpersandEqualsToken = 68] = "AmpersandEqualsToken", SyntaxKind[SyntaxKind.BarEqualsToken = 69] = "BarEqualsToken", SyntaxKind[SyntaxKind.CaretEqualsToken = 70] = "CaretEqualsToken", SyntaxKind[SyntaxKind.Identifier = 71] = "Identifier", SyntaxKind[SyntaxKind.BreakKeyword = 72] = "BreakKeyword", SyntaxKind[SyntaxKind.CaseKeyword = 73] = "CaseKeyword", SyntaxKind[SyntaxKind.CatchKeyword = 74] = "CatchKeyword", SyntaxKind[SyntaxKind.ClassKeyword = 75] = "ClassKeyword", SyntaxKind[SyntaxKind.ConstKeyword = 76] = "ConstKeyword", SyntaxKind[SyntaxKind.ContinueKeyword = 77] = "ContinueKeyword", SyntaxKind[SyntaxKind.DebuggerKeyword = 78] = "DebuggerKeyword", SyntaxKind[SyntaxKind.DefaultKeyword = 79] = "DefaultKeyword", SyntaxKind[SyntaxKind.DeleteKeyword = 80] = "DeleteKeyword", SyntaxKind[SyntaxKind.DoKeyword = 81] = "DoKeyword", SyntaxKind[SyntaxKind.ElseKeyword = 82] = "ElseKeyword", SyntaxKind[SyntaxKind.EnumKeyword = 83] = "EnumKeyword", SyntaxKind[SyntaxKind.ExportKeyword = 84] = "ExportKeyword", SyntaxKind[SyntaxKind.ExtendsKeyword = 85] = "ExtendsKeyword", SyntaxKind[SyntaxKind.FalseKeyword = 86] = "FalseKeyword", SyntaxKind[SyntaxKind.FinallyKeyword = 87] = "FinallyKeyword", SyntaxKind[SyntaxKind.ForKeyword = 88] = "ForKeyword", SyntaxKind[SyntaxKind.FunctionKeyword = 89] = "FunctionKeyword", SyntaxKind[SyntaxKind.IfKeyword = 90] = "IfKeyword", SyntaxKind[SyntaxKind.ImportKeyword = 91] = "ImportKeyword", SyntaxKind[SyntaxKind.InKeyword = 92] = "InKeyword", SyntaxKind[SyntaxKind.InstanceOfKeyword = 93] = "InstanceOfKeyword", SyntaxKind[SyntaxKind.NewKeyword = 94] = "NewKeyword", SyntaxKind[SyntaxKind.NullKeyword = 95] = "NullKeyword", SyntaxKind[SyntaxKind.ReturnKeyword = 96] = "ReturnKeyword", SyntaxKind[SyntaxKind.SuperKeyword = 97] = "SuperKeyword", SyntaxKind[SyntaxKind.SwitchKeyword = 98] = "SwitchKeyword", SyntaxKind[SyntaxKind.ThisKeyword = 99] = "ThisKeyword", SyntaxKind[SyntaxKind.ThrowKeyword = 100] = "ThrowKeyword", SyntaxKind[SyntaxKind.TrueKeyword = 101] = "TrueKeyword", SyntaxKind[SyntaxKind.TryKeyword = 102] = "TryKeyword", SyntaxKind[SyntaxKind.TypeOfKeyword = 103] = "TypeOfKeyword", SyntaxKind[SyntaxKind.VarKeyword = 104] = "VarKeyword", SyntaxKind[SyntaxKind.VoidKeyword = 105] = "VoidKeyword", SyntaxKind[SyntaxKind.WhileKeyword = 106] = "WhileKeyword", SyntaxKind[SyntaxKind.WithKeyword = 107] = "WithKeyword", SyntaxKind[SyntaxKind.ImplementsKeyword = 108] = "ImplementsKeyword", SyntaxKind[SyntaxKind.InterfaceKeyword = 109] = "InterfaceKeyword", SyntaxKind[SyntaxKind.LetKeyword = 110] = "LetKeyword", SyntaxKind[SyntaxKind.PackageKeyword = 111] = "PackageKeyword", SyntaxKind[SyntaxKind.PrivateKeyword = 112] = "PrivateKeyword", SyntaxKind[SyntaxKind.ProtectedKeyword = 113] = "ProtectedKeyword", SyntaxKind[SyntaxKind.PublicKeyword = 114] = "PublicKeyword", SyntaxKind[SyntaxKind.StaticKeyword = 115] = "StaticKeyword", SyntaxKind[SyntaxKind.YieldKeyword = 116] = "YieldKeyword", SyntaxKind[SyntaxKind.AbstractKeyword = 117] = "AbstractKeyword", SyntaxKind[SyntaxKind.AsKeyword = 118] = "AsKeyword", SyntaxKind[SyntaxKind.AnyKeyword = 119] = "AnyKeyword", SyntaxKind[SyntaxKind.AsyncKeyword = 120] = "AsyncKeyword", SyntaxKind[SyntaxKind.AwaitKeyword = 121] = "AwaitKeyword", SyntaxKind[SyntaxKind.BooleanKeyword = 122] = "BooleanKeyword", SyntaxKind[SyntaxKind.ConstructorKeyword = 123] = "ConstructorKeyword", SyntaxKind[SyntaxKind.DeclareKeyword = 124] = "DeclareKeyword", SyntaxKind[SyntaxKind.GetKeyword = 125] = "GetKeyword", SyntaxKind[SyntaxKind.InferKeyword = 126] = "InferKeyword", SyntaxKind[SyntaxKind.IsKeyword = 127] = "IsKeyword", SyntaxKind[SyntaxKind.KeyOfKeyword = 128] = "KeyOfKeyword", SyntaxKind[SyntaxKind.ModuleKeyword = 129] = "ModuleKeyword", SyntaxKind[SyntaxKind.NamespaceKeyword = 130] = "NamespaceKeyword", SyntaxKind[SyntaxKind.NeverKeyword = 131] = "NeverKeyword", SyntaxKind[SyntaxKind.ReadonlyKeyword = 132] = "ReadonlyKeyword", SyntaxKind[SyntaxKind.RequireKeyword = 133] = "RequireKeyword", SyntaxKind[SyntaxKind.NumberKeyword = 134] = "NumberKeyword", SyntaxKind[SyntaxKind.ObjectKeyword = 135] = "ObjectKeyword", SyntaxKind[SyntaxKind.SetKeyword = 136] = "SetKeyword", SyntaxKind[SyntaxKind.StringKeyword = 137] = "StringKeyword", SyntaxKind[SyntaxKind.SymbolKeyword = 138] = "SymbolKeyword", SyntaxKind[SyntaxKind.TypeKeyword = 139] = "TypeKeyword", SyntaxKind[SyntaxKind.UndefinedKeyword = 140] = "UndefinedKeyword", SyntaxKind[SyntaxKind.UniqueKeyword = 141] = "UniqueKeyword", SyntaxKind[SyntaxKind.FromKeyword = 142] = "FromKeyword", SyntaxKind[SyntaxKind.GlobalKeyword = 143] = "GlobalKeyword", SyntaxKind[SyntaxKind.OfKeyword = 144] = "OfKeyword", SyntaxKind[SyntaxKind.QualifiedName = 145] = "QualifiedName", SyntaxKind[SyntaxKind.ComputedPropertyName = 146] = "ComputedPropertyName", SyntaxKind[SyntaxKind.TypeParameter = 147] = "TypeParameter", SyntaxKind[SyntaxKind.Parameter = 148] = "Parameter", SyntaxKind[SyntaxKind.Decorator = 149] = "Decorator", SyntaxKind[SyntaxKind.PropertySignature = 150] = "PropertySignature", SyntaxKind[SyntaxKind.PropertyDeclaration = 151] = "PropertyDeclaration", SyntaxKind[SyntaxKind.MethodSignature = 152] = "MethodSignature", SyntaxKind[SyntaxKind.MethodDeclaration = 153] = "MethodDeclaration", SyntaxKind[SyntaxKind.Constructor = 154] = "Constructor", SyntaxKind[SyntaxKind.GetAccessor = 155] = "GetAccessor", SyntaxKind[SyntaxKind.SetAccessor = 156] = "SetAccessor", SyntaxKind[SyntaxKind.CallSignature = 157] = "CallSignature", SyntaxKind[SyntaxKind.ConstructSignature = 158] = "ConstructSignature", SyntaxKind[SyntaxKind.IndexSignature = 159] = "IndexSignature", SyntaxKind[SyntaxKind.TypePredicate = 160] = "TypePredicate", SyntaxKind[SyntaxKind.TypeReference = 161] = "TypeReference", SyntaxKind[SyntaxKind.FunctionType = 162] = "FunctionType", SyntaxKind[SyntaxKind.ConstructorType = 163] = "ConstructorType", SyntaxKind[SyntaxKind.TypeQuery = 164] = "TypeQuery", SyntaxKind[SyntaxKind.TypeLiteral = 165] = "TypeLiteral", SyntaxKind[SyntaxKind.ArrayType = 166] = "ArrayType", SyntaxKind[SyntaxKind.TupleType = 167] = "TupleType", SyntaxKind[SyntaxKind.UnionType = 168] = "UnionType", SyntaxKind[SyntaxKind.IntersectionType = 169] = "IntersectionType", SyntaxKind[SyntaxKind.ConditionalType = 170] = "ConditionalType", SyntaxKind[SyntaxKind.InferType = 171] = "InferType", SyntaxKind[SyntaxKind.ParenthesizedType = 172] = "ParenthesizedType", SyntaxKind[SyntaxKind.ThisType = 173] = "ThisType", SyntaxKind[SyntaxKind.TypeOperator = 174] = "TypeOperator", SyntaxKind[SyntaxKind.IndexedAccessType = 175] = "IndexedAccessType", SyntaxKind[SyntaxKind.MappedType = 176] = "MappedType", SyntaxKind[SyntaxKind.LiteralType = 177] = "LiteralType", SyntaxKind[SyntaxKind.ImportType = 178] = "ImportType", SyntaxKind[SyntaxKind.ObjectBindingPattern = 179] = "ObjectBindingPattern", SyntaxKind[SyntaxKind.ArrayBindingPattern = 180] = "ArrayBindingPattern", SyntaxKind[SyntaxKind.BindingElement = 181] = "BindingElement", SyntaxKind[SyntaxKind.ArrayLiteralExpression = 182] = "ArrayLiteralExpression", SyntaxKind[SyntaxKind.ObjectLiteralExpression = 183] = "ObjectLiteralExpression", SyntaxKind[SyntaxKind.PropertyAccessExpression = 184] = "PropertyAccessExpression", SyntaxKind[SyntaxKind.ElementAccessExpression = 185] = "ElementAccessExpression", SyntaxKind[SyntaxKind.CallExpression = 186] = "CallExpression", SyntaxKind[SyntaxKind.NewExpression = 187] = "NewExpression", SyntaxKind[SyntaxKind.TaggedTemplateExpression = 188] = "TaggedTemplateExpression", SyntaxKind[SyntaxKind.TypeAssertionExpression = 189] = "TypeAssertionExpression", SyntaxKind[SyntaxKind.ParenthesizedExpression = 190] = "ParenthesizedExpression", SyntaxKind[SyntaxKind.FunctionExpression = 191] = "FunctionExpression", SyntaxKind[SyntaxKind.ArrowFunction = 192] = "ArrowFunction", SyntaxKind[SyntaxKind.DeleteExpression = 193] = "DeleteExpression", SyntaxKind[SyntaxKind.TypeOfExpression = 194] = "TypeOfExpression", SyntaxKind[SyntaxKind.VoidExpression = 195] = "VoidExpression", SyntaxKind[SyntaxKind.AwaitExpression = 196] = "AwaitExpression", SyntaxKind[SyntaxKind.PrefixUnaryExpression = 197] = "PrefixUnaryExpression", SyntaxKind[SyntaxKind.PostfixUnaryExpression = 198] = "PostfixUnaryExpression", SyntaxKind[SyntaxKind.BinaryExpression = 199] = "BinaryExpression"; SyntaxKind[SyntaxKind.ConditionalExpression = 200] = "ConditionalExpression"; SyntaxKind[SyntaxKind.TemplateExpression = 201] = "TemplateExpression", SyntaxKind[SyntaxKind.YieldExpression = 202] = "YieldExpression", SyntaxKind[SyntaxKind.SpreadElement = 203] = "SpreadElement", SyntaxKind[SyntaxKind.ClassExpression = 204] = "ClassExpression", SyntaxKind[SyntaxKind.OmittedExpression = 205] = "OmittedExpression", SyntaxKind[SyntaxKind.ExpressionWithTypeArguments = 206] = "ExpressionWithTypeArguments", SyntaxKind[SyntaxKind.AsExpression = 207] = "AsExpression", SyntaxKind[SyntaxKind.NonNullExpression = 208] = "NonNullExpression", SyntaxKind[SyntaxKind.MetaProperty = 209] = "MetaProperty", SyntaxKind[SyntaxKind.TemplateSpan = 210] = "TemplateSpan", SyntaxKind[SyntaxKind.SemicolonClassElement = 211] = "SemicolonClassElement", SyntaxKind[SyntaxKind.Block = 212] = "Block", SyntaxKind[SyntaxKind.VariableStatement = 213] = "VariableStatement", SyntaxKind[SyntaxKind.EmptyStatement = 214] = "EmptyStatement", SyntaxKind[SyntaxKind.ExpressionStatement = 215] = "ExpressionStatement", SyntaxKind[SyntaxKind.IfStatement = 216] = "IfStatement", SyntaxKind[SyntaxKind.DoStatement = 217] = "DoStatement", SyntaxKind[SyntaxKind.WhileStatement = 218] = "WhileStatement", SyntaxKind[SyntaxKind.ForStatement = 219] = "ForStatement", SyntaxKind[SyntaxKind.ForInStatement = 220] = "ForInStatement", SyntaxKind[SyntaxKind.ForOfStatement = 221] = "ForOfStatement", SyntaxKind[SyntaxKind.ContinueStatement = 222] = "ContinueStatement", SyntaxKind[SyntaxKind.BreakStatement = 223] = "BreakStatement", SyntaxKind[SyntaxKind.ReturnStatement = 224] = "ReturnStatement", SyntaxKind[SyntaxKind.WithStatement = 225] = "WithStatement", SyntaxKind[SyntaxKind.SwitchStatement = 226] = "SwitchStatement", SyntaxKind[SyntaxKind.LabeledStatement = 227] = "LabeledStatement", SyntaxKind[SyntaxKind.ThrowStatement = 228] = "ThrowStatement", SyntaxKind[SyntaxKind.TryStatement = 229] = "TryStatement", SyntaxKind[SyntaxKind.DebuggerStatement = 230] = "DebuggerStatement", SyntaxKind[SyntaxKind.VariableDeclaration = 231] = "VariableDeclaration", SyntaxKind[SyntaxKind.VariableDeclarationList = 232] = "VariableDeclarationList", SyntaxKind[SyntaxKind.FunctionDeclaration = 233] = "FunctionDeclaration", SyntaxKind[SyntaxKind.ClassDeclaration = 234] = "ClassDeclaration", SyntaxKind[SyntaxKind.InterfaceDeclaration = 235] = "InterfaceDeclaration", SyntaxKind[SyntaxKind.TypeAliasDeclaration = 236] = "TypeAliasDeclaration", SyntaxKind[SyntaxKind.EnumDeclaration = 237] = "EnumDeclaration", SyntaxKind[SyntaxKind.ModuleDeclaration = 238] = "ModuleDeclaration", SyntaxKind[SyntaxKind.ModuleBlock = 239] = "ModuleBlock", SyntaxKind[SyntaxKind.CaseBlock = 240] = "CaseBlock", SyntaxKind[SyntaxKind.NamespaceExportDeclaration = 241] = "NamespaceExportDeclaration", SyntaxKind[SyntaxKind.ImportEqualsDeclaration = 242] = "ImportEqualsDeclaration", SyntaxKind[SyntaxKind.ImportDeclaration = 243] = "ImportDeclaration", SyntaxKind[SyntaxKind.ImportClause = 244] = "ImportClause", SyntaxKind[SyntaxKind.NamespaceImport = 245] = "NamespaceImport", SyntaxKind[SyntaxKind.NamedImports = 246] = "NamedImports", SyntaxKind[SyntaxKind.ImportSpecifier = 247] = "ImportSpecifier", SyntaxKind[SyntaxKind.ExportAssignment = 248] = "ExportAssignment", SyntaxKind[SyntaxKind.ExportDeclaration = 249] = "ExportDeclaration", SyntaxKind[SyntaxKind.NamedExports = 250] = "NamedExports", SyntaxKind[SyntaxKind.ExportSpecifier = 251] = "ExportSpecifier", SyntaxKind[SyntaxKind.MissingDeclaration = 252] = "MissingDeclaration", SyntaxKind[SyntaxKind.ExternalModuleReference = 253] = "ExternalModuleReference", SyntaxKind[SyntaxKind.JsxElement = 254] = "JsxElement", SyntaxKind[SyntaxKind.JsxSelfClosingElement = 255] = "JsxSelfClosingElement", SyntaxKind[SyntaxKind.JsxOpeningElement = 256] = "JsxOpeningElement", SyntaxKind[SyntaxKind.JsxClosingElement = 257] = "JsxClosingElement", SyntaxKind[SyntaxKind.JsxFragment = 258] = "JsxFragment", SyntaxKind[SyntaxKind.JsxOpeningFragment = 259] = "JsxOpeningFragment", SyntaxKind[SyntaxKind.JsxClosingFragment = 260] = "JsxClosingFragment", SyntaxKind[SyntaxKind.JsxAttribute = 261] = "JsxAttribute", SyntaxKind[SyntaxKind.JsxAttributes = 262] = "JsxAttributes", SyntaxKind[SyntaxKind.JsxSpreadAttribute = 263] = "JsxSpreadAttribute", SyntaxKind[SyntaxKind.JsxExpression = 264] = "JsxExpression", SyntaxKind[SyntaxKind.CaseClause = 265] = "CaseClause", SyntaxKind[SyntaxKind.DefaultClause = 266] = "DefaultClause", SyntaxKind[SyntaxKind.HeritageClause = 267] = "HeritageClause", SyntaxKind[SyntaxKind.CatchClause = 268] = "CatchClause", SyntaxKind[SyntaxKind.PropertyAssignment = 269] = "PropertyAssignment", SyntaxKind[SyntaxKind.ShorthandPropertyAssignment = 270] = "ShorthandPropertyAssignment", SyntaxKind[SyntaxKind.SpreadAssignment = 271] = "SpreadAssignment", SyntaxKind[SyntaxKind.EnumMember = 272] = "EnumMember", SyntaxKind[SyntaxKind.SourceFile = 273] = "SourceFile", SyntaxKind[SyntaxKind.Bundle = 274] = "Bundle", SyntaxKind[SyntaxKind.UnparsedSource = 275] = "UnparsedSource", SyntaxKind[SyntaxKind.InputFiles = 276] = "InputFiles", SyntaxKind[SyntaxKind.JSDocTypeExpression = 277] = "JSDocTypeExpression", SyntaxKind[SyntaxKind.JSDocAllType = 278] = "JSDocAllType", SyntaxKind[SyntaxKind.JSDocUnknownType = 279] = "JSDocUnknownType", SyntaxKind[SyntaxKind.JSDocNullableType = 280] = "JSDocNullableType", SyntaxKind[SyntaxKind.JSDocNonNullableType = 281] = "JSDocNonNullableType", SyntaxKind[SyntaxKind.JSDocOptionalType = 282] = "JSDocOptionalType", SyntaxKind[SyntaxKind.JSDocFunctionType = 283] = "JSDocFunctionType", SyntaxKind[SyntaxKind.JSDocVariadicType = 284] = "JSDocVariadicType", SyntaxKind[SyntaxKind.JSDocComment = 285] = "JSDocComment", SyntaxKind[SyntaxKind.JSDocTypeLiteral = 286] = "JSDocTypeLiteral", SyntaxKind[SyntaxKind.JSDocSignature = 287] = "JSDocSignature", SyntaxKind[SyntaxKind.JSDocTag = 288] = "JSDocTag", SyntaxKind[SyntaxKind.JSDocAugmentsTag = 289] = "JSDocAugmentsTag", SyntaxKind[SyntaxKind.JSDocClassTag = 290] = "JSDocClassTag", SyntaxKind[SyntaxKind.JSDocCallbackTag = 291] = "JSDocCallbackTag", SyntaxKind[SyntaxKind.JSDocParameterTag = 292] = "JSDocParameterTag", SyntaxKind[SyntaxKind.JSDocReturnTag = 293] = "JSDocReturnTag", SyntaxKind[SyntaxKind.JSDocTypeTag = 294] = "JSDocTypeTag", SyntaxKind[SyntaxKind.JSDocTemplateTag = 295] = "JSDocTemplateTag", SyntaxKind[SyntaxKind.JSDocTypedefTag = 296] = "JSDocTypedefTag", SyntaxKind[SyntaxKind.JSDocPropertyTag = 297] = "JSDocPropertyTag", SyntaxKind[SyntaxKind.SyntaxList = 298] = "SyntaxList", SyntaxKind[SyntaxKind.NotEmittedStatement = 299] = "NotEmittedStatement", SyntaxKind[SyntaxKind.PartiallyEmittedExpression = 300] = "PartiallyEmittedExpression", SyntaxKind[SyntaxKind.CommaListExpression = 301] = "CommaListExpression", SyntaxKind[SyntaxKind.MergeDeclarationMarker = 302] = "MergeDeclarationMarker", SyntaxKind[SyntaxKind.EndOfDeclarationMarker = 303] = "EndOfDeclarationMarker", SyntaxKind[SyntaxKind.Count = 304] = "Count", SyntaxKind[SyntaxKind.FirstAssignment = 58] = "FirstAssignment", SyntaxKind[SyntaxKind.LastAssignment = 70] = "LastAssignment", SyntaxKind[SyntaxKind.FirstCompoundAssignment = 59] = "FirstCompoundAssignment", SyntaxKind[SyntaxKind.LastCompoundAssignment = 70] = "LastCompoundAssignment", SyntaxKind[SyntaxKind.FirstReservedWord = 72] = "FirstReservedWord", SyntaxKind[SyntaxKind.LastReservedWord = 107] = "LastReservedWord", SyntaxKind[SyntaxKind.FirstKeyword = 72] = "FirstKeyword", SyntaxKind[SyntaxKind.LastKeyword = 144] = "LastKeyword", SyntaxKind[SyntaxKind.FirstFutureReservedWord = 108] = "FirstFutureReservedWord", SyntaxKind[SyntaxKind.LastFutureReservedWord = 116] = "LastFutureReservedWord", SyntaxKind[SyntaxKind.FirstTypeNode = 160] = "FirstTypeNode", SyntaxKind[SyntaxKind.LastTypeNode = 178] = "LastTypeNode", SyntaxKind[SyntaxKind.FirstPunctuation = 17] = "FirstPunctuation", SyntaxKind[SyntaxKind.LastPunctuation = 70] = "LastPunctuation", SyntaxKind[SyntaxKind.FirstToken = 0] = "FirstToken", SyntaxKind[SyntaxKind.LastToken = 144] = "LastToken", SyntaxKind[SyntaxKind.FirstTriviaToken = 2] = "FirstTriviaToken", SyntaxKind[SyntaxKind.LastTriviaToken = 7] = "LastTriviaToken", SyntaxKind[SyntaxKind.FirstLiteralToken = 8] = "FirstLiteralToken", SyntaxKind[SyntaxKind.LastLiteralToken = 13] = "LastLiteralToken", SyntaxKind[SyntaxKind.FirstTemplateToken = 13] = "FirstTemplateToken", SyntaxKind[SyntaxKind.LastTemplateToken = 16] = "LastTemplateToken", SyntaxKind[SyntaxKind.FirstBinaryOperator = 27] = "FirstBinaryOperator", SyntaxKind[SyntaxKind.LastBinaryOperator = 70] = "LastBinaryOperator", SyntaxKind[SyntaxKind.FirstNode = 145] = "FirstNode", SyntaxKind[SyntaxKind.FirstJSDocNode = 277] = "FirstJSDocNode", SyntaxKind[SyntaxKind.LastJSDocNode = 297] = "LastJSDocNode", SyntaxKind[SyntaxKind.FirstJSDocTagNode = 288] = "FirstJSDocTagNode", SyntaxKind[SyntaxKind.LastJSDocTagNode = 297] = "LastJSDocTagNode", SyntaxKind[SyntaxKind.FirstContextualKeyword = 117] = "FirstContextualKeyword", SyntaxKind[SyntaxKind.LastContextualKeyword = 144] = "LastContextualKeyword" }(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; !function (NodeFlags) { NodeFlags[NodeFlags.None = 0] = "None", NodeFlags[NodeFlags.Let = 1] = "Let", NodeFlags[NodeFlags.Const = 2] = "Const", NodeFlags[NodeFlags.NestedNamespace = 4] = "NestedNamespace", NodeFlags[NodeFlags.Synthesized = 8] = "Synthesized", NodeFlags[NodeFlags.Namespace = 16] = "Namespace", NodeFlags[NodeFlags.ExportContext = 32] = "ExportContext", NodeFlags[NodeFlags.ContainsThis = 64] = "ContainsThis", NodeFlags[NodeFlags.HasImplicitReturn = 128] = "HasImplicitReturn", NodeFlags[NodeFlags.HasExplicitReturn = 256] = "HasExplicitReturn", NodeFlags[NodeFlags.GlobalAugmentation = 512] = "GlobalAugmentation", NodeFlags[NodeFlags.HasAsyncFunctions = 1024] = "HasAsyncFunctions", NodeFlags[NodeFlags.DisallowInContext = 2048] = "DisallowInContext", NodeFlags[NodeFlags.YieldContext = 4096] = "YieldContext", NodeFlags[NodeFlags.DecoratorContext = 8192] = "DecoratorContext", NodeFlags[NodeFlags.AwaitContext = 16384] = "AwaitContext", NodeFlags[NodeFlags.ThisNodeHasError = 32768] = "ThisNodeHasError", NodeFlags[NodeFlags.JavaScriptFile = 65536] = "JavaScriptFile", NodeFlags[NodeFlags.ThisNodeOrAnySubNodesHasError = 131072] = "ThisNodeOrAnySubNodesHasError", NodeFlags[NodeFlags.HasAggregatedChildData = 262144] = "HasAggregatedChildData", NodeFlags[NodeFlags.PossiblyContainsDynamicImport = 524288] = "PossiblyContainsDynamicImport", NodeFlags[NodeFlags.PossiblyContainsImportMeta = 1048576] = "PossiblyContainsImportMeta", NodeFlags[NodeFlags.JSDoc = 2097152] = "JSDoc", NodeFlags[NodeFlags.Ambient = 4194304] = "Ambient", NodeFlags[NodeFlags.InWithStatement = 8388608] = "InWithStatement", NodeFlags[NodeFlags.JsonFile = 16777216] = "JsonFile", NodeFlags[NodeFlags.BlockScoped = 3] = "BlockScoped", NodeFlags[NodeFlags.ReachabilityCheckFlags = 384] = "ReachabilityCheckFlags", NodeFlags[NodeFlags.ReachabilityAndEmitFlags = 1408] = "ReachabilityAndEmitFlags", NodeFlags[NodeFlags.ContextFlags = 12679168] = "ContextFlags", NodeFlags[NodeFlags.TypeExcludesFlags = 20480] = "TypeExcludesFlags", NodeFlags[NodeFlags.PermanentlySetIncrementalFlags = 1572864] = "PermanentlySetIncrementalFlags" }(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); var ModifierFlags; !function (ModifierFlags) { ModifierFlags[ModifierFlags.None = 0] = "None", ModifierFlags[ModifierFlags.Export = 1] = "Export", ModifierFlags[ModifierFlags.Ambient = 2] = "Ambient", ModifierFlags[ModifierFlags.Public = 4] = "Public", ModifierFlags[ModifierFlags.Private = 8] = "Private", ModifierFlags[ModifierFlags.Protected = 16] = "Protected", ModifierFlags[ModifierFlags.Static = 32] = "Static", ModifierFlags[ModifierFlags.Readonly = 64] = "Readonly", ModifierFlags[ModifierFlags.Abstract = 128] = "Abstract", ModifierFlags[ModifierFlags.Async = 256] = "Async", ModifierFlags[ModifierFlags.Default = 512] = "Default", ModifierFlags[ModifierFlags.Const = 2048] = "Const", ModifierFlags[ModifierFlags.HasComputedFlags = 536870912] = "HasComputedFlags", ModifierFlags[ModifierFlags.AccessibilityModifier = 28] = "AccessibilityModifier", ModifierFlags[ModifierFlags.ParameterPropertyModifier = 92] = "ParameterPropertyModifier", ModifierFlags[ModifierFlags.NonPublicAccessibilityModifier = 24] = "NonPublicAccessibilityModifier", ModifierFlags[ModifierFlags.TypeScriptModifier = 2270] = "TypeScriptModifier", ModifierFlags[ModifierFlags.ExportDefault = 513] = "ExportDefault", ModifierFlags[ModifierFlags.All = 3071] = "All" }(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; !function (JsxFlags) { JsxFlags[JsxFlags.None = 0] = "None", JsxFlags[JsxFlags.IntrinsicNamedElement = 1] = "IntrinsicNamedElement", JsxFlags[JsxFlags.IntrinsicIndexedElement = 2] = "IntrinsicIndexedElement", JsxFlags[JsxFlags.IntrinsicElement = 3] = "IntrinsicElement" }(JsxFlags = ts.JsxFlags || (ts.JsxFlags = {})); var RelationComparisonResult; !function (RelationComparisonResult) { RelationComparisonResult[RelationComparisonResult.Succeeded = 1] = "Succeeded", RelationComparisonResult[RelationComparisonResult.Failed = 2] = "Failed", RelationComparisonResult[RelationComparisonResult.FailedAndReported = 3] = "FailedAndReported" }(RelationComparisonResult = ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); var GeneratedIdentifierFlags; !function (GeneratedIdentifierFlags) { GeneratedIdentifierFlags[GeneratedIdentifierFlags.None = 0] = "None", GeneratedIdentifierFlags[GeneratedIdentifierFlags.Auto = 1] = "Auto", GeneratedIdentifierFlags[GeneratedIdentifierFlags.Loop = 2] = "Loop", GeneratedIdentifierFlags[GeneratedIdentifierFlags.Unique = 3] = "Unique", GeneratedIdentifierFlags[GeneratedIdentifierFlags.Node = 4] = "Node", GeneratedIdentifierFlags[GeneratedIdentifierFlags.KindMask = 7] = "KindMask", GeneratedIdentifierFlags[GeneratedIdentifierFlags.ReservedInNestedScopes = 8] = "ReservedInNestedScopes", GeneratedIdentifierFlags[GeneratedIdentifierFlags.Optimistic = 16] = "Optimistic", GeneratedIdentifierFlags[GeneratedIdentifierFlags.FileLevel = 32] = "FileLevel" }(GeneratedIdentifierFlags = ts.GeneratedIdentifierFlags || (ts.GeneratedIdentifierFlags = {})); var TokenFlags; !function (TokenFlags) { TokenFlags[TokenFlags.None = 0] = "None", TokenFlags[TokenFlags.PrecedingLineBreak = 1] = "PrecedingLineBreak", TokenFlags[TokenFlags.PrecedingJSDocComment = 2] = "PrecedingJSDocComment", TokenFlags[TokenFlags.Unterminated = 4] = "Unterminated", TokenFlags[TokenFlags.ExtendedUnicodeEscape = 8] = "ExtendedUnicodeEscape", TokenFlags[TokenFlags.Scientific = 16] = "Scientific", TokenFlags[TokenFlags.Octal = 32] = "Octal", TokenFlags[TokenFlags.HexSpecifier = 64] = "HexSpecifier", TokenFlags[TokenFlags.BinarySpecifier = 128] = "BinarySpecifier", TokenFlags[TokenFlags.OctalSpecifier = 256] = "OctalSpecifier", TokenFlags[TokenFlags.ContainsSeparator = 512] = "ContainsSeparator", TokenFlags[TokenFlags.BinaryOrOctalSpecifier = 384] = "BinaryOrOctalSpecifier", TokenFlags[TokenFlags.NumericLiteralFlags = 1008] = "NumericLiteralFlags" }(TokenFlags = ts.TokenFlags || (ts.TokenFlags = {})); var FlowFlags; !function (FlowFlags) { FlowFlags[FlowFlags.Unreachable = 1] = "Unreachable", FlowFlags[FlowFlags.Start = 2] = "Start", FlowFlags[FlowFlags.BranchLabel = 4] = "BranchLabel", FlowFlags[FlowFlags.LoopLabel = 8] = "LoopLabel", FlowFlags[FlowFlags.Assignment = 16] = "Assignment", FlowFlags[FlowFlags.TrueCondition = 32] = "TrueCondition", FlowFlags[FlowFlags.FalseCondition = 64] = "FalseCondition", FlowFlags[FlowFlags.SwitchClause = 128] = "SwitchClause", FlowFlags[FlowFlags.ArrayMutation = 256] = "ArrayMutation", FlowFlags[FlowFlags.Referenced = 512] = "Referenced", FlowFlags[FlowFlags.Shared = 1024] = "Shared", FlowFlags[FlowFlags.PreFinally = 2048] = "PreFinally", FlowFlags[FlowFlags.AfterFinally = 4096] = "AfterFinally", FlowFlags[FlowFlags.Label = 12] = "Label", FlowFlags[FlowFlags.Condition = 96] = "Condition" }(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {})); var OperationCanceledException = function () { function OperationCanceledException() { } return OperationCanceledException }(); ts.OperationCanceledException = OperationCanceledException; var StructureIsReused; !function (StructureIsReused) { StructureIsReused[StructureIsReused.Not = 0] = "Not", StructureIsReused[StructureIsReused.SafeModules = 1] = "SafeModules", StructureIsReused[StructureIsReused.Completely = 2] = "Completely" }(StructureIsReused = ts.StructureIsReused || (ts.StructureIsReused = {})); var ExitStatus; !function (ExitStatus) { ExitStatus[ExitStatus.Success = 0] = "Success", ExitStatus[ExitStatus.DiagnosticsPresent_OutputsSkipped = 1] = "DiagnosticsPresent_OutputsSkipped", ExitStatus[ExitStatus.DiagnosticsPresent_OutputsGenerated = 2] = "DiagnosticsPresent_OutputsGenerated" }(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); var UnionReduction; !function (UnionReduction) { UnionReduction[UnionReduction.None = 0] = "None", UnionReduction[UnionReduction.Literal = 1] = "Literal", UnionReduction[UnionReduction.Subtype = 2] = "Subtype" }(UnionReduction = ts.UnionReduction || (ts.UnionReduction = {})); var NodeBuilderFlags; !function (NodeBuilderFlags) { NodeBuilderFlags[NodeBuilderFlags.None = 0] = "None", NodeBuilderFlags[NodeBuilderFlags.NoTruncation = 1] = "NoTruncation", NodeBuilderFlags[NodeBuilderFlags.WriteArrayAsGenericType = 2] = "WriteArrayAsGenericType", NodeBuilderFlags[NodeBuilderFlags.GenerateNamesForShadowedTypeParams = 4] = "GenerateNamesForShadowedTypeParams", NodeBuilderFlags[NodeBuilderFlags.UseStructuralFallback = 8] = "UseStructuralFallback", NodeBuilderFlags[NodeBuilderFlags.ForbidIndexedAccessSymbolReferences = 16] = "ForbidIndexedAccessSymbolReferences", NodeBuilderFlags[NodeBuilderFlags.WriteTypeArgumentsOfSignature = 32] = "WriteTypeArgumentsOfSignature", NodeBuilderFlags[NodeBuilderFlags.UseFullyQualifiedType = 64] = "UseFullyQualifiedType", NodeBuilderFlags[NodeBuilderFlags.UseOnlyExternalAliasing = 128] = "UseOnlyExternalAliasing", NodeBuilderFlags[NodeBuilderFlags.SuppressAnyReturnType = 256] = "SuppressAnyReturnType", NodeBuilderFlags[NodeBuilderFlags.WriteTypeParametersInQualifiedName = 512] = "WriteTypeParametersInQualifiedName", NodeBuilderFlags[NodeBuilderFlags.MultilineObjectLiterals = 1024] = "MultilineObjectLiterals", NodeBuilderFlags[NodeBuilderFlags.WriteClassExpressionAsTypeLiteral = 2048] = "WriteClassExpressionAsTypeLiteral", NodeBuilderFlags[NodeBuilderFlags.UseTypeOfFunction = 4096] = "UseTypeOfFunction", NodeBuilderFlags[NodeBuilderFlags.OmitParameterModifiers = 8192] = "OmitParameterModifiers", NodeBuilderFlags[NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope = 16384] = "UseAliasDefinedOutsideCurrentScope", NodeBuilderFlags[NodeBuilderFlags.AllowThisInObjectLiteral = 32768] = "AllowThisInObjectLiteral", NodeBuilderFlags[NodeBuilderFlags.AllowQualifedNameInPlaceOfIdentifier = 65536] = "AllowQualifedNameInPlaceOfIdentifier", NodeBuilderFlags[NodeBuilderFlags.AllowAnonymousIdentifier = 131072] = "AllowAnonymousIdentifier", NodeBuilderFlags[NodeBuilderFlags.AllowEmptyUnionOrIntersection = 262144] = "AllowEmptyUnionOrIntersection", NodeBuilderFlags[NodeBuilderFlags.AllowEmptyTuple = 524288] = "AllowEmptyTuple", NodeBuilderFlags[NodeBuilderFlags.AllowUniqueESSymbolType = 1048576] = "AllowUniqueESSymbolType", NodeBuilderFlags[NodeBuilderFlags.AllowEmptyIndexInfoType = 2097152] = "AllowEmptyIndexInfoType", NodeBuilderFlags[NodeBuilderFlags.IgnoreErrors = 3112960] = "IgnoreErrors", NodeBuilderFlags[NodeBuilderFlags.InObjectTypeLiteral = 4194304] = "InObjectTypeLiteral", NodeBuilderFlags[NodeBuilderFlags.InTypeAlias = 8388608] = "InTypeAlias", NodeBuilderFlags[NodeBuilderFlags.InInitialEntityName = 16777216] = "InInitialEntityName", NodeBuilderFlags[NodeBuilderFlags.InReverseMappedType = 33554432] = "InReverseMappedType" }(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {})); var TypeFormatFlags; !function (TypeFormatFlags) { TypeFormatFlags[TypeFormatFlags.None = 0] = "None", TypeFormatFlags[TypeFormatFlags.NoTruncation = 1] = "NoTruncation", TypeFormatFlags[TypeFormatFlags.WriteArrayAsGenericType = 2] = "WriteArrayAsGenericType", TypeFormatFlags[TypeFormatFlags.UseStructuralFallback = 8] = "UseStructuralFallback", TypeFormatFlags[TypeFormatFlags.WriteTypeArgumentsOfSignature = 32] = "WriteTypeArgumentsOfSignature", TypeFormatFlags[TypeFormatFlags.UseFullyQualifiedType = 64] = "UseFullyQualifiedType", TypeFormatFlags[TypeFormatFlags.SuppressAnyReturnType = 256] = "SuppressAnyReturnType", TypeFormatFlags[TypeFormatFlags.MultilineObjectLiterals = 1024] = "MultilineObjectLiterals", TypeFormatFlags[TypeFormatFlags.WriteClassExpressionAsTypeLiteral = 2048] = "WriteClassExpressionAsTypeLiteral", TypeFormatFlags[TypeFormatFlags.UseTypeOfFunction = 4096] = "UseTypeOfFunction", TypeFormatFlags[TypeFormatFlags.OmitParameterModifiers = 8192] = "OmitParameterModifiers", TypeFormatFlags[TypeFormatFlags.UseAliasDefinedOutsideCurrentScope = 16384] = "UseAliasDefinedOutsideCurrentScope", TypeFormatFlags[TypeFormatFlags.AllowUniqueESSymbolType = 1048576] = "AllowUniqueESSymbolType", TypeFormatFlags[TypeFormatFlags.AddUndefined = 131072] = "AddUndefined", TypeFormatFlags[TypeFormatFlags.WriteArrowStyleSignature = 262144] = "WriteArrowStyleSignature", TypeFormatFlags[TypeFormatFlags.InArrayType = 524288] = "InArrayType", TypeFormatFlags[TypeFormatFlags.InElementType = 2097152] = "InElementType", TypeFormatFlags[TypeFormatFlags.InFirstTypeArgument = 4194304] = "InFirstTypeArgument", TypeFormatFlags[TypeFormatFlags.InTypeAlias = 8388608] = "InTypeAlias", TypeFormatFlags[TypeFormatFlags.WriteOwnNameForAnyLike = 0] = "WriteOwnNameForAnyLike", TypeFormatFlags[TypeFormatFlags.NodeBuilderFlagsMask = 9469291] = "NodeBuilderFlagsMask" }(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var SymbolFormatFlags; !function (SymbolFormatFlags) { SymbolFormatFlags[SymbolFormatFlags.None = 0] = "None", SymbolFormatFlags[SymbolFormatFlags.WriteTypeParametersOrArguments = 1] = "WriteTypeParametersOrArguments", SymbolFormatFlags[SymbolFormatFlags.UseOnlyExternalAliasing = 2] = "UseOnlyExternalAliasing", SymbolFormatFlags[SymbolFormatFlags.AllowAnyNodeKind = 4] = "AllowAnyNodeKind", SymbolFormatFlags[SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope = 8] = "UseAliasDefinedOutsideCurrentScope" }(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); var SymbolAccessibility; !function (SymbolAccessibility) { SymbolAccessibility[SymbolAccessibility.Accessible = 0] = "Accessible", SymbolAccessibility[SymbolAccessibility.NotAccessible = 1] = "NotAccessible", SymbolAccessibility[SymbolAccessibility.CannotBeNamed = 2] = "CannotBeNamed" }(SymbolAccessibility = ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); var SyntheticSymbolKind; !function (SyntheticSymbolKind) { SyntheticSymbolKind[SyntheticSymbolKind.UnionOrIntersection = 0] = "UnionOrIntersection", SyntheticSymbolKind[SyntheticSymbolKind.Spread = 1] = "Spread" }(SyntheticSymbolKind = ts.SyntheticSymbolKind || (ts.SyntheticSymbolKind = {})); var TypePredicateKind; !function (TypePredicateKind) { TypePredicateKind[TypePredicateKind.This = 0] = "This", TypePredicateKind[TypePredicateKind.Identifier = 1] = "Identifier" }(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {})); var TypeReferenceSerializationKind; !function (TypeReferenceSerializationKind) { TypeReferenceSerializationKind[TypeReferenceSerializationKind.Unknown = 0] = "Unknown", TypeReferenceSerializationKind[TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue = 1] = "TypeWithConstructSignatureAndValue", TypeReferenceSerializationKind[TypeReferenceSerializationKind.VoidNullableOrNeverType = 2] = "VoidNullableOrNeverType", TypeReferenceSerializationKind[TypeReferenceSerializationKind.NumberLikeType = 3] = "NumberLikeType", TypeReferenceSerializationKind[TypeReferenceSerializationKind.StringLikeType = 4] = "StringLikeType", TypeReferenceSerializationKind[TypeReferenceSerializationKind.BooleanType = 5] = "BooleanType", TypeReferenceSerializationKind[TypeReferenceSerializationKind.ArrayLikeType = 6] = "ArrayLikeType", TypeReferenceSerializationKind[TypeReferenceSerializationKind.ESSymbolType = 7] = "ESSymbolType", TypeReferenceSerializationKind[TypeReferenceSerializationKind.Promise = 8] = "Promise", TypeReferenceSerializationKind[TypeReferenceSerializationKind.TypeWithCallSignature = 9] = "TypeWithCallSignature", TypeReferenceSerializationKind[TypeReferenceSerializationKind.ObjectType = 10] = "ObjectType" }(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); var SymbolFlags; !function (SymbolFlags) { SymbolFlags[SymbolFlags.None = 0] = "None", SymbolFlags[SymbolFlags.FunctionScopedVariable = 1] = "FunctionScopedVariable", SymbolFlags[SymbolFlags.BlockScopedVariable = 2] = "BlockScopedVariable", SymbolFlags[SymbolFlags.Property = 4] = "Property", SymbolFlags[SymbolFlags.EnumMember = 8] = "EnumMember", SymbolFlags[SymbolFlags.Function = 16] = "Function", SymbolFlags[SymbolFlags.Class = 32] = "Class", SymbolFlags[SymbolFlags.Interface = 64] = "Interface", SymbolFlags[SymbolFlags.ConstEnum = 128] = "ConstEnum", SymbolFlags[SymbolFlags.RegularEnum = 256] = "RegularEnum", SymbolFlags[SymbolFlags.ValueModule = 512] = "ValueModule", SymbolFlags[SymbolFlags.NamespaceModule = 1024] = "NamespaceModule", SymbolFlags[SymbolFlags.TypeLiteral = 2048] = "TypeLiteral", SymbolFlags[SymbolFlags.ObjectLiteral = 4096] = "ObjectLiteral", SymbolFlags[SymbolFlags.Method = 8192] = "Method", SymbolFlags[SymbolFlags.Constructor = 16384] = "Constructor", SymbolFlags[SymbolFlags.GetAccessor = 32768] = "GetAccessor", SymbolFlags[SymbolFlags.SetAccessor = 65536] = "SetAccessor", SymbolFlags[SymbolFlags.Signature = 131072] = "Signature", SymbolFlags[SymbolFlags.TypeParameter = 262144] = "TypeParameter", SymbolFlags[SymbolFlags.TypeAlias = 524288] = "TypeAlias", SymbolFlags[SymbolFlags.ExportValue = 1048576] = "ExportValue", SymbolFlags[SymbolFlags.Alias = 2097152] = "Alias", SymbolFlags[SymbolFlags.Prototype = 4194304] = "Prototype", SymbolFlags[SymbolFlags.ExportStar = 8388608] = "ExportStar", SymbolFlags[SymbolFlags.Optional = 16777216] = "Optional", SymbolFlags[SymbolFlags.Transient = 33554432] = "Transient", SymbolFlags[SymbolFlags.JSContainer = 67108864] = "JSContainer", SymbolFlags[SymbolFlags.All = 67108863] = "All", SymbolFlags[SymbolFlags.Enum = 384] = "Enum", SymbolFlags[SymbolFlags.Variable = 3] = "Variable", SymbolFlags[SymbolFlags.Value = 67216319] = "Value", SymbolFlags[SymbolFlags.Type = 67901928] = "Type", SymbolFlags[SymbolFlags.Namespace = 1920] = "Namespace", SymbolFlags[SymbolFlags.Module = 1536] = "Module", SymbolFlags[SymbolFlags.Accessor = 98304] = "Accessor", SymbolFlags[SymbolFlags.FunctionScopedVariableExcludes = 67216318] = "FunctionScopedVariableExcludes", SymbolFlags[SymbolFlags.BlockScopedVariableExcludes = 67216319] = "BlockScopedVariableExcludes", SymbolFlags[SymbolFlags.ParameterExcludes = 67216319] = "ParameterExcludes", SymbolFlags[SymbolFlags.PropertyExcludes = 0] = "PropertyExcludes", SymbolFlags[SymbolFlags.EnumMemberExcludes = 68008959] = "EnumMemberExcludes", SymbolFlags[SymbolFlags.FunctionExcludes = 67215791] = "FunctionExcludes", SymbolFlags[SymbolFlags.ClassExcludes = 68008383] = "ClassExcludes", SymbolFlags[SymbolFlags.InterfaceExcludes = 67901832] = "InterfaceExcludes", SymbolFlags[SymbolFlags.RegularEnumExcludes = 68008191] = "RegularEnumExcludes", SymbolFlags[SymbolFlags.ConstEnumExcludes = 68008831] = "ConstEnumExcludes", SymbolFlags[SymbolFlags.ValueModuleExcludes = 67215503] = "ValueModuleExcludes", SymbolFlags[SymbolFlags.NamespaceModuleExcludes = 0] = "NamespaceModuleExcludes", SymbolFlags[SymbolFlags.MethodExcludes = 67208127] = "MethodExcludes", SymbolFlags[SymbolFlags.GetAccessorExcludes = 67150783] = "GetAccessorExcludes", SymbolFlags[SymbolFlags.SetAccessorExcludes = 67183551] = "SetAccessorExcludes", SymbolFlags[SymbolFlags.TypeParameterExcludes = 67639784] = "TypeParameterExcludes", SymbolFlags[SymbolFlags.TypeAliasExcludes = 67901928] = "TypeAliasExcludes", SymbolFlags[SymbolFlags.AliasExcludes = 2097152] = "AliasExcludes", SymbolFlags[SymbolFlags.ModuleMember = 2623475] = "ModuleMember", SymbolFlags[SymbolFlags.ExportHasLocal = 944] = "ExportHasLocal", SymbolFlags[SymbolFlags.HasExports = 1952] = "HasExports", SymbolFlags[SymbolFlags.HasMembers = 6240] = "HasMembers", SymbolFlags[SymbolFlags.BlockScoped = 418] = "BlockScoped", SymbolFlags[SymbolFlags.PropertyOrAccessor = 98308] = "PropertyOrAccessor", SymbolFlags[SymbolFlags.ClassMember = 106500] = "ClassMember", SymbolFlags[SymbolFlags.Classifiable = 2885600] = "Classifiable", SymbolFlags[SymbolFlags.LateBindingContainer = 6240] = "LateBindingContainer" }(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {})); var EnumKind; !function (EnumKind) { EnumKind[EnumKind.Numeric = 0] = "Numeric", EnumKind[EnumKind.Literal = 1] = "Literal" }(EnumKind = ts.EnumKind || (ts.EnumKind = {})); var CheckFlags; !function (CheckFlags) { CheckFlags[CheckFlags.Instantiated = 1] = "Instantiated", CheckFlags[CheckFlags.SyntheticProperty = 2] = "SyntheticProperty", CheckFlags[CheckFlags.SyntheticMethod = 4] = "SyntheticMethod", CheckFlags[CheckFlags.Readonly = 8] = "Readonly", CheckFlags[CheckFlags.Partial = 16] = "Partial", CheckFlags[CheckFlags.HasNonUniformType = 32] = "HasNonUniformType", CheckFlags[CheckFlags.ContainsPublic = 64] = "ContainsPublic", CheckFlags[CheckFlags.ContainsProtected = 128] = "ContainsProtected", CheckFlags[CheckFlags.ContainsPrivate = 256] = "ContainsPrivate", CheckFlags[CheckFlags.ContainsStatic = 512] = "ContainsStatic", CheckFlags[CheckFlags.Late = 1024] = "Late", CheckFlags[CheckFlags.ReverseMapped = 2048] = "ReverseMapped", CheckFlags[CheckFlags.Synthetic = 6] = "Synthetic" }(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {})); var InternalSymbolName; !function (InternalSymbolName) { InternalSymbolName.Call = "__call", InternalSymbolName.Constructor = "__constructor", InternalSymbolName.New = "__new", InternalSymbolName.Index = "__index", InternalSymbolName.ExportStar = "__export", InternalSymbolName.Global = "__global", InternalSymbolName.Missing = "__missing", InternalSymbolName.Type = "__type", InternalSymbolName.Object = "__object", InternalSymbolName.JSXAttributes = "__jsxAttributes", InternalSymbolName.Class = "__class", InternalSymbolName.Function = "__function", InternalSymbolName.Computed = "__computed", InternalSymbolName.Resolving = "__resolving__", InternalSymbolName.ExportEquals = "export=", InternalSymbolName.Default = "default" }(InternalSymbolName = ts.InternalSymbolName || (ts.InternalSymbolName = {})); var NodeCheckFlags; !function (NodeCheckFlags) { NodeCheckFlags[NodeCheckFlags.TypeChecked = 1] = "TypeChecked", NodeCheckFlags[NodeCheckFlags.LexicalThis = 2] = "LexicalThis", NodeCheckFlags[NodeCheckFlags.CaptureThis = 4] = "CaptureThis", NodeCheckFlags[NodeCheckFlags.CaptureNewTarget = 8] = "CaptureNewTarget", NodeCheckFlags[NodeCheckFlags.SuperInstance = 256] = "SuperInstance", NodeCheckFlags[NodeCheckFlags.SuperStatic = 512] = "SuperStatic", NodeCheckFlags[NodeCheckFlags.ContextChecked = 1024] = "ContextChecked", NodeCheckFlags[NodeCheckFlags.AsyncMethodWithSuper = 2048] = "AsyncMethodWithSuper", NodeCheckFlags[NodeCheckFlags.AsyncMethodWithSuperBinding = 4096] = "AsyncMethodWithSuperBinding", NodeCheckFlags[NodeCheckFlags.CaptureArguments = 8192] = "CaptureArguments", NodeCheckFlags[NodeCheckFlags.EnumValuesComputed = 16384] = "EnumValuesComputed", NodeCheckFlags[NodeCheckFlags.LexicalModuleMergesWithClass = 32768] = "LexicalModuleMergesWithClass", NodeCheckFlags[NodeCheckFlags.LoopWithCapturedBlockScopedBinding = 65536] = "LoopWithCapturedBlockScopedBinding", NodeCheckFlags[NodeCheckFlags.CapturedBlockScopedBinding = 131072] = "CapturedBlockScopedBinding", NodeCheckFlags[NodeCheckFlags.BlockScopedBindingInLoop = 262144] = "BlockScopedBindingInLoop", NodeCheckFlags[NodeCheckFlags.ClassWithBodyScopedClassBinding = 524288] = "ClassWithBodyScopedClassBinding", NodeCheckFlags[NodeCheckFlags.BodyScopedClassBinding = 1048576] = "BodyScopedClassBinding", NodeCheckFlags[NodeCheckFlags.NeedsLoopOutParameter = 2097152] = "NeedsLoopOutParameter", NodeCheckFlags[NodeCheckFlags.AssignmentsMarked = 4194304] = "AssignmentsMarked", NodeCheckFlags[NodeCheckFlags.ClassWithConstructorReference = 8388608] = "ClassWithConstructorReference", NodeCheckFlags[NodeCheckFlags.ConstructorReferenceInClass = 16777216] = "ConstructorReferenceInClass" }(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); var TypeFlags; !function (TypeFlags) { TypeFlags[TypeFlags.Any = 1] = "Any", TypeFlags[TypeFlags.String = 2] = "String", TypeFlags[TypeFlags.Number = 4] = "Number", TypeFlags[TypeFlags.Boolean = 8] = "Boolean", TypeFlags[TypeFlags.Enum = 16] = "Enum", TypeFlags[TypeFlags.StringLiteral = 32] = "StringLiteral", TypeFlags[TypeFlags.NumberLiteral = 64] = "NumberLiteral", TypeFlags[TypeFlags.BooleanLiteral = 128] = "BooleanLiteral", TypeFlags[TypeFlags.EnumLiteral = 256] = "EnumLiteral", TypeFlags[TypeFlags.ESSymbol = 512] = "ESSymbol", TypeFlags[TypeFlags.UniqueESSymbol = 1024] = "UniqueESSymbol", TypeFlags[TypeFlags.Void = 2048] = "Void", TypeFlags[TypeFlags.Undefined = 4096] = "Undefined", TypeFlags[TypeFlags.Null = 8192] = "Null", TypeFlags[TypeFlags.Never = 16384] = "Never", TypeFlags[TypeFlags.TypeParameter = 32768] = "TypeParameter", TypeFlags[TypeFlags.Object = 65536] = "Object", TypeFlags[TypeFlags.Union = 131072] = "Union", TypeFlags[TypeFlags.Intersection = 262144] = "Intersection", TypeFlags[TypeFlags.Index = 524288] = "Index", TypeFlags[TypeFlags.IndexedAccess = 1048576] = "IndexedAccess", TypeFlags[TypeFlags.Conditional = 2097152] = "Conditional", TypeFlags[TypeFlags.Substitution = 4194304] = "Substitution", TypeFlags[TypeFlags.FreshLiteral = 8388608] = "FreshLiteral", TypeFlags[TypeFlags.ContainsWideningType = 16777216] = "ContainsWideningType", TypeFlags[TypeFlags.ContainsObjectLiteral = 33554432] = "ContainsObjectLiteral", TypeFlags[TypeFlags.ContainsAnyFunctionType = 67108864] = "ContainsAnyFunctionType", TypeFlags[TypeFlags.NonPrimitive = 134217728] = "NonPrimitive", TypeFlags[TypeFlags.UnionOfUnitTypes = 268435456] = "UnionOfUnitTypes", TypeFlags[TypeFlags.GenericMappedType = 536870912] = "GenericMappedType", TypeFlags[TypeFlags.Nullable = 12288] = "Nullable", TypeFlags[TypeFlags.Literal = 224] = "Literal", TypeFlags[TypeFlags.Unit = 13536] = "Unit", TypeFlags[TypeFlags.StringOrNumberLiteral = 96] = "StringOrNumberLiteral", TypeFlags[TypeFlags.StringOrNumberLiteralOrUnique = 1120] = "StringOrNumberLiteralOrUnique", TypeFlags[TypeFlags.DefinitelyFalsy = 14560] = "DefinitelyFalsy", TypeFlags[TypeFlags.PossiblyFalsy = 14574] = "PossiblyFalsy", TypeFlags[TypeFlags.Intrinsic = 134249103] = "Intrinsic", TypeFlags[TypeFlags.Primitive = 16382] = "Primitive", TypeFlags[TypeFlags.StringLike = 34] = "StringLike", TypeFlags[TypeFlags.NumberLike = 84] = "NumberLike", TypeFlags[TypeFlags.BooleanLike = 136] = "BooleanLike", TypeFlags[TypeFlags.EnumLike = 272] = "EnumLike", TypeFlags[TypeFlags.ESSymbolLike = 1536] = "ESSymbolLike", TypeFlags[TypeFlags.VoidLike = 6144] = "VoidLike", TypeFlags[TypeFlags.DisjointDomains = 134233854] = "DisjointDomains", TypeFlags[TypeFlags.UnionOrIntersection = 393216] = "UnionOrIntersection", TypeFlags[TypeFlags.StructuredType = 458752] = "StructuredType", TypeFlags[TypeFlags.TypeVariable = 1081344] = "TypeVariable", TypeFlags[TypeFlags.InstantiableNonPrimitive = 7372800] = "InstantiableNonPrimitive", TypeFlags[TypeFlags.InstantiablePrimitive = 524288] = "InstantiablePrimitive", TypeFlags[TypeFlags.Instantiable = 7897088] = "Instantiable", TypeFlags[TypeFlags.StructuredOrInstantiable = 8355840] = "StructuredOrInstantiable", TypeFlags[TypeFlags.Narrowable = 142575359] = "Narrowable", TypeFlags[TypeFlags.NotUnionOrUnit = 134283777] = "NotUnionOrUnit", TypeFlags[TypeFlags.NotUnit = 8374815] = "NotUnit", TypeFlags[TypeFlags.RequiresWidening = 50331648] = "RequiresWidening", TypeFlags[TypeFlags.PropagatingFlags = 117440512] = "PropagatingFlags", TypeFlags[TypeFlags.NonWideningType = 16777216] = "NonWideningType", TypeFlags[TypeFlags.Wildcard = 33554432] = "Wildcard", TypeFlags[TypeFlags.EmptyObject = 67108864] = "EmptyObject", TypeFlags[TypeFlags.ConstructionFlags = 117440512] = "ConstructionFlags" }(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {})); var ObjectFlags; !function (ObjectFlags) { ObjectFlags[ObjectFlags.Class = 1] = "Class", ObjectFlags[ObjectFlags.Interface = 2] = "Interface", ObjectFlags[ObjectFlags.Reference = 4] = "Reference", ObjectFlags[ObjectFlags.Tuple = 8] = "Tuple", ObjectFlags[ObjectFlags.Anonymous = 16] = "Anonymous", ObjectFlags[ObjectFlags.Mapped = 32] = "Mapped", ObjectFlags[ObjectFlags.Instantiated = 64] = "Instantiated", ObjectFlags[ObjectFlags.ObjectLiteral = 128] = "ObjectLiteral", ObjectFlags[ObjectFlags.EvolvingArray = 256] = "EvolvingArray", ObjectFlags[ObjectFlags.ObjectLiteralPatternWithComputedProperties = 512] = "ObjectLiteralPatternWithComputedProperties", ObjectFlags[ObjectFlags.ContainsSpread = 1024] = "ContainsSpread", ObjectFlags[ObjectFlags.ReverseMapped = 2048] = "ReverseMapped", ObjectFlags[ObjectFlags.JsxAttributes = 4096] = "JsxAttributes", ObjectFlags[ObjectFlags.MarkerType = 8192] = "MarkerType", ObjectFlags[ObjectFlags.ClassOrInterface = 3] = "ClassOrInterface" }(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {})); var Variance; !function (Variance) { Variance[Variance.Invariant = 0] = "Invariant", Variance[Variance.Covariant = 1] = "Covariant", Variance[Variance.Contravariant = 2] = "Contravariant", Variance[Variance.Bivariant = 3] = "Bivariant", Variance[Variance.Independent = 4] = "Independent" }(Variance = ts.Variance || (ts.Variance = {})); var SignatureKind; !function (SignatureKind) { SignatureKind[SignatureKind.Call = 0] = "Call", SignatureKind[SignatureKind.Construct = 1] = "Construct" }(SignatureKind = ts.SignatureKind || (ts.SignatureKind = {})); var IndexKind; !function (IndexKind) { IndexKind[IndexKind.String = 0] = "String", IndexKind[IndexKind.Number = 1] = "Number" }(IndexKind = ts.IndexKind || (ts.IndexKind = {})); var InferencePriority; !function (InferencePriority) { InferencePriority[InferencePriority.NakedTypeVariable = 1] = "NakedTypeVariable", InferencePriority[InferencePriority.HomomorphicMappedType = 2] = "HomomorphicMappedType", InferencePriority[InferencePriority.MappedTypeConstraint = 4] = "MappedTypeConstraint", InferencePriority[InferencePriority.ReturnType = 8] = "ReturnType", InferencePriority[InferencePriority.LiteralKeyof = 16] = "LiteralKeyof", InferencePriority[InferencePriority.NoConstraints = 32] = "NoConstraints", InferencePriority[InferencePriority.AlwaysStrict = 64] = "AlwaysStrict", InferencePriority[InferencePriority.PriorityImpliesCombination = 28] = "PriorityImpliesCombination" }(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {})); var InferenceFlags; !function (InferenceFlags) { InferenceFlags[InferenceFlags.None = 0] = "None", InferenceFlags[InferenceFlags.InferUnionTypes = 1] = "InferUnionTypes", InferenceFlags[InferenceFlags.NoDefault = 2] = "NoDefault", InferenceFlags[InferenceFlags.AnyDefault = 4] = "AnyDefault" }(InferenceFlags = ts.InferenceFlags || (ts.InferenceFlags = {})); var Ternary; !function (Ternary) { Ternary[Ternary.False = 0] = "False", Ternary[Ternary.Maybe = 1] = "Maybe", Ternary[Ternary.True = -1] = "True" }(Ternary = ts.Ternary || (ts.Ternary = {})); var SpecialPropertyAssignmentKind; !function (SpecialPropertyAssignmentKind) { SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind.None = 0] = "None", SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind.ExportsProperty = 1] = "ExportsProperty", SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind.ModuleExports = 2] = "ModuleExports", SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind.PrototypeProperty = 3] = "PrototypeProperty", SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind.ThisProperty = 4] = "ThisProperty", SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind.Property = 5] = "Property", SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind.Prototype = 6] = "Prototype" }(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); var DiagnosticCategory; !function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory.Warning = 0] = "Warning", DiagnosticCategory[DiagnosticCategory.Error = 1] = "Error", DiagnosticCategory[DiagnosticCategory.Suggestion = 2] = "Suggestion", DiagnosticCategory[DiagnosticCategory.Message = 3] = "Message" }(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {})), ts.diagnosticCategoryName = diagnosticCategoryName; var ModuleResolutionKind; !function (ModuleResolutionKind) { ModuleResolutionKind[ModuleResolutionKind.Classic = 1] = "Classic", ModuleResolutionKind[ModuleResolutionKind.NodeJs = 2] = "NodeJs" }(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); var ModuleKind; !function (ModuleKind) { ModuleKind[ModuleKind.None = 0] = "None", ModuleKind[ModuleKind.CommonJS = 1] = "CommonJS", ModuleKind[ModuleKind.AMD = 2] = "AMD", ModuleKind[ModuleKind.UMD = 3] = "UMD", ModuleKind[ModuleKind.System = 4] = "System", ModuleKind[ModuleKind.ES2015 = 5] = "ES2015", ModuleKind[ModuleKind.ESNext = 6] = "ESNext" }(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {})); var JsxEmit; !function (JsxEmit) { JsxEmit[JsxEmit.None = 0] = "None", JsxEmit[JsxEmit.Preserve = 1] = "Preserve", JsxEmit[JsxEmit.React = 2] = "React", JsxEmit[JsxEmit.ReactNative = 3] = "ReactNative" }(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); var NewLineKind; !function (NewLineKind) { NewLineKind[NewLineKind.CarriageReturnLineFeed = 0] = "CarriageReturnLineFeed", NewLineKind[NewLineKind.LineFeed = 1] = "LineFeed" }(NewLineKind = ts.NewLineKind || (ts.NewLineKind = {})); var ScriptKind; !function (ScriptKind) { ScriptKind[ScriptKind.Unknown = 0] = "Unknown", ScriptKind[ScriptKind.JS = 1] = "JS", ScriptKind[ScriptKind.JSX = 2] = "JSX", ScriptKind[ScriptKind.TS = 3] = "TS", ScriptKind[ScriptKind.TSX = 4] = "TSX", ScriptKind[ScriptKind.External = 5] = "External", ScriptKind[ScriptKind.JSON = 6] = "JSON", ScriptKind[ScriptKind.Deferred = 7] = "Deferred" }(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {})); var ScriptTarget; !function (ScriptTarget) { ScriptTarget[ScriptTarget.ES3 = 0] = "ES3", ScriptTarget[ScriptTarget.ES5 = 1] = "ES5", ScriptTarget[ScriptTarget.ES2015 = 2] = "ES2015", ScriptTarget[ScriptTarget.ES2016 = 3] = "ES2016", ScriptTarget[ScriptTarget.ES2017 = 4] = "ES2017", ScriptTarget[ScriptTarget.ES2018 = 5] = "ES2018", ScriptTarget[ScriptTarget.ESNext = 6] = "ESNext", ScriptTarget[ScriptTarget.JSON = 100] = "JSON", ScriptTarget[ScriptTarget.Latest = 6] = "Latest" }(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {})); var LanguageVariant; !function (LanguageVariant) { LanguageVariant[LanguageVariant.Standard = 0] = "Standard", LanguageVariant[LanguageVariant.JSX = 1] = "JSX" }(LanguageVariant = ts.LanguageVariant || (ts.LanguageVariant = {})); var WatchDirectoryFlags; !function (WatchDirectoryFlags) { WatchDirectoryFlags[WatchDirectoryFlags.None = 0] = "None", WatchDirectoryFlags[WatchDirectoryFlags.Recursive = 1] = "Recursive" }(WatchDirectoryFlags = ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {})); var CharacterCodes; !function (CharacterCodes) { CharacterCodes[CharacterCodes.nullCharacter = 0] = "nullCharacter", CharacterCodes[CharacterCodes.maxAsciiCharacter = 127] = "maxAsciiCharacter", CharacterCodes[CharacterCodes.lineFeed = 10] = "lineFeed", CharacterCodes[CharacterCodes.carriageReturn = 13] = "carriageReturn", CharacterCodes[CharacterCodes.lineSeparator = 8232] = "lineSeparator", CharacterCodes[CharacterCodes.paragraphSeparator = 8233] = "paragraphSeparator", CharacterCodes[CharacterCodes.nextLine = 133] = "nextLine", CharacterCodes[CharacterCodes.space = 32] = "space", CharacterCodes[CharacterCodes.nonBreakingSpace = 160] = "nonBreakingSpace", CharacterCodes[CharacterCodes.enQuad = 8192] = "enQuad", CharacterCodes[CharacterCodes.emQuad = 8193] = "emQuad", CharacterCodes[CharacterCodes.enSpace = 8194] = "enSpace", CharacterCodes[CharacterCodes.emSpace = 8195] = "emSpace", CharacterCodes[CharacterCodes.threePerEmSpace = 8196] = "threePerEmSpace", CharacterCodes[CharacterCodes.fourPerEmSpace = 8197] = "fourPerEmSpace", CharacterCodes[CharacterCodes.sixPerEmSpace = 8198] = "sixPerEmSpace", CharacterCodes[CharacterCodes.figureSpace = 8199] = "figureSpace", CharacterCodes[CharacterCodes.punctuationSpace = 8200] = "punctuationSpace", CharacterCodes[CharacterCodes.thinSpace = 8201] = "thinSpace", CharacterCodes[CharacterCodes.hairSpace = 8202] = "hairSpace", CharacterCodes[CharacterCodes.zeroWidthSpace = 8203] = "zeroWidthSpace", CharacterCodes[CharacterCodes.narrowNoBreakSpace = 8239] = "narrowNoBreakSpace", CharacterCodes[CharacterCodes.ideographicSpace = 12288] = "ideographicSpace", CharacterCodes[CharacterCodes.mathematicalSpace = 8287] = "mathematicalSpace", CharacterCodes[CharacterCodes.ogham = 5760] = "ogham", CharacterCodes[CharacterCodes._ = 95] = "_", CharacterCodes[CharacterCodes.$ = 36] = "$", CharacterCodes[CharacterCodes._0 = 48] = "_0", CharacterCodes[CharacterCodes._1 = 49] = "_1", CharacterCodes[CharacterCodes._2 = 50] = "_2", CharacterCodes[CharacterCodes._3 = 51] = "_3", CharacterCodes[CharacterCodes._4 = 52] = "_4", CharacterCodes[CharacterCodes._5 = 53] = "_5", CharacterCodes[CharacterCodes._6 = 54] = "_6", CharacterCodes[CharacterCodes._7 = 55] = "_7", CharacterCodes[CharacterCodes._8 = 56] = "_8", CharacterCodes[CharacterCodes._9 = 57] = "_9", CharacterCodes[CharacterCodes.a = 97] = "a", CharacterCodes[CharacterCodes.b = 98] = "b", CharacterCodes[CharacterCodes.c = 99] = "c", CharacterCodes[CharacterCodes.d = 100] = "d", CharacterCodes[CharacterCodes.e = 101] = "e", CharacterCodes[CharacterCodes.f = 102] = "f", CharacterCodes[CharacterCodes.g = 103] = "g", CharacterCodes[CharacterCodes.h = 104] = "h", CharacterCodes[CharacterCodes.i = 105] = "i", CharacterCodes[CharacterCodes.j = 106] = "j", CharacterCodes[CharacterCodes.k = 107] = "k", CharacterCodes[CharacterCodes.l = 108] = "l", CharacterCodes[CharacterCodes.m = 109] = "m", CharacterCodes[CharacterCodes.n = 110] = "n", CharacterCodes[CharacterCodes.o = 111] = "o", CharacterCodes[CharacterCodes.p = 112] = "p", CharacterCodes[CharacterCodes.q = 113] = "q", CharacterCodes[CharacterCodes.r = 114] = "r", CharacterCodes[CharacterCodes.s = 115] = "s", CharacterCodes[CharacterCodes.t = 116] = "t", CharacterCodes[CharacterCodes.u = 117] = "u", CharacterCodes[CharacterCodes.v = 118] = "v", CharacterCodes[CharacterCodes.w = 119] = "w", CharacterCodes[CharacterCodes.x = 120] = "x", CharacterCodes[CharacterCodes.y = 121] = "y", CharacterCodes[CharacterCodes.z = 122] = "z", CharacterCodes[CharacterCodes.A = 65] = "A", CharacterCodes[CharacterCodes.B = 66] = "B", CharacterCodes[CharacterCodes.C = 67] = "C", CharacterCodes[CharacterCodes.D = 68] = "D", CharacterCodes[CharacterCodes.E = 69] = "E", CharacterCodes[CharacterCodes.F = 70] = "F", CharacterCodes[CharacterCodes.G = 71] = "G", CharacterCodes[CharacterCodes.H = 72] = "H", CharacterCodes[CharacterCodes.I = 73] = "I", CharacterCodes[CharacterCodes.J = 74] = "J", CharacterCodes[CharacterCodes.K = 75] = "K", CharacterCodes[CharacterCodes.L = 76] = "L", CharacterCodes[CharacterCodes.M = 77] = "M", CharacterCodes[CharacterCodes.N = 78] = "N", CharacterCodes[CharacterCodes.O = 79] = "O", CharacterCodes[CharacterCodes.P = 80] = "P", CharacterCodes[CharacterCodes.Q = 81] = "Q", CharacterCodes[CharacterCodes.R = 82] = "R", CharacterCodes[CharacterCodes.S = 83] = "S", CharacterCodes[CharacterCodes.T = 84] = "T", CharacterCodes[CharacterCodes.U = 85] = "U", CharacterCodes[CharacterCodes.V = 86] = "V", CharacterCodes[CharacterCodes.W = 87] = "W", CharacterCodes[CharacterCodes.X = 88] = "X", CharacterCodes[CharacterCodes.Y = 89] = "Y", CharacterCodes[CharacterCodes.Z = 90] = "Z", CharacterCodes[CharacterCodes.ampersand = 38] = "ampersand", CharacterCodes[CharacterCodes.asterisk = 42] = "asterisk", CharacterCodes[CharacterCodes.at = 64] = "at", CharacterCodes[CharacterCodes.backslash = 92] = "backslash", CharacterCodes[CharacterCodes.backtick = 96] = "backtick", CharacterCodes[CharacterCodes.bar = 124] = "bar", CharacterCodes[CharacterCodes.caret = 94] = "caret", CharacterCodes[CharacterCodes.closeBrace = 125] = "closeBrace", CharacterCodes[CharacterCodes.closeBracket = 93] = "closeBracket", CharacterCodes[CharacterCodes.closeParen = 41] = "closeParen", CharacterCodes[CharacterCodes.colon = 58] = "colon", CharacterCodes[CharacterCodes.comma = 44] = "comma", CharacterCodes[CharacterCodes.dot = 46] = "dot", CharacterCodes[CharacterCodes.doubleQuote = 34] = "doubleQuote", CharacterCodes[CharacterCodes.equals = 61] = "equals", CharacterCodes[CharacterCodes.exclamation = 33] = "exclamation", CharacterCodes[CharacterCodes.greaterThan = 62] = "greaterThan", CharacterCodes[CharacterCodes.hash = 35] = "hash", CharacterCodes[CharacterCodes.lessThan = 60] = "lessThan", CharacterCodes[CharacterCodes.minus = 45] = "minus", CharacterCodes[CharacterCodes.openBrace = 123] = "openBrace", CharacterCodes[CharacterCodes.openBracket = 91] = "openBracket", CharacterCodes[CharacterCodes.openParen = 40] = "openParen", CharacterCodes[CharacterCodes.percent = 37] = "percent", CharacterCodes[CharacterCodes.plus = 43] = "plus", CharacterCodes[CharacterCodes.question = 63] = "question", CharacterCodes[CharacterCodes.semicolon = 59] = "semicolon", CharacterCodes[CharacterCodes.singleQuote = 39] = "singleQuote", CharacterCodes[CharacterCodes.slash = 47] = "slash", CharacterCodes[CharacterCodes.tilde = 126] = "tilde", CharacterCodes[CharacterCodes.backspace = 8] = "backspace", CharacterCodes[CharacterCodes.formFeed = 12] = "formFeed", CharacterCodes[CharacterCodes.byteOrderMark = 65279] = "byteOrderMark", CharacterCodes[CharacterCodes.tab = 9] = "tab", CharacterCodes[CharacterCodes.verticalTab = 11] = "verticalTab" }(CharacterCodes = ts.CharacterCodes || (ts.CharacterCodes = {})); var Extension; !function (Extension) { Extension.Ts = ".ts", Extension.Tsx = ".tsx", Extension.Dts = ".d.ts", Extension.Js = ".js", Extension.Jsx = ".jsx", Extension.Json = ".json" }(Extension = ts.Extension || (ts.Extension = {})); var TransformFlags; !function (TransformFlags) { TransformFlags[TransformFlags.None = 0] = "None", TransformFlags[TransformFlags.TypeScript = 1] = "TypeScript", TransformFlags[TransformFlags.ContainsTypeScript = 2] = "ContainsTypeScript", TransformFlags[TransformFlags.ContainsJsx = 4] = "ContainsJsx", TransformFlags[TransformFlags.ContainsESNext = 8] = "ContainsESNext", TransformFlags[TransformFlags.ContainsES2017 = 16] = "ContainsES2017", TransformFlags[TransformFlags.ContainsES2016 = 32] = "ContainsES2016", TransformFlags[TransformFlags.ES2015 = 64] = "ES2015", TransformFlags[TransformFlags.ContainsES2015 = 128] = "ContainsES2015", TransformFlags[TransformFlags.Generator = 256] = "Generator", TransformFlags[TransformFlags.ContainsGenerator = 512] = "ContainsGenerator", TransformFlags[TransformFlags.DestructuringAssignment = 1024] = "DestructuringAssignment", TransformFlags[TransformFlags.ContainsDestructuringAssignment = 2048] = "ContainsDestructuringAssignment", TransformFlags[TransformFlags.ContainsDecorators = 4096] = "ContainsDecorators", TransformFlags[TransformFlags.ContainsPropertyInitializer = 8192] = "ContainsPropertyInitializer", TransformFlags[TransformFlags.ContainsLexicalThis = 16384] = "ContainsLexicalThis", TransformFlags[TransformFlags.ContainsCapturedLexicalThis = 32768] = "ContainsCapturedLexicalThis", TransformFlags[TransformFlags.ContainsLexicalThisInComputedPropertyName = 65536] = "ContainsLexicalThisInComputedPropertyName", TransformFlags[TransformFlags.ContainsDefaultValueAssignments = 131072] = "ContainsDefaultValueAssignments", TransformFlags[TransformFlags.ContainsParameterPropertyAssignments = 262144] = "ContainsParameterPropertyAssignments", TransformFlags[TransformFlags.ContainsSpread = 524288] = "ContainsSpread", TransformFlags[TransformFlags.ContainsObjectSpread = 1048576] = "ContainsObjectSpread", TransformFlags[TransformFlags.ContainsRest = 524288] = "ContainsRest", TransformFlags[TransformFlags.ContainsObjectRest = 1048576] = "ContainsObjectRest", TransformFlags[TransformFlags.ContainsComputedPropertyName = 2097152] = "ContainsComputedPropertyName", TransformFlags[TransformFlags.ContainsBlockScopedBinding = 4194304] = "ContainsBlockScopedBinding", TransformFlags[TransformFlags.ContainsBindingPattern = 8388608] = "ContainsBindingPattern", TransformFlags[TransformFlags.ContainsYield = 16777216] = "ContainsYield", TransformFlags[TransformFlags.ContainsHoistedDeclarationOrCompletion = 33554432] = "ContainsHoistedDeclarationOrCompletion", TransformFlags[TransformFlags.ContainsDynamicImport = 67108864] = "ContainsDynamicImport", TransformFlags[TransformFlags.Super = 134217728] = "Super", TransformFlags[TransformFlags.ContainsSuper = 268435456] = "ContainsSuper", TransformFlags[TransformFlags.HasComputedFlags = 536870912] = "HasComputedFlags", TransformFlags[TransformFlags.AssertTypeScript = 3] = "AssertTypeScript", TransformFlags[TransformFlags.AssertJsx = 4] = "AssertJsx", TransformFlags[TransformFlags.AssertESNext = 8] = "AssertESNext", TransformFlags[TransformFlags.AssertES2017 = 16] = "AssertES2017", TransformFlags[TransformFlags.AssertES2016 = 32] = "AssertES2016", TransformFlags[TransformFlags.AssertES2015 = 192] = "AssertES2015", TransformFlags[TransformFlags.AssertGenerator = 768] = "AssertGenerator", TransformFlags[TransformFlags.AssertDestructuringAssignment = 3072] = "AssertDestructuringAssignment", TransformFlags[TransformFlags.OuterExpressionExcludes = 536872257] = "OuterExpressionExcludes", TransformFlags[TransformFlags.PropertyAccessExcludes = 671089985] = "PropertyAccessExcludes", TransformFlags[TransformFlags.NodeExcludes = 939525441] = "NodeExcludes", TransformFlags[TransformFlags.ArrowFunctionExcludes = 1003902273] = "ArrowFunctionExcludes", TransformFlags[TransformFlags.FunctionExcludes = 1003935041] = "FunctionExcludes", TransformFlags[TransformFlags.ConstructorExcludes = 1003668801] = "ConstructorExcludes", TransformFlags[TransformFlags.MethodOrAccessorExcludes = 1003668801] = "MethodOrAccessorExcludes", TransformFlags[TransformFlags.ClassExcludes = 942011713] = "ClassExcludes", TransformFlags[TransformFlags.ModuleExcludes = 977327425] = "ModuleExcludes", TransformFlags[TransformFlags.TypeExcludes = -3] = "TypeExcludes", TransformFlags[TransformFlags.ObjectLiteralExcludes = 942740801] = "ObjectLiteralExcludes", TransformFlags[TransformFlags.ArrayLiteralOrCallOrNewExcludes = 940049729] = "ArrayLiteralOrCallOrNewExcludes", TransformFlags[TransformFlags.VariableDeclarationListExcludes = 948962625] = "VariableDeclarationListExcludes", TransformFlags[TransformFlags.ParameterExcludes = 939525441] = "ParameterExcludes", TransformFlags[TransformFlags.CatchClauseExcludes = 940574017] = "CatchClauseExcludes", TransformFlags[TransformFlags.BindingPatternExcludes = 940049729] = "BindingPatternExcludes", TransformFlags[TransformFlags.TypeScriptClassSyntaxMask = 274432] = "TypeScriptClassSyntaxMask", TransformFlags[TransformFlags.ES2015FunctionSyntaxMask = 163840] = "ES2015FunctionSyntaxMask" }(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); var EmitFlags; !function (EmitFlags) { EmitFlags[EmitFlags.SingleLine = 1] = "SingleLine", EmitFlags[EmitFlags.AdviseOnEmitNode = 2] = "AdviseOnEmitNode", EmitFlags[EmitFlags.NoSubstitution = 4] = "NoSubstitution", EmitFlags[EmitFlags.CapturesThis = 8] = "CapturesThis", EmitFlags[EmitFlags.NoLeadingSourceMap = 16] = "NoLeadingSourceMap", EmitFlags[EmitFlags.NoTrailingSourceMap = 32] = "NoTrailingSourceMap", EmitFlags[EmitFlags.NoSourceMap = 48] = "NoSourceMap", EmitFlags[EmitFlags.NoNestedSourceMaps = 64] = "NoNestedSourceMaps", EmitFlags[EmitFlags.NoTokenLeadingSourceMaps = 128] = "NoTokenLeadingSourceMaps", EmitFlags[EmitFlags.NoTokenTrailingSourceMaps = 256] = "NoTokenTrailingSourceMaps", EmitFlags[EmitFlags.NoTokenSourceMaps = 384] = "NoTokenSourceMaps", EmitFlags[EmitFlags.NoLeadingComments = 512] = "NoLeadingComments", EmitFlags[EmitFlags.NoTrailingComments = 1024] = "NoTrailingComments", EmitFlags[EmitFlags.NoComments = 1536] = "NoComments", EmitFlags[EmitFlags.NoNestedComments = 2048] = "NoNestedComments", EmitFlags[EmitFlags.HelperName = 4096] = "HelperName", EmitFlags[EmitFlags.ExportName = 8192] = "ExportName", EmitFlags[EmitFlags.LocalName = 16384] = "LocalName", EmitFlags[EmitFlags.InternalName = 32768] = "InternalName", EmitFlags[EmitFlags.Indented = 65536] = "Indented", EmitFlags[EmitFlags.NoIndentation = 131072] = "NoIndentation", EmitFlags[EmitFlags.AsyncFunctionBody = 262144] = "AsyncFunctionBody", EmitFlags[EmitFlags.ReuseTempVariableScope = 524288] = "ReuseTempVariableScope", EmitFlags[EmitFlags.CustomPrologue = 1048576] = "CustomPrologue", EmitFlags[EmitFlags.NoHoisting = 2097152] = "NoHoisting", EmitFlags[EmitFlags.HasEndOfDeclarationMarker = 4194304] = "HasEndOfDeclarationMarker", EmitFlags[EmitFlags.Iterator = 8388608] = "Iterator", EmitFlags[EmitFlags.NoAsciiEscaping = 16777216] = "NoAsciiEscaping", EmitFlags[EmitFlags.TypeScriptClassWrapper = 33554432] = "TypeScriptClassWrapper", EmitFlags[EmitFlags.NeverApplyImportHelper = 67108864] = "NeverApplyImportHelper" }(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); var ExternalEmitHelpers; !function (ExternalEmitHelpers) { ExternalEmitHelpers[ExternalEmitHelpers.Extends = 1] = "Extends", ExternalEmitHelpers[ExternalEmitHelpers.Assign = 2] = "Assign", ExternalEmitHelpers[ExternalEmitHelpers.Rest = 4] = "Rest", ExternalEmitHelpers[ExternalEmitHelpers.Decorate = 8] = "Decorate", ExternalEmitHelpers[ExternalEmitHelpers.Metadata = 16] = "Metadata", ExternalEmitHelpers[ExternalEmitHelpers.Param = 32] = "Param", ExternalEmitHelpers[ExternalEmitHelpers.Awaiter = 64] = "Awaiter", ExternalEmitHelpers[ExternalEmitHelpers.Generator = 128] = "Generator", ExternalEmitHelpers[ExternalEmitHelpers.Values = 256] = "Values", ExternalEmitHelpers[ExternalEmitHelpers.Read = 512] = "Read", ExternalEmitHelpers[ExternalEmitHelpers.Spread = 1024] = "Spread", ExternalEmitHelpers[ExternalEmitHelpers.Await = 2048] = "Await", ExternalEmitHelpers[ExternalEmitHelpers.AsyncGenerator = 4096] = "AsyncGenerator", ExternalEmitHelpers[ExternalEmitHelpers.AsyncDelegator = 8192] = "AsyncDelegator", ExternalEmitHelpers[ExternalEmitHelpers.AsyncValues = 16384] = "AsyncValues", ExternalEmitHelpers[ExternalEmitHelpers.ExportStar = 32768] = "ExportStar", ExternalEmitHelpers[ExternalEmitHelpers.MakeTemplateObject = 65536] = "MakeTemplateObject", ExternalEmitHelpers[ExternalEmitHelpers.FirstEmitHelper = 1] = "FirstEmitHelper", ExternalEmitHelpers[ExternalEmitHelpers.LastEmitHelper = 65536] = "LastEmitHelper", ExternalEmitHelpers[ExternalEmitHelpers.ForOfIncludes = 256] = "ForOfIncludes", ExternalEmitHelpers[ExternalEmitHelpers.ForAwaitOfIncludes = 16384] = "ForAwaitOfIncludes", ExternalEmitHelpers[ExternalEmitHelpers.AsyncGeneratorIncludes = 6144] = "AsyncGeneratorIncludes", ExternalEmitHelpers[ExternalEmitHelpers.AsyncDelegatorIncludes = 26624] = "AsyncDelegatorIncludes", ExternalEmitHelpers[ExternalEmitHelpers.SpreadIncludes = 1536] = "SpreadIncludes" }(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); var EmitHint; !function (EmitHint) { EmitHint[EmitHint.SourceFile = 0] = "SourceFile", EmitHint[EmitHint.Expression = 1] = "Expression", EmitHint[EmitHint.IdentifierName = 2] = "IdentifierName", EmitHint[EmitHint.MappedTypeParameter = 3] = "MappedTypeParameter", EmitHint[EmitHint.Unspecified = 4] = "Unspecified" }(EmitHint = ts.EmitHint || (ts.EmitHint = {})); var ListFormat; !function (ListFormat) { ListFormat[ListFormat.None = 0] = "None", ListFormat[ListFormat.SingleLine = 0] = "SingleLine", ListFormat[ListFormat.MultiLine = 1] = "MultiLine", ListFormat[ListFormat.PreserveLines = 2] = "PreserveLines", ListFormat[ListFormat.LinesMask = 3] = "LinesMask", ListFormat[ListFormat.NotDelimited = 0] = "NotDelimited", ListFormat[ListFormat.BarDelimited = 4] = "BarDelimited", ListFormat[ListFormat.AmpersandDelimited = 8] = "AmpersandDelimited", ListFormat[ListFormat.CommaDelimited = 16] = "CommaDelimited", ListFormat[ListFormat.DelimitersMask = 28] = "DelimitersMask", ListFormat[ListFormat.AllowTrailingComma = 32] = "AllowTrailingComma", ListFormat[ListFormat.Indented = 64] = "Indented", ListFormat[ListFormat.SpaceBetweenBraces = 128] = "SpaceBetweenBraces", ListFormat[ListFormat.SpaceBetweenSiblings = 256] = "SpaceBetweenSiblings", ListFormat[ListFormat.Braces = 512] = "Braces", ListFormat[ListFormat.Parenthesis = 1024] = "Parenthesis", ListFormat[ListFormat.AngleBrackets = 2048] = "AngleBrackets", ListFormat[ListFormat.SquareBrackets = 4096] = "SquareBrackets", ListFormat[ListFormat.BracketsMask = 7680] = "BracketsMask", ListFormat[ListFormat.OptionalIfUndefined = 8192] = "OptionalIfUndefined", ListFormat[ListFormat.OptionalIfEmpty = 16384] = "OptionalIfEmpty", ListFormat[ListFormat.Optional = 24576] = "Optional", ListFormat[ListFormat.PreferNewLine = 32768] = "PreferNewLine", ListFormat[ListFormat.NoTrailingNewLine = 65536] = "NoTrailingNewLine", ListFormat[ListFormat.NoInterveningComments = 131072] = "NoInterveningComments", ListFormat[ListFormat.NoSpaceIfEmpty = 262144] = "NoSpaceIfEmpty", ListFormat[ListFormat.SingleElement = 524288] = "SingleElement", ListFormat[ListFormat.Modifiers = 131328] = "Modifiers", ListFormat[ListFormat.HeritageClauses = 256] = "HeritageClauses", ListFormat[ListFormat.SingleLineTypeLiteralMembers = 384] = "SingleLineTypeLiteralMembers", ListFormat[ListFormat.MultiLineTypeLiteralMembers = 16449] = "MultiLineTypeLiteralMembers", ListFormat[ListFormat.TupleTypeElements = 272] = "TupleTypeElements", ListFormat[ListFormat.UnionTypeConstituents = 260] = "UnionTypeConstituents", ListFormat[ListFormat.IntersectionTypeConstituents = 264] = "IntersectionTypeConstituents", ListFormat[ListFormat.ObjectBindingPatternElements = 262576] = "ObjectBindingPatternElements", ListFormat[ListFormat.ArrayBindingPatternElements = 262448] = "ArrayBindingPatternElements", ListFormat[ListFormat.ObjectLiteralExpressionProperties = 263122] = "ObjectLiteralExpressionProperties", ListFormat[ListFormat.ArrayLiteralExpressionElements = 4466] = "ArrayLiteralExpressionElements", ListFormat[ListFormat.CommaListElements = 272] = "CommaListElements", ListFormat[ListFormat.CallExpressionArguments = 1296] = "CallExpressionArguments", ListFormat[ListFormat.NewExpressionArguments = 9488] = "NewExpressionArguments", ListFormat[ListFormat.TemplateExpressionSpans = 131072] = "TemplateExpressionSpans", ListFormat[ListFormat.SingleLineBlockStatements = 384] = "SingleLineBlockStatements", ListFormat[ListFormat.MultiLineBlockStatements = 65] = "MultiLineBlockStatements", ListFormat[ListFormat.VariableDeclarationList = 272] = "VariableDeclarationList", ListFormat[ListFormat.SingleLineFunctionBodyStatements = 384] = "SingleLineFunctionBodyStatements", ListFormat[ListFormat.MultiLineFunctionBodyStatements = 1] = "MultiLineFunctionBodyStatements", ListFormat[ListFormat.ClassHeritageClauses = 0] = "ClassHeritageClauses", ListFormat[ListFormat.ClassMembers = 65] = "ClassMembers", ListFormat[ListFormat.InterfaceMembers = 65] = "InterfaceMembers", ListFormat[ListFormat.EnumMembers = 81] = "EnumMembers", ListFormat[ListFormat.CaseBlockClauses = 65] = "CaseBlockClauses", ListFormat[ListFormat.NamedImportsOrExportsElements = 262576] = "NamedImportsOrExportsElements", ListFormat[ListFormat.JsxElementOrFragmentChildren = 131072] = "JsxElementOrFragmentChildren", ListFormat[ListFormat.JsxElementAttributes = 131328] = "JsxElementAttributes", ListFormat[ListFormat.CaseOrDefaultClauseStatements = 81985] = "CaseOrDefaultClauseStatements", ListFormat[ListFormat.HeritageClauseTypes = 272] = "HeritageClauseTypes", ListFormat[ListFormat.SourceFileStatements = 65537] = "SourceFileStatements", ListFormat[ListFormat.Decorators = 24577] = "Decorators", ListFormat[ListFormat.TypeArguments = 26896] = "TypeArguments", ListFormat[ListFormat.TypeParameters = 26896] = "TypeParameters", ListFormat[ListFormat.Parameters = 1296] = "Parameters", ListFormat[ListFormat.IndexSignatureParameters = 4432] = "IndexSignatureParameters" }(ListFormat = ts.ListFormat || (ts.ListFormat = {})); var PragmaKindFlags; !function (PragmaKindFlags) { PragmaKindFlags[PragmaKindFlags.None = 0] = "None", PragmaKindFlags[PragmaKindFlags.TripleSlashXML = 1] = "TripleSlashXML", PragmaKindFlags[PragmaKindFlags.SingleLine = 2] = "SingleLine", PragmaKindFlags[PragmaKindFlags.MultiLine = 4] = "MultiLine", PragmaKindFlags[PragmaKindFlags.All = 7] = "All", PragmaKindFlags[PragmaKindFlags.Default = 7] = "Default" }(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {})), ts.commentPragmas = _contextuallyTypePragmas({ reference: { args: [{ name: "types", optional: !0, captureSpan: !0 }, { name: "path", optional: !0, captureSpan: !0 }, { name: "no-default-lib", optional: !0 }], kind: 1 }, "amd-dependency": { args: [{ name: "path" }, { name: "name", optional: !0 }], kind: 1 }, "amd-module": { args: [{ name: "name" }], kind: 1 }, "ts-check": { kind: 2 }, "ts-nocheck": { kind: 2 }, jsx: { args: [{ name: "factory" }], kind: 4 } }) }(ts || (ts = {})); var ts; !function (ts) { ts.timestamp = "undefined" != typeof performance && performance.now ? function () { return performance.now() } : Date.now ? Date.now : function () { return +new Date } }(ts || (ts = {})), function (ts) { var performance; !function (performance) { function mark(markName) { enabled && (marks.set(markName, ts.timestamp()), counts.set(markName, (counts.get(markName) || 0) + 1), profilerEvent(markName)) } function measure(measureName, startMarkName, endMarkName) { if (enabled) { var end = endMarkName && marks.get(endMarkName) || ts.timestamp(), start = startMarkName && marks.get(startMarkName) || profilerStart; measures.set(measureName, (measures.get(measureName) || 0) + (end - start)) } } function getCount(markName) { return counts && counts.get(markName) || 0 } function getDuration(measureName) { return measures && measures.get(measureName) || 0 } function forEachMeasure(cb) { measures.forEach(function (measure, key) { cb(key, measure) }) } function enable() { counts = ts.createMap(), marks = ts.createMap(), measures = ts.createMap(), enabled = !0, profilerStart = ts.timestamp() } function disable() { enabled = !1 } var counts, marks, measures, profilerEvent = "function" == typeof onProfilerEvent && onProfilerEvent.profiler === !0 ? onProfilerEvent : function () { }, enabled = !1, profilerStart = 0; performance.mark = mark, performance.measure = measure, performance.getCount = getCount, performance.getDuration = getDuration, performance.forEachMeasure = forEachMeasure, performance.enable = enable, performance.disable = disable }(performance = ts.performance || (ts.performance = {})) }(ts || (ts = {})); var ts; !function (ts) { ts.versionMajorMinor = "2.9", ts.version = ts.versionMajorMinor + ".2" }(ts || (ts = {})), function (ts) { function isExternalModuleNameRelative(moduleName) { return ts.pathIsRelative(moduleName) || ts.isRootedDiskPath(moduleName) } function sortAndDeduplicateDiagnostics(diagnostics) { return ts.sortAndDeduplicate(diagnostics, ts.compareDiagnostics) } ts.isExternalModuleNameRelative = isExternalModuleNameRelative, ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics }(ts || (ts = {})), function (ts) { function closeFileWatcher(watcher) { watcher.close() } function createDictionaryObject() { var map = Object.create(null); return map.__ = void 0, delete map.__, map } function createMap() { return new MapCtr } function createUnderscoreEscapedMap() { return new MapCtr } function createSymbolTable(symbols) { var result = createMap(); if (symbols) for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; result.set(symbol.escapedName, symbol) } return result } function createMapFromTemplate(template) { var map = new MapCtr; for (var key in template) hasOwnProperty.call(template, key) && map.set(key, template[key]); return map } function shimMap() { var MapIterator = function () { function MapIterator(data, selector) { this.index = 0, this.data = data, this.selector = selector, this.keys = Object.keys(data) } return MapIterator.prototype.next = function () { var index = this.index; return index < this.keys.length ? (this.index++ , { value: this.selector(this.data, this.keys[index]), done: !1 }) : { value: void 0, done: !0 } }, MapIterator }(); return function () { function class_1() { this.data = createDictionaryObject(), this.size = 0 } return class_1.prototype.get = function (key) { return this.data[key] }, class_1.prototype.set = function (key, value) { return this.has(key) || this.size++ , this.data[key] = value, this }, class_1.prototype.has = function (key) { return key in this.data }, class_1.prototype.delete = function (key) { return !!this.has(key) && (this.size-- , delete this.data[key], !0) }, class_1.prototype.clear = function () { this.data = createDictionaryObject(), this.size = 0 }, class_1.prototype.keys = function () { return new MapIterator(this.data, function (_data, key) { return key }) }, class_1.prototype.values = function () { return new MapIterator(this.data, function (data, key) { return data[key] }) }, class_1.prototype.entries = function () { return new MapIterator(this.data, function (data, key) { return [key, data[key]] }) }, class_1.prototype.forEach = function (action) { for (var key in this.data) action(this.data[key], key) }, class_1 }() } function toPath(fileName, basePath, getCanonicalFileName) { var nonCanonicalizedPath = isRootedDiskPath(fileName) ? normalizePath(fileName) : getNormalizedAbsolutePath(fileName, basePath); return getCanonicalFileName(nonCanonicalizedPath) } function length(array) { return array ? array.length : 0 } function forEach(array, callback) { if (array) for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) return result } } function firstDefined(array, callback) { if (void 0 !== array) for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (void 0 !== result) return result } } function firstDefinedIterator(iter, callback) { for (; ;) { var _a = iter.next(), value = _a.value, done = _a.done; if (done) return; var result = callback(value); if (void 0 !== result) return result } } function findAncestor(node, callback) { for (; node;) { var result = callback(node); if ("quit" === result) return; if (result) return node; node = node.parent } } function zipWith(arrayA, arrayB, callback) { var result = []; Debug.assertEqual(arrayA.length, arrayB.length); for (var i = 0; i < arrayA.length; i++)result.push(callback(arrayA[i], arrayB[i], i)); return result } function zipToIterator(arrayA, arrayB) { Debug.assertEqual(arrayA.length, arrayB.length); var i = 0; return { next: function () { return i === arrayA.length ? { value: void 0, done: !0 } : (i++ , { value: [arrayA[i - 1], arrayB[i - 1]], done: !1 }) } } } function zipToMap(keys, values) { Debug.assert(keys.length === values.length); for (var map = createMap(), i = 0; i < keys.length; ++i)map.set(keys[i], values[i]); return map } function every(array, callback) { if (array) for (var i = 0; i < array.length; i++)if (!callback(array[i], i)) return !1; return !0 } function find(array, predicate) { for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) return value } } function findLast(array, predicate) { for (var i = array.length - 1; i >= 0; i--) { var value = array[i]; if (predicate(value, i)) return value } } function findIndex(array, predicate, startIndex) { for (var i = startIndex || 0; i < array.length; i++)if (predicate(array[i], i)) return i; return -1 } function findLastIndex(array, predicate, startIndex) { for (var i = void 0 === startIndex ? array.length - 1 : startIndex; i >= 0; i--)if (predicate(array[i], i)) return i; return -1 } function findMap(array, callback) { for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) return result } Debug.fail() } function contains(array, value, equalityComparer) { if (void 0 === equalityComparer && (equalityComparer = equateValues), array) for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var v = array_1[_i]; if (equalityComparer(v, value)) return !0 } return !1 } function arraysEqual(a, b, equalityComparer) { return void 0 === equalityComparer && (equalityComparer = equateValues), a.length === b.length && a.every(function (x, i) { return equalityComparer(x, b[i]) }) } function indexOfAnyCharCode(text, charCodes, start) { for (var i = start || 0; i < text.length; i++)if (contains(charCodes, text.charCodeAt(i))) return i; return -1 } function countWhere(array, predicate) { var count = 0; if (array) for (var i = 0; i < array.length; i++) { var v = array[i]; predicate(v, i) && count++ } return count } function filter(array, f) { if (array) { for (var len = array.length, i = 0; i < len && f(array[i]);)i++; if (i < len) { var result = array.slice(0, i); for (i++; i < len;) { var item = array[i]; f(item) && result.push(item), i++ } return result } } return array } function filterMutate(array, f) { for (var outIndex = 0, i = 0; i < array.length; i++)f(array[i], i, array) && (array[outIndex] = array[i], outIndex++); array.length = outIndex } function clear(array) { array.length = 0 } function map(array, f) { var result; if (array) { result = []; for (var i = 0; i < array.length; i++)result.push(f(array[i], i)) } return result } function mapIterator(iter, mapFn) { return { next: function () { var iterRes = iter.next(); return iterRes.done ? iterRes : { value: mapFn(iterRes.value), done: !1 } } } } function sameMap(array, f) { if (array) for (var i = 0; i < array.length; i++) { var item = array[i], mapped = f(item, i); if (item !== mapped) { var result = array.slice(0, i); for (result.push(mapped), i++; i < array.length; i++)result.push(f(array[i], i)); return result } } return array } function flatten(array) { var result; if (array) { result = []; for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { var v = array_2[_i]; v && (isArray(v) ? addRange(result, v) : result.push(v)) } } return result } function flatMap(array, mapfn) { var result; if (array) { result = []; for (var i = 0; i < array.length; i++) { var v = mapfn(array[i], i); v && (isArray(v) ? addRange(result, v) : result.push(v)) } } return result } function flatMapIterator(iter, mapfn) { function getIterator(x) { var res = mapfn(x); return void 0 === res ? ts.emptyIterator : isArray(res) ? arrayIterator(res) : res } var first = iter.next(); if (first.done) return ts.emptyIterator; var currentIter = getIterator(first.value); return { next: function () { for (; ;) { var currentRes = currentIter.next(); if (!currentRes.done) return currentRes; var iterRes = iter.next(); if (iterRes.done) return iterRes; currentIter = getIterator(iterRes.value) } } } } function sameFlatMap(array, mapfn) { var result; if (array) for (var i = 0; i < array.length; i++) { var item = array[i], mapped = mapfn(item, i); (result || item !== mapped || isArray(mapped)) && (result || (result = array.slice(0, i)), isArray(mapped) ? addRange(result, mapped) : result.push(mapped)) } return result || array } function mapAllOrFail(array, mapFn) { for (var result = [], i = 0; i < array.length; i++) { var mapped = mapFn(array[i], i); if (void 0 === mapped) return; result.push(mapped) } return result } function mapDefined(array, mapFn) { var result = []; if (array) for (var i = 0; i < array.length; i++) { var mapped = mapFn(array[i], i); void 0 !== mapped && result.push(mapped) } return result } function mapDefinedIterator(iter, mapFn) { return { next: function () { for (; ;) { var res = iter.next(); if (res.done) return res; var value = mapFn(res.value); if (void 0 !== value) return { value: value, done: !1 } } } } } function singleIterator(value) { var done = !1; return { next: function () { var wasDone = done; return done = !0, wasDone ? { value: void 0, done: !0 } : { value: value, done: !1 } } } } function spanMap(array, keyfn, mapfn) { var result; if (array) { result = []; for (var len = array.length, previousKey = void 0, key = void 0, start = 0, pos = 0; start < len;) { for (; pos < len;) { var value = array[pos]; if (key = keyfn(value, pos), 0 === pos) previousKey = key; else if (key !== previousKey) break; pos++ } if (start < pos) { var v = mapfn(array.slice(start, pos), previousKey, start, pos); v && result.push(v), start = pos } previousKey = key, pos++ } } return result } function mapEntries(map, f) { if (map) { var result = createMap(); return map.forEach(function (value, key) { var _a = f(key, value), newKey = _a[0], newValue = _a[1]; result.set(newKey, newValue) }), result } } function some(array, predicate) { if (array) { if (!predicate) return array.length > 0; for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { var v = array_3[_i]; if (predicate(v)) return !0 } } return !1 } function getRangesWhere(arr, pred, cb) { for (var start, i = 0; i < arr.length; i++)pred(arr[i]) ? start = void 0 === start ? i : start : void 0 !== start && (cb(start, i), start = void 0); void 0 !== start && cb(start, arr.length) } function concatenate(array1, array2) { return some(array2) ? some(array1) ? array1.concat(array2) : array2 : array1 } function deduplicateRelational(array, equalityComparer, comparer) { var indices = array.map(function (_, i) { return i }); stableSortIndices(array, indices, comparer); for (var last = array[indices[0]], deduplicated = [indices[0]], i = 1; i < indices.length; i++) { var index = indices[i], item = array[index]; equalityComparer(last, item) || (deduplicated.push(index), last = item) } return deduplicated.sort(), deduplicated.map(function (i) { return array[i] }) } function deduplicateEquality(array, equalityComparer) { for (var result = [], _i = 0, array_4 = array; _i < array_4.length; _i++) { var item = array_4[_i]; pushIfUnique(result, item, equalityComparer) } return result } function deduplicate(array, equalityComparer, comparer) { return array ? 0 === array.length ? [] : 1 === array.length ? array.slice() : comparer ? deduplicateRelational(array, equalityComparer, comparer) : deduplicateEquality(array, equalityComparer) : void 0 } function deduplicateSorted(array, comparer) { if (array) { if (0 === array.length) return []; for (var last = array[0], deduplicated = [last], i = 1; i < array.length; i++) { var next = array[i]; switch (comparer(next, last)) { case !0: case 0: continue; case -1: return Debug.fail("Array is unsorted.") }deduplicated.push(last = next) } return deduplicated } } function insertSorted(array, insert, compare) { if (0 === array.length) return void array.push(insert); var insertIndex = binarySearch(array, insert, identity, compare); insertIndex < 0 && array.splice(~insertIndex, 0, insert) } function sortAndDeduplicate(array, comparer, equalityComparer) { return deduplicateSorted(sort(array, comparer), equalityComparer || comparer) } function arrayIsEqualTo(array1, array2, equalityComparer) { if (void 0 === equalityComparer && (equalityComparer = equateValues), !array1 || !array2) return array1 === array2; if (array1.length !== array2.length) return !1; for (var i = 0; i < array1.length; i++)if (!equalityComparer(array1[i], array2[i])) return !1; return !0 } function changesAffectModuleResolution(oldOptions, newOptions) { return !(oldOptions && oldOptions.module === newOptions.module && oldOptions.moduleResolution === newOptions.moduleResolution && oldOptions.noResolve === newOptions.noResolve && oldOptions.target === newOptions.target && oldOptions.noLib === newOptions.noLib && oldOptions.jsx === newOptions.jsx && oldOptions.allowJs === newOptions.allowJs && oldOptions.rootDir === newOptions.rootDir && oldOptions.configFilePath === newOptions.configFilePath && oldOptions.baseUrl === newOptions.baseUrl && oldOptions.maxNodeModuleJsDepth === newOptions.maxNodeModuleJsDepth && arrayIsEqualTo(oldOptions.lib, newOptions.lib) && arrayIsEqualTo(oldOptions.typeRoots, newOptions.typeRoots) && arrayIsEqualTo(oldOptions.rootDirs, newOptions.rootDirs) && equalOwnProperties(oldOptions.paths, newOptions.paths)) } function compact(array) { var result; if (array) for (var i = 0; i < array.length; i++) { var v = array[i]; !result && v || (result || (result = array.slice(0, i)), v && result.push(v)) } return result || array } function relativeComplement(arrayA, arrayB, comparer) { if (!arrayB || !arrayA || 0 === arrayB.length || 0 === arrayA.length) return arrayB; var result = []; loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) { offsetB > 0 && Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0); loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++)switch (offsetA > startA && Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0), comparer(arrayB[offsetB], arrayA[offsetA])) { case -1: result.push(arrayB[offsetB]); continue loopB; case 0: continue loopB; case 1: continue loopA } } return result } function sum(array, prop) { for (var result = 0, _i = 0, array_5 = array; _i < array_5.length; _i++) { var v = array_5[_i]; result += v[prop] } return result } function append(to, value) { return void 0 === value ? to : void 0 === to ? [value] : (to.push(value), to) } function toOffset(array, offset) { return offset < 0 ? array.length + offset : offset } function addRange(to, from, start, end) { if (void 0 === from || 0 === from.length) return to; if (void 0 === to) return from.slice(start, end); start = void 0 === start ? 0 : toOffset(from, start), end = void 0 === end ? from.length : toOffset(from, end); for (var i = start; i < end && i < from.length; i++)void 0 !== from[i] && to.push(from[i]); return to } function pushIfUnique(array, toAdd, equalityComparer) { return !contains(array, toAdd, equalityComparer) && (array.push(toAdd), !0) } function appendIfUnique(array, toAdd, equalityComparer) { return array ? (pushIfUnique(array, toAdd, equalityComparer), array) : [toAdd] } function stableSortIndices(array, indices, comparer) { indices.sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y) }) } function sort(array, comparer) { return array.slice().sort(comparer) } function best(iter, isBetter) { var x = iter.next(); if (!x.done) for (var best = x.value; ;) { var _a = iter.next(), value = _a.value, done = _a.done; if (done) return best; isBetter(value, best) && (best = value) } } function arrayIterator(array) { var i = 0; return { next: function () { return i === array.length ? { value: void 0, done: !0 } : (i++ , { value: array[i - 1], done: !1 }) } } } function stableSort(array, comparer) { var indices = array.map(function (_, i) { return i }); return stableSortIndices(array, indices, comparer), indices.map(function (i) { return array[i] }) } function rangeEquals(array1, array2, pos, end) { for (; pos < end;) { if (array1[pos] !== array2[pos]) return !1; pos++ } return !0 } function elementAt(array, offset) { if (array && (offset = toOffset(array, offset), offset < array.length)) return array[offset] } function firstOrUndefined(array) { return 0 === array.length ? void 0 : array[0] } function first(array) { return Debug.assert(0 !== array.length), array[0] } function lastOrUndefined(array) { return 0 === array.length ? void 0 : array[array.length - 1] } function last(array) { return Debug.assert(0 !== array.length), array[array.length - 1] } function singleOrUndefined(array) { return array && 1 === array.length ? array[0] : void 0 } function singleOrMany(array) { return array && 1 === array.length ? array[0] : array } function replaceElement(array, index, value) { var result = array.slice(0); return result[index] = value, result } function binarySearch(array, value, keySelector, keyComparer, offset) { if (!array || 0 === array.length) return -1; for (var low = offset || 0, high = array.length - 1, key = keySelector(value); low <= high;) { var middle = low + (high - low >> 1), midKey = keySelector(array[middle]); switch (keyComparer(midKey, key)) { case -1: low = middle + 1; break; case 0: return middle; case 1: high = middle - 1 } } return ~low } function reduceLeft(array, f, initial, start, count) { if (array && array.length > 0) { var size = array.length; if (size > 0) { var pos = void 0 === start || start < 0 ? 0 : start, end = void 0 === count || pos + count > size - 1 ? size - 1 : pos + count, result = void 0; for (arguments.length <= 2 ? (result = array[pos], pos++) : result = initial; pos <= end;)result = f(result, array[pos], pos), pos++; return result } } return initial } function hasProperty(map, key) { return hasOwnProperty.call(map, key) } function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : void 0 } function getOwnKeys(map) { var keys = []; for (var key in map) hasOwnProperty.call(map, key) && keys.push(key); return keys } function getOwnValues(sparseArray) { var values = []; for (var key in sparseArray) hasOwnProperty.call(sparseArray, key) && values.push(sparseArray[key]); return values } function arrayFrom(iterator, map) { for (var _a, result = [], _b = iterator.next(), value = _b.value, done = _b.done; !done; _a = iterator.next(), value = _a.value, done = _a.done, _a)result.push(map ? map(value) : value); return result } function forEachEntry(map, callback) { for (var _a, iterator = map.entries(), _b = iterator.next(), pair = _b.value, done = _b.done; !done; _a = iterator.next(), pair = _a.value, done = _a.done, _a) { var key = pair[0], value = pair[1], result = callback(value, key); if (result) return result } } function forEachKey(map, callback) { for (var _a, iterator = map.keys(), _b = iterator.next(), key = _b.value, done = _b.done; !done; _a = iterator.next(), key = _a.value, done = _a.done, _a) { var result = callback(key); if (result) return result } } function copyEntries(source, target) { source.forEach(function (value, key) { target.set(key, value) }) } function assign(t) { for (var args = [], _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { var arg = args_1[_a]; for (var p in arg) hasProperty(arg, p) && (t[p] = arg[p]) } return t } function equalOwnProperties(left, right, equalityComparer) { if (void 0 === equalityComparer && (equalityComparer = equateValues), left === right) return !0; if (!left || !right) return !1; for (var key in left) if (hasOwnProperty.call(left, key)) { if (void 0 === !hasOwnProperty.call(right, key)) return !1; if (!equalityComparer(left[key], right[key])) return !1 } for (var key in right) if (hasOwnProperty.call(right, key) && !hasOwnProperty.call(left, key)) return !1; return !0 } function arrayToMap(array, makeKey, makeValue) { void 0 === makeValue && (makeValue = identity); for (var result = createMap(), _i = 0, array_6 = array; _i < array_6.length; _i++) { var value = array_6[_i], key = makeKey(value); void 0 !== key && result.set(key, makeValue(value)) } return result } function arrayToNumericMap(array, makeKey, makeValue) { void 0 === makeValue && (makeValue = identity); for (var result = [], _i = 0, array_7 = array; _i < array_7.length; _i++) { var value = array_7[_i]; result[makeKey(value)] = makeValue(value) } return result } function arrayToSet(array, makeKey) { return arrayToMap(array, makeKey || function (s) { return s }, function () { return !0 }) } function arrayToMultiMap(values, makeKey, makeValue) { void 0 === makeValue && (makeValue = identity); for (var result = createMultiMap(), _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; result.add(makeKey(value), makeValue(value)) } return result } function group(values, getGroupId) { return arrayFrom(arrayToMultiMap(values, getGroupId).values()) } function cloneMap(map) { var clone = createMap(); return copyEntries(map, clone), clone } function clone(object) { var result = {}; for (var id in object) hasOwnProperty.call(object, id) && (result[id] = object[id]); return result } function extend(first, second) { var result = {}; for (var id in second) hasOwnProperty.call(second, id) && (result[id] = second[id]); for (var id in first) hasOwnProperty.call(first, id) && (result[id] = first[id]); return result } function createMultiMap() { var map = createMap(); return map.add = multiMapAdd, map.remove = multiMapRemove, map } function multiMapAdd(key, value) { var values = this.get(key); return values ? values.push(value) : this.set(key, values = [value]), values } function multiMapRemove(key, value) { var values = this.get(key); values && (unorderedRemoveItem(values, value), values.length || this.delete(key)) } function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array } function toArray(value) { return isArray(value) ? value : [value] } function isString(text) { return "string" == typeof text } function tryCast(value, test) { return void 0 !== value && test(value) ? value : void 0 } function cast(value, test) { return void 0 !== value && test(value) ? value : void (value && "number" == typeof value.kind ? Debug.fail("Invalid cast. The supplied " + Debug.showSyntaxKind(value) + " did not pass the test '" + Debug.getFunctionName(test) + "'.") : Debug.fail("Invalid cast. The supplied value did not pass the test '" + Debug.getFunctionName(test) + "'.")) } function noop(_) { } function returnFalse() { return !1 } function returnTrue() { return !0 } function identity(x) { return x } function toLowerCase(x) { return x.toLowerCase() } function notImplemented() { throw new Error("Not implemented") } function memoize(callback) { var value; return function () { return callback && (value = callback(), callback = void 0), value } } function chain(a, b, c, d, e) { if (e) { for (var args_2 = [], i = 0; i < arguments.length; i++)args_2[i] = arguments[i]; return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t) })) } } return d ? function (t) { return compose(a(t), b(t), c(t), d(t)) } : c ? function (t) { return compose(a(t), b(t), c(t)) } : b ? function (t) { return compose(a(t), b(t)) } : a ? function (t) { return compose(a(t)) } : function (_) { return function (u) { return u } } } function compose(a, b, c, d, e) { if (e) { for (var args_3 = [], i = 0; i < arguments.length; i++)args_3[i] = arguments[i]; return function (t) { return reduceLeft(args_3, function (u, f) { return f(u) }, t) } } return d ? function (t) { return d(c(b(a(t)))) } : c ? function (t) { return c(b(a(t))) } : b ? function (t) { return b(a(t)) } : a ? function (t) { return a(t) } : function (t) { return t } } function formatStringFromArgs(text, args, baseIndex) { return baseIndex = baseIndex || 0, text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]) }) } function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message } function createFileDiagnostic(file, start, length, message) { Debug.assertGreaterThanOrEqual(start, 0), Debug.assertGreaterThanOrEqual(length, 0), file && (Debug.assertLessThanOrEqual(start, file.text.length), Debug.assertLessThanOrEqual(start + length, file.text.length)); var text = getLocaleSpecificMessage(message); return arguments.length > 4 && (text = formatStringFromArgs(text, arguments, 4)), { file: file, start: start, length: length, messageText: text, category: message.category, code: message.code, reportsUnnecessary: message.reportsUnnecessary } } function formatMessage(_dummy, message) { var text = getLocaleSpecificMessage(message); return arguments.length > 2 && (text = formatStringFromArgs(text, arguments, 2)), text } function createCompilerDiagnostic(message) { var text = getLocaleSpecificMessage(message); return arguments.length > 1 && (text = formatStringFromArgs(text, arguments, 1)), { file: void 0, start: void 0, length: void 0, messageText: text, category: message.category, code: message.code, reportsUnnecessary: message.reportsUnnecessary } } function createCompilerDiagnosticFromMessageChain(chain) { return { file: void 0, start: void 0, length: void 0, code: chain.code, category: chain.category, messageText: chain.next ? chain : chain.messageText } } function chainDiagnosticMessages(details, message) { var text = getLocaleSpecificMessage(message); return arguments.length > 2 && (text = formatStringFromArgs(text, arguments, 2)), { messageText: text, category: message.category, code: message.code, next: details } } function concatenateDiagnosticMessageChains(headChain, tailChain) { for (var lastChain = headChain; lastChain.next;)lastChain = lastChain.next; return lastChain.next = tailChain, headChain } function equateValues(a, b) { return a === b } function equateStringsCaseInsensitive(a, b) { return a === b || void 0 !== a && void 0 !== b && a.toUpperCase() === b.toUpperCase() } function equateStringsCaseSensitive(a, b) { return equateValues(a, b) } function compareComparableValues(a, b) { return a === b ? 0 : void 0 === a ? -1 : void 0 === b ? 1 : a < b ? -1 : 1 } function compareValues(a, b) { return compareComparableValues(a, b) } function min(a, b, compare) { return compare(a, b) === -1 ? a : b } function compareStringsCaseInsensitive(a, b) { return a === b ? 0 : void 0 === a ? -1 : void 0 === b ? 1 : (a = a.toUpperCase(), b = b.toUpperCase(), a < b ? -1 : a > b ? 1 : 0) } function compareStringsCaseSensitive(a, b) { return compareComparableValues(a, b) } function getStringComparer(ignoreCase) { return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive } function getUILocale() { return uiLocale } function setUILocale(value) { uiLocale !== value && (uiLocale = value, uiComparerCaseSensitive = void 0) } function compareStringsCaseSensitiveUI(a, b) { var comparer = uiComparerCaseSensitive || (uiComparerCaseSensitive = createUIStringComparer(uiLocale)); return comparer(a, b) } function compareProperties(a, b, key, comparer) { return a === b ? 0 : void 0 === a ? -1 : void 0 === b ? 1 : comparer(a[key], b[key]) } function getDiagnosticFilePath(diagnostic) { return diagnostic.file ? diagnostic.file.path : void 0 } function compareDiagnostics(d1, d2) { return compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0 } function compareBooleans(a, b) { return compareValues(a ? 1 : 0, b ? 1 : 0) } function compareMessageText(text1, text2) { for (; text1 && text2;) { var string1 = isString(text1) ? text1 : text1.messageText, string2 = isString(text2) ? text2 : text2.messageText, res = compareStringsCaseSensitive(string1, string2); if (res) return res; text1 = isString(text1) ? void 0 : text1.next, text2 = isString(text2) ? void 0 : text2.next } return text1 || text2 ? text1 ? 1 : -1 : 0 } function getEmitScriptTarget(compilerOptions) { return compilerOptions.target || 0 } function getEmitModuleKind(compilerOptions) { return "number" == typeof compilerOptions.module ? compilerOptions.module : getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS } function getEmitModuleResolutionKind(compilerOptions) { var moduleResolution = compilerOptions.moduleResolution; return void 0 === moduleResolution && (moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic), moduleResolution } function unreachableCodeIsError(options) { return options.allowUnreachableCode === !1 } function unusedLabelIsError(options) { return options.allowUnusedLabels === !1 } function getAreDeclarationMapsEnabled(options) { return !(!options.declaration || !options.declarationMap) } function getAllowSyntheticDefaultImports(compilerOptions) { var moduleKind = getEmitModuleKind(compilerOptions); return void 0 !== compilerOptions.allowSyntheticDefaultImports ? compilerOptions.allowSyntheticDefaultImports : compilerOptions.esModuleInterop ? moduleKind !== ts.ModuleKind.None && moduleKind < ts.ModuleKind.ES2015 : moduleKind === ts.ModuleKind.System } function getEmitDeclarations(compilerOptions) { return !(!compilerOptions.declaration && !compilerOptions.composite) } function getStrictOptionValue(compilerOptions, flag) { return void 0 === compilerOptions[flag] ? compilerOptions.strict : compilerOptions[flag] } function hasZeroOrOneAsteriskCharacter(str) { for (var seenAsterisk = !1, i = 0; i < str.length; i++)if (42 === str.charCodeAt(i)) { if (seenAsterisk) return !1; seenAsterisk = !0 } return !0 } function normalizeSlashes(path) { return path.replace(backslashRegExp, ts.directorySeparator) } function isVolumeCharacter(charCode) { return charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90 } function getFileUrlVolumeSeparatorEnd(url, start) { var ch0 = url.charCodeAt(start); if (58 === ch0) return start + 1; if (37 === ch0 && 51 === url.charCodeAt(start + 1)) { var ch2 = url.charCodeAt(start + 2); if (97 === ch2 || 65 === ch2) return start + 3 } return -1 } function getEncodedRootLength(path) { if (!path) return 0; var ch0 = path.charCodeAt(0); if (47 === ch0 || 92 === ch0) { if (path.charCodeAt(1) !== ch0) return 1; var p1 = path.indexOf(47 === ch0 ? ts.directorySeparator : altDirectorySeparator, 2); return p1 < 0 ? path.length : p1 + 1 } if (isVolumeCharacter(ch0) && 58 === path.charCodeAt(1)) { var ch2 = path.charCodeAt(2); if (47 === ch2 || 92 === ch2) return 3; if (2 === path.length) return 2 } var schemeEnd = path.indexOf(urlSchemeSeparator); if (schemeEnd !== -1) { var authorityStart = schemeEnd + urlSchemeSeparator.length, authorityEnd = path.indexOf(ts.directorySeparator, authorityStart); if (authorityEnd !== -1) { var scheme = path.slice(0, schemeEnd), authority = path.slice(authorityStart, authorityEnd); if ("file" === scheme && ("" === authority || "localhost" === authority) && isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) { var volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2); if (volumeSeparatorEnd !== -1) { if (47 === path.charCodeAt(volumeSeparatorEnd)) return ~(volumeSeparatorEnd + 1); if (volumeSeparatorEnd === path.length) return ~volumeSeparatorEnd } } return ~(authorityEnd + 1) } return ~path.length } return 0 } function getRootLength(path) { var rootLength = getEncodedRootLength(path); return rootLength < 0 ? ~rootLength : rootLength } function normalizePath(path) { return resolvePath(path) } function normalizePathAndParts(path) { path = normalizeSlashes(path); var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1); if (parts.length) { var joinedParts = root + parts.join(ts.directorySeparator); return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts } } return { path: root, parts: parts } } function getDirectoryPath(path) { path = normalizeSlashes(path); var rootLength = getRootLength(path); return rootLength === path.length ? path : (path = removeTrailingDirectorySeparator(path), path.slice(0, Math.max(rootLength, path.lastIndexOf(ts.directorySeparator)))) } function isUrl(path) { return getEncodedRootLength(path) < 0 } function pathIsRelative(path) { return /^\.\.?($|[\\/])/.test(path) } function isRootedDiskPath(path) { return getEncodedRootLength(path) > 0 } function isDiskPathRoot(path) { var rootLength = getEncodedRootLength(path); return rootLength > 0 && rootLength === path.length } function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { return isRootedDiskPath(absoluteOrRelativePath) ? getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, !1) : absoluteOrRelativePath } function pathComponents(path, rootLength) { var root = path.substring(0, rootLength), rest = path.substring(rootLength).split(ts.directorySeparator); return rest.length && !lastOrUndefined(rest) && rest.pop(), [root].concat(rest) } function getPathComponents(path, currentDirectory) { void 0 === currentDirectory && (currentDirectory = ""), path = combinePaths(currentDirectory, path); var rootLength = getRootLength(path); return pathComponents(path, rootLength) } function reducePathComponents(components) { if (!some(components)) return []; for (var reduced = [components[0]], i = 1; i < components.length; i++) { var component = components[i]; if (component && "." !== component) { if (".." === component) if (reduced.length > 1) { if (".." !== reduced[reduced.length - 1]) { reduced.pop(); continue } } else if (reduced[0]) continue; reduced.push(component) } } return reduced } function getNormalizedPathComponents(path, currentDirectory) { return reducePathComponents(getPathComponents(path, currentDirectory)) } function getNormalizedAbsolutePath(fileName, currentDirectory) { return getPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)) } function getPathFromPathComponents(pathComponents) { if (0 === pathComponents.length) return ""; var root = pathComponents[0] && ensureTrailingDirectorySeparator(pathComponents[0]); return 1 === pathComponents.length ? root : root + pathComponents.slice(1).join(ts.directorySeparator) } function getPathComponentsRelativeTo(from, to, stringEqualityComparer, getCanonicalFileName) { var start, fromComponents = reducePathComponents(getPathComponents(from)), toComponents = reducePathComponents(getPathComponents(to)); for (start = 0; start < fromComponents.length && start < toComponents.length; start++) { var fromComponent = getCanonicalFileName(fromComponents[start]), toComponent = getCanonicalFileName(toComponents[start]), comparer = 0 === start ? equateStringsCaseInsensitive : stringEqualityComparer; if (!comparer(fromComponent, toComponent)) break } if (0 === start) return toComponents; for (var components = toComponents.slice(start), relative = []; start < fromComponents.length; start++)relative.push(".."); return [""].concat(relative, components) } function getRelativePathFromFile(from, to, getCanonicalFileName) { return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from), to, getCanonicalFileName)) } function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) { Debug.assert(getRootLength(fromDirectory) > 0 == getRootLength(to) > 0, "Paths must either both be absolute or both be relative"); var getCanonicalFileName = "function" == typeof getCanonicalFileNameOrIgnoreCase ? getCanonicalFileNameOrIgnoreCase : identity, ignoreCase = "boolean" == typeof getCanonicalFileNameOrIgnoreCase && getCanonicalFileNameOrIgnoreCase, pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? equateStringsCaseInsensitive : equateStringsCaseSensitive, getCanonicalFileName); return getPathFromPathComponents(pathComponents) } function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { var pathComponents = getPathComponentsRelativeTo(resolvePath(currentDirectory, directoryPathOrUrl), resolvePath(currentDirectory, relativeOrAbsolutePath), equateStringsCaseSensitive, getCanonicalFileName), firstComponent = pathComponents[0]; if (isAbsolutePathAnUrl && isRootedDiskPath(firstComponent)) { var prefix = firstComponent.charAt(0) === ts.directorySeparator ? "file://" : "file:///"; pathComponents[0] = prefix + firstComponent } return getPathFromPathComponents(pathComponents) } function ensurePathIsNonModuleName(path) { return 0 !== getRootLength(path) || pathIsRelative(path) ? path : "./" + path } function getBaseFileName(path, extensions, ignoreCase) { path = normalizeSlashes(path); var rootLength = getRootLength(path); if (rootLength === path.length) return ""; path = removeTrailingDirectorySeparator(path); var name = path.slice(Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator) + 1)), extension = void 0 !== extensions && void 0 !== ignoreCase ? getAnyExtensionFromPath(name, extensions, ignoreCase) : void 0; return extension ? name.slice(0, name.length - extension.length) : name } function combinePaths(path) { for (var paths = [], _i = 1; _i < arguments.length; _i++)paths[_i - 1] = arguments[_i]; path && (path = normalizeSlashes(path)); for (var _a = 0, paths_1 = paths; _a < paths_1.length; _a++) { var relativePath = paths_1[_a]; relativePath && (relativePath = normalizeSlashes(relativePath), path = path && 0 === getRootLength(relativePath) ? ensureTrailingDirectorySeparator(path) + relativePath : relativePath) } return path } function resolvePath(path) { for (var paths = [], _i = 1; _i < arguments.length; _i++)paths[_i - 1] = arguments[_i]; var combined = some(paths) ? combinePaths.apply(void 0, [path].concat(paths)) : normalizeSlashes(path), normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(combined))); return normalized && hasTrailingDirectorySeparator(combined) ? ensureTrailingDirectorySeparator(normalized) : normalized } function hasTrailingDirectorySeparator(path) { if (0 === path.length) return !1; var ch = path.charCodeAt(path.length - 1); return 47 === ch || 92 === ch } function removeTrailingDirectorySeparator(path) { return hasTrailingDirectorySeparator(path) ? path.substr(0, path.length - 1) : path } function ensureTrailingDirectorySeparator(path) { return hasTrailingDirectorySeparator(path) ? path : path + ts.directorySeparator } function comparePathsWorker(a, b, componentComparer) { if (a === b) return 0; if (void 0 === a) return -1; if (void 0 === b) return 1; for (var aComponents = reducePathComponents(getPathComponents(a)), bComponents = reducePathComponents(getPathComponents(b)), sharedLength = Math.min(aComponents.length, bComponents.length), i = 0; i < sharedLength; i++) { var stringComparer = 0 === i ? compareStringsCaseInsensitive : componentComparer, result = stringComparer(aComponents[i], bComponents[i]); if (0 !== result) return result } return compareValues(aComponents.length, bComponents.length) } function comparePathsCaseSensitive(a, b) { return comparePathsWorker(a, b, compareStringsCaseSensitive) } function comparePathsCaseInsensitive(a, b) { return comparePathsWorker(a, b, compareStringsCaseInsensitive) } function comparePaths(a, b, currentDirectory, ignoreCase) { return "string" == typeof currentDirectory ? (a = combinePaths(currentDirectory, a), b = combinePaths(currentDirectory, b)) : "boolean" == typeof currentDirectory && (ignoreCase = currentDirectory), comparePathsWorker(a, b, getStringComparer(ignoreCase)) } function containsPath(parent, child, currentDirectory, ignoreCase) { if ("string" == typeof currentDirectory ? (parent = combinePaths(currentDirectory, parent), child = combinePaths(currentDirectory, child)) : "boolean" == typeof currentDirectory && (ignoreCase = currentDirectory), void 0 === parent || void 0 === child) return !1; if (parent === child) return !0; var parentComponents = reducePathComponents(getPathComponents(parent)), childComponents = reducePathComponents(getPathComponents(child)); if (childComponents.length < parentComponents.length) return !1; for (var componentEqualityComparer = ignoreCase ? equateStringsCaseInsensitive : equateStringsCaseSensitive, i = 0; i < parentComponents.length; i++) { var equalityComparer = 0 === i ? equateStringsCaseInsensitive : componentEqualityComparer; if (!equalityComparer(parentComponents[i], childComponents[i])) return !1 } return !0 } function startsWith(str, prefix) { return 0 === str.lastIndexOf(prefix, 0) } function removePrefix(str, prefix) { return startsWith(str, prefix) ? str.substr(prefix.length) : str } function tryRemovePrefix(str, prefix) { return startsWith(str, prefix) ? str.substring(prefix.length) : void 0 } function tryRemoveDirectoryPrefix(path, dirPath) { var a = tryRemovePrefix(path, dirPath); if (void 0 !== a) switch (a.charCodeAt(0)) { case 47: case 92: return a.slice(1); default: return } } function endsWith(str, suffix) { var expectedPos = str.length - suffix.length; return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos } function removeSuffix(str, suffix) { return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str } function tryRemoveSuffix(str, suffix) { return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : void 0 } function stringContains(str, substring) { return str.indexOf(substring) !== -1 } function hasExtension(fileName) { return stringContains(getBaseFileName(fileName), ".") } function fileExtensionIs(path, extension) { return path.length > extension.length && endsWith(path, extension) } function fileExtensionIsOneOf(path, extensions) { for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) { var extension = extensions_1[_i]; if (fileExtensionIs(path, extension)) return !0 } return !1 } function getRegularExpressionForWildcard(specs, basePath, usage) { var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); if (patterns && patterns.length) { var pattern = patterns.map(function (pattern) { return "(" + pattern + ")" }).join("|"), terminator = "exclude" === usage ? "($|/)" : "$"; return "^(" + pattern + ")" + terminator } } function getRegularExpressionsForWildcards(specs, basePath, usage) { if (void 0 !== specs && 0 !== specs.length) return flatMap(specs, function (spec) { return spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]) }) } function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent) } function getSubPatternFromSpec(spec, basePath, usage, _a) { var singleAsteriskRegexFragment = _a.singleAsteriskRegexFragment, doubleAsteriskRegexFragment = _a.doubleAsteriskRegexFragment, replaceWildcardCharacter = _a.replaceWildcardCharacter, subpattern = "", hasWrittenComponent = !1, components = getNormalizedPathComponents(spec, basePath), lastComponent = lastOrUndefined(components); if ("exclude" === usage || "**" !== lastComponent) { components[0] = removeTrailingDirectorySeparator(components[0]), isImplicitGlob(lastComponent) && components.push("**", "*"); for (var optionalCount = 0, _i = 0, components_1 = components; _i < components_1.length; _i++) { var component = components_1[_i]; if ("**" === component) subpattern += doubleAsteriskRegexFragment; else if ("directories" === usage && (subpattern += "(", optionalCount++), hasWrittenComponent && (subpattern += ts.directorySeparator), "exclude" !== usage) { var componentPattern = ""; 42 === component.charCodeAt(0) ? (componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?", component = component.substr(1)) : 63 === component.charCodeAt(0) && (componentPattern += "[^./]", component = component.substr(1)), componentPattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter), componentPattern !== component && (subpattern += implicitExcludePathRegexPattern), subpattern += componentPattern } else subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); hasWrittenComponent = !0 } for (; optionalCount > 0;)subpattern += ")?", optionalCount--; return subpattern } } function replaceWildcardCharacter(match, singleAsteriskRegexFragment) { return "*" === match ? singleAsteriskRegexFragment : "?" === match ? "[^/]" : "\\" + match } function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) { path = normalizePath(path), currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$" }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames) } } function getRegexFromPattern(pattern, useCaseSensitiveFileNames) { return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i") } function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) { function visitDirectory(path, absolutePath, depth) { for (var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories, _loop_1 = function (current) { var name = combinePaths(path, current), absoluteName = combinePaths(absolutePath, current); if (extensions && !fileExtensionIsOneOf(name, extensions)) return "continue"; if (excludeRegex && excludeRegex.test(absoluteName)) return "continue"; if (includeFileRegexes) { var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName) }); includeIndex !== -1 && results[includeIndex].push(name) } else results[0].push(name) }, _i = 0, _b = sort(files, compareStringsCaseSensitive); _i < _b.length; _i++) { var current = _b[_i]; _loop_1(current) } if (void 0 === depth || (depth-- , 0 !== depth)) for (var _c = 0, _d = sort(directories, compareStringsCaseSensitive); _c < _d.length; _c++) { var current = _d[_c], name = combinePaths(path, current), absoluteName = combinePaths(absolutePath, current); includeDirectoryRegex && !includeDirectoryRegex.test(absoluteName) || excludeRegex && excludeRegex.test(absoluteName) || visitDirectory(name, absoluteName, depth) } } path = normalizePath(path), currentDirectory = normalizePath(currentDirectory); for (var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory), includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return getRegexFromPattern(pattern, useCaseSensitiveFileNames) }), includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames), excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames), results = includeFileRegexes ? includeFileRegexes.map(function () { return [] }) : [[]], _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth) } return flatten(results) } function getBasePaths(path, includes, useCaseSensitiveFileNames) { var basePaths = [path]; if (includes) { for (var includeBasePaths = [], _i = 0, includes_1 = includes; _i < includes_1.length; _i++) { var include = includes_1[_i], absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include)); includeBasePaths.push(getIncludeBasePath(absolute)) } includeBasePaths.sort(getStringComparer(!useCaseSensitiveFileNames)); for (var _loop_2 = function (includeBasePath) { every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames) }) && basePaths.push(includeBasePath) }, _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; _loop_2(includeBasePath) } } return basePaths } function getIncludeBasePath(absolute) { var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes); return wildcardOffset < 0 ? hasExtension(absolute) ? removeTrailingDirectorySeparator(getDirectoryPath(absolute)) : absolute : absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset)) } function ensureScriptKind(fileName, scriptKind) { return scriptKind || getScriptKindFromFileName(fileName) || 3 } function getScriptKindFromFileName(fileName) { var ext = fileName.substr(fileName.lastIndexOf(".")); switch (ext.toLowerCase()) { case ".js": return 1; case ".jsx": return 2; case ".ts": return 3; case ".tsx": return 4; case ".json": return 6; default: return 0 } } function getSupportedExtensions(options, extraFileExtensions) { var needJsExtensions = options && options.allowJs; if (!extraFileExtensions || 0 === extraFileExtensions.length) return needJsExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; var extensions = (needJsExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).concat(mapDefined(extraFileExtensions, function (x) { return 7 === x.scriptKind || needJsExtensions && isJavaScriptLike(x.scriptKind) ? x.extension : void 0 })); return deduplicate(extensions, equateStringsCaseSensitive, compareStringsCaseSensitive) } function isJavaScriptLike(scriptKind) { return 1 === scriptKind || 2 === scriptKind } function hasJavaScriptFileExtension(fileName) { return forEach(ts.supportedJavascriptExtensions, function (extension) { return fileExtensionIs(fileName, extension) }) } function hasTypeScriptFileExtension(fileName) { return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension) }) } function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) return !1; for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) return !0 } return !1 } function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--)if (fileExtensionIs(path, supportedExtensions[i])) return adjustExtensionPriority(i, supportedExtensions); return 0 } function adjustExtensionPriority(extensionPriority, supportedExtensions) { return extensionPriority < 2 ? 0 : extensionPriority < supportedExtensions.length ? 2 : supportedExtensions.length } function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) { return extensionPriority < 2 ? 2 : supportedExtensions.length } function removeFileExtension(path) { for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) { var ext = extensionsToRemove_1[_i], extensionless = tryRemoveExtension(path, ext); if (void 0 !== extensionless) return extensionless } return path } function tryRemoveExtension(path, extension) { return fileExtensionIs(path, extension) ? removeExtension(path, extension) : void 0 } function removeExtension(path, extension) { return path.substring(0, path.length - extension.length) } function changeExtension(path, newExtension) { return changeAnyExtension(path, newExtension, extensionsToRemove, !1) } function changeAnyExtension(path, ext, extensions, ignoreCase) { var pathext = void 0 !== extensions && void 0 !== ignoreCase ? getAnyExtensionFromPath(path, extensions, ignoreCase) : getAnyExtensionFromPath(path); return pathext ? path.slice(0, path.length - pathext.length) + (startsWith(ext, ".") ? ext : "." + ext) : path } function removeMinAndVersionNumbers(fileName) { var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/; return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, "") } function Symbol(flags, name) { this.flags = flags, this.escapedName = name, this.declarations = void 0, this.valueDeclaration = void 0, this.id = void 0, this.mergeId = void 0, this.parent = void 0 } function Type(checker, flags) { this.flags = flags, Debug.isDebugging && (this.checker = checker) } function Signature() { } function Node(kind, pos, end) { this.pos = pos, this.end = end, this.kind = kind, this.id = 0, this.flags = 0, this.modifierFlagsCache = 0, this.transformFlags = 0, this.parent = void 0, this.original = void 0 } function SourceMapSource(fileName, text, skipTrivia) { this.fileName = fileName, this.text = text, this.skipTrivia = skipTrivia || function (pos) { return pos } } function orderedRemoveItem(array, item) { for (var i = 0; i < array.length; i++)if (array[i] === item) return orderedRemoveItemAt(array, i), !0; return !1 } function orderedRemoveItemAt(array, index) { for (var i = index; i < array.length - 1; i++)array[i] = array[i + 1]; array.pop() } function unorderedRemoveItemAt(array, index) { array[index] = array[array.length - 1], array.pop() } function unorderedRemoveItem(array, item) { return unorderedRemoveFirstItemWhere(array, function (element) { return element === item }) } function unorderedRemoveFirstItemWhere(array, predicate) { for (var i = 0; i < array.length; i++)if (predicate(array[i])) return unorderedRemoveItemAt(array, i), !0; return !1 } function createGetCanonicalFileName(useCaseSensitiveFileNames) { return useCaseSensitiveFileNames ? identity : toLowerCase } function matchPatternOrExact(patternStrings, candidate) { for (var patterns = [], _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) { var patternString = patternStrings_1[_i], pattern = tryParsePattern(patternString); if (pattern) patterns.push(pattern); else if (patternString === candidate) return patternString } return findBestPatternMatch(patterns, function (_) { return _ }, candidate) } function patternText(_a) { var prefix = _a.prefix, suffix = _a.suffix; return prefix + "*" + suffix } function matchedText(pattern, candidate) { return Debug.assert(isPatternMatch(pattern, candidate)), candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length) } function findBestPatternMatch(values, getPattern, candidate) { for (var matchedValue, longestMatchPrefixLength = -1, _i = 0, values_2 = values; _i < values_2.length; _i++) { var v = values_2[_i], pattern = getPattern(v); isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength && (longestMatchPrefixLength = pattern.prefix.length, matchedValue = v) } return matchedValue } function isPatternMatch(_a, candidate) { var prefix = _a.prefix, suffix = _a.suffix; return candidate.length >= prefix.length + suffix.length && startsWith(candidate, prefix) && endsWith(candidate, suffix) } function tryParsePattern(pattern) { Debug.assert(hasZeroOrOneAsteriskCharacter(pattern)); var indexOfStar = pattern.indexOf("*"); return indexOfStar === -1 ? void 0 : { prefix: pattern.substr(0, indexOfStar), suffix: pattern.substr(indexOfStar + 1) } } function positionIsSynthesized(pos) { return !(pos >= 0) } function extensionIsTypeScript(ext) { return ".ts" === ext || ".tsx" === ext || ".d.ts" === ext } function resolutionExtensionIsTypeScriptOrJson(ext) { return extensionIsTypeScript(ext) || ".json" === ext } function extensionFromPath(path) { var ext = tryGetExtensionFromPath(path); return void 0 !== ext ? ext : void Debug.fail("File " + path + " has unknown extension.") } function isAnySupportedFileExtension(path) { return void 0 !== tryGetExtensionFromPath(path) } function tryGetExtensionFromPath(path) { return find(ts.supportedTypescriptExtensionsForExtractExtension, function (e) { return fileExtensionIs(path, e) }) || find(ts.supportedJavascriptExtensions, function (e) { return fileExtensionIs(path, e) }) } function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) { "string" == typeof extensions && (extensions = [extensions]); for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) { var extension = extensions_2[_i]; if (startsWith(extension, ".") || (extension = "." + extension), path.length >= extension.length && "." === path.charAt(path.length - extension.length)) { var pathExtension = path.slice(path.length - extension.length); if (stringEqualityComparer(pathExtension, extension)) return pathExtension } } return "" } function getAnyExtensionFromPath(path, extensions, ignoreCase) { if (extensions) return getAnyExtensionFromPathWorker(path, extensions, ignoreCase ? equateStringsCaseInsensitive : equateStringsCaseSensitive); var baseFileName = getBaseFileName(path), extensionIndex = baseFileName.lastIndexOf("."); return extensionIndex >= 0 ? baseFileName.substring(extensionIndex) : "" } function isCheckJsEnabledForFile(sourceFile, compilerOptions) { return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs } function and(f, g) { return function (arg) { return f(arg) && g(arg) } } function or(f, g) { return function (arg) { return f(arg) || g(arg) } } function assertTypeIsNever(_) { } function singleElementArray(t) { return void 0 === t ? void 0 : [t] } function enumerateInsertsAndDeletes(newItems, oldItems, comparer, inserted, deleted, unchanged) { unchanged = unchanged || noop; for (var newIndex = 0, oldIndex = 0, newLen = newItems.length, oldLen = oldItems.length; newIndex < newLen && oldIndex < oldLen;) { var newItem = newItems[newIndex], oldItem = oldItems[oldIndex], compareResult = comparer(newItem, oldItem); compareResult === -1 ? (inserted(newItem), newIndex++) : 1 === compareResult ? (deleted(oldItem), oldIndex++) : (unchanged(oldItem, newItem), newIndex++ , oldIndex++) } for (; newIndex < newLen;)inserted(newItems[newIndex++]); for (; oldIndex < oldLen;)deleted(oldItems[oldIndex++]) } ts.emptyArray = [], ts.closeFileWatcher = closeFileWatcher, ts.createMap = createMap, ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap, ts.createSymbolTable = createSymbolTable, ts.createMapFromTemplate = createMapFromTemplate; var MapCtr = "undefined" != typeof Map && "entries" in Map.prototype ? Map : shimMap(); ts.toPath = toPath, ts.length = length, ts.forEach = forEach, ts.firstDefined = firstDefined, ts.firstDefinedIterator = firstDefinedIterator, ts.findAncestor = findAncestor, ts.zipWith = zipWith, ts.zipToIterator = zipToIterator, ts.zipToMap = zipToMap, ts.every = every, ts.find = find, ts.findLast = findLast, ts.findIndex = findIndex, ts.findLastIndex = findLastIndex, ts.findMap = findMap, ts.contains = contains, ts.arraysEqual = arraysEqual, ts.indexOfAnyCharCode = indexOfAnyCharCode, ts.countWhere = countWhere, ts.filter = filter, ts.filterMutate = filterMutate, ts.clear = clear, ts.map = map, ts.mapIterator = mapIterator, ts.sameMap = sameMap, ts.flatten = flatten, ts.flatMap = flatMap, ts.flatMapIterator = flatMapIterator, ts.sameFlatMap = sameFlatMap, ts.mapAllOrFail = mapAllOrFail, ts.mapDefined = mapDefined, ts.mapDefinedIterator = mapDefinedIterator, ts.emptyIterator = { next: function () { return { value: void 0, done: !0 } } }, ts.singleIterator = singleIterator, ts.spanMap = spanMap, ts.mapEntries = mapEntries, ts.some = some, ts.getRangesWhere = getRangesWhere, ts.concatenate = concatenate, ts.deduplicate = deduplicate, ts.insertSorted = insertSorted, ts.sortAndDeduplicate = sortAndDeduplicate, ts.arrayIsEqualTo = arrayIsEqualTo, ts.changesAffectModuleResolution = changesAffectModuleResolution, ts.compact = compact, ts.relativeComplement = relativeComplement, ts.sum = sum, ts.append = append, ts.addRange = addRange, ts.pushIfUnique = pushIfUnique, ts.appendIfUnique = appendIfUnique, ts.sort = sort, ts.best = best, ts.arrayIterator = arrayIterator, ts.stableSort = stableSort, ts.rangeEquals = rangeEquals, ts.elementAt = elementAt, ts.firstOrUndefined = firstOrUndefined, ts.first = first, ts.lastOrUndefined = lastOrUndefined, ts.last = last, ts.singleOrUndefined = singleOrUndefined, ts.singleOrMany = singleOrMany, ts.replaceElement = replaceElement, ts.binarySearch = binarySearch, ts.reduceLeft = reduceLeft; var hasOwnProperty = Object.prototype.hasOwnProperty; ts.hasProperty = hasProperty, ts.getProperty = getProperty, ts.getOwnKeys = getOwnKeys, ts.getOwnValues = getOwnValues, ts.arrayFrom = arrayFrom, ts.forEachEntry = forEachEntry, ts.forEachKey = forEachKey, ts.copyEntries = copyEntries, ts.assign = assign, ts.equalOwnProperties = equalOwnProperties, ts.arrayToMap = arrayToMap, ts.arrayToNumericMap = arrayToNumericMap, ts.arrayToSet = arrayToSet, ts.arrayToMultiMap = arrayToMultiMap, ts.group = group, ts.cloneMap = cloneMap, ts.clone = clone, ts.extend = extend, ts.createMultiMap = createMultiMap, ts.isArray = isArray, ts.toArray = toArray, ts.isString = isString, ts.tryCast = tryCast, ts.cast = cast, ts.noop = noop, ts.returnFalse = returnFalse, ts.returnTrue = returnTrue, ts.identity = identity, ts.toLowerCase = toLowerCase, ts.notImplemented = notImplemented, ts.memoize = memoize, ts.chain = chain, ts.compose = compose, ts.formatStringFromArgs = formatStringFromArgs, ts.getLocaleSpecificMessage = getLocaleSpecificMessage, ts.createFileDiagnostic = createFileDiagnostic, ts.formatMessage = formatMessage, ts.createCompilerDiagnostic = createCompilerDiagnostic, ts.createCompilerDiagnosticFromMessageChain = createCompilerDiagnosticFromMessageChain, ts.chainDiagnosticMessages = chainDiagnosticMessages, ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains, ts.equateValues = equateValues, ts.equateStringsCaseInsensitive = equateStringsCaseInsensitive, ts.equateStringsCaseSensitive = equateStringsCaseSensitive, ts.compareValues = compareValues, ts.min = min, ts.compareStringsCaseInsensitive = compareStringsCaseInsensitive, ts.compareStringsCaseSensitive = compareStringsCaseSensitive, ts.getStringComparer = getStringComparer; var uiComparerCaseSensitive, uiLocale, createUIStringComparer = function () { function compareWithCallback(a, b, comparer) { if (a === b) return 0; if (void 0 === a) return -1; if (void 0 === b) return 1; var value = comparer(a, b); return value < 0 ? -1 : value > 0 ? 1 : 0 } function createIntlCollatorStringComparer(locale) { var comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare; return function (a, b) { return compareWithCallback(a, b, comparer) } } function createLocaleCompareStringComparer(locale) { function compareStrings(a, b) { return a.localeCompare(b) } return void 0 !== locale ? createFallbackStringComparer() : function (a, b) { return compareWithCallback(a, b, compareStrings) } } function createFallbackStringComparer() { function compareDictionaryOrder(a, b) { return compareStrings(a.toUpperCase(), b.toUpperCase()) || compareStrings(a, b) } function compareStrings(a, b) { return a < b ? -1 : a > b ? 1 : 0 } return function (a, b) { return compareWithCallback(a, b, compareDictionaryOrder) } } function getStringComparerFactory() { return "object" == typeof Intl && "function" == typeof Intl.Collator ? createIntlCollatorStringComparer : "function" == typeof String.prototype.localeCompare && "function" == typeof String.prototype.toLocaleUpperCase && "a".localeCompare("B") < 0 ? createLocaleCompareStringComparer : createFallbackStringComparer } function createStringComparer(locale) { return void 0 === locale ? defaultComparer || (defaultComparer = stringComparerFactory(locale)) : "en-US" === locale ? enUSComparer || (enUSComparer = stringComparerFactory(locale)) : stringComparerFactory(locale) } var defaultComparer, enUSComparer, stringComparerFactory = getStringComparerFactory(); return createStringComparer }(); ts.getUILocale = getUILocale, ts.setUILocale = setUILocale, ts.compareStringsCaseSensitiveUI = compareStringsCaseSensitiveUI, ts.compareProperties = compareProperties, ts.compareDiagnostics = compareDiagnostics, ts.compareBooleans = compareBooleans, ts.getEmitScriptTarget = getEmitScriptTarget, ts.getEmitModuleKind = getEmitModuleKind, ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind, ts.unreachableCodeIsError = unreachableCodeIsError, ts.unusedLabelIsError = unusedLabelIsError, ts.getAreDeclarationMapsEnabled = getAreDeclarationMapsEnabled, ts.getAllowSyntheticDefaultImports = getAllowSyntheticDefaultImports, ts.getEmitDeclarations = getEmitDeclarations, ts.getStrictOptionValue = getStrictOptionValue, ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter, ts.directorySeparator = "/"; var altDirectorySeparator = "\\", urlSchemeSeparator = "://", backslashRegExp = /\\/g; ts.normalizeSlashes = normalizeSlashes, ts.getRootLength = getRootLength, ts.normalizePath = normalizePath, ts.normalizePathAndParts = normalizePathAndParts, ts.getDirectoryPath = getDirectoryPath, ts.isUrl = isUrl, ts.pathIsRelative = pathIsRelative, ts.isRootedDiskPath = isRootedDiskPath, ts.isDiskPathRoot = isDiskPathRoot, ts.convertToRelativePath = convertToRelativePath, ts.getPathComponents = getPathComponents, ts.reducePathComponents = reducePathComponents, ts.getNormalizedPathComponents = getNormalizedPathComponents, ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath, ts.getPathFromPathComponents = getPathFromPathComponents, ts.getRelativePathFromFile = getRelativePathFromFile, ts.getRelativePathFromDirectory = getRelativePathFromDirectory, ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl, ts.ensurePathIsNonModuleName = ensurePathIsNonModuleName, ts.getBaseFileName = getBaseFileName, ts.combinePaths = combinePaths, ts.resolvePath = resolvePath, ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator, ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator, ts.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator, ts.comparePathsCaseSensitive = comparePathsCaseSensitive, ts.comparePathsCaseInsensitive = comparePathsCaseInsensitive, ts.comparePaths = comparePaths, ts.containsPath = containsPath, ts.startsWith = startsWith, ts.removePrefix = removePrefix, ts.tryRemovePrefix = tryRemovePrefix, ts.tryRemoveDirectoryPrefix = tryRemoveDirectoryPrefix, ts.endsWith = endsWith, ts.removeSuffix = removeSuffix, ts.tryRemoveSuffix = tryRemoveSuffix, ts.stringContains = stringContains, ts.hasExtension = hasExtension, ts.fileExtensionIs = fileExtensionIs, ts.fileExtensionIsOneOf = fileExtensionIsOneOf; var reservedCharacterPattern = /[^\w\s\/]/g, wildcardCharCodes = [42, 63]; ts.commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"]; var implicitExcludePathRegexPattern = "(?!(" + ts.commonPackageFolders.join("|") + ")(/|$))", filesMatcher = { singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*", doubleAsteriskRegexFragment: "(/" + implicitExcludePathRegexPattern + "[^/.][^/]*)*?", replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment) } }, directoriesMatcher = { singleAsteriskRegexFragment: "[^/]*", doubleAsteriskRegexFragment: "(/" + implicitExcludePathRegexPattern + "[^/.][^/]*)*?", replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment) } }, excludeMatcher = { singleAsteriskRegexFragment: "[^/]*", doubleAsteriskRegexFragment: "(/.+?)?", replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment) } }, wildcardMatchers = { files: filesMatcher, directories: directoriesMatcher, exclude: excludeMatcher }; ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard, ts.isImplicitGlob = isImplicitGlob, ts.getFileMatcherPatterns = getFileMatcherPatterns, ts.getRegexFromPattern = getRegexFromPattern, ts.matchFiles = matchFiles, ts.ensureScriptKind = ensureScriptKind, ts.getScriptKindFromFileName = getScriptKindFromFileName, ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"], ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"], ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); ts.getSupportedExtensions = getSupportedExtensions, ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension, ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension, ts.isSupportedSourceFileName = isSupportedSourceFileName; var ExtensionPriority; !function (ExtensionPriority) { ExtensionPriority[ExtensionPriority.TypeScriptFiles = 0] = "TypeScriptFiles", ExtensionPriority[ExtensionPriority.DeclarationAndJavaScriptFiles = 2] = "DeclarationAndJavaScriptFiles", ExtensionPriority[ExtensionPriority.Highest = 0] = "Highest", ExtensionPriority[ExtensionPriority.Lowest = 2] = "Lowest" }(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {})), ts.getExtensionPriority = getExtensionPriority, ts.adjustExtensionPriority = adjustExtensionPriority, ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx", ".json"]; ts.removeFileExtension = removeFileExtension, ts.tryRemoveExtension = tryRemoveExtension, ts.removeExtension = removeExtension, ts.changeExtension = changeExtension, ts.changeAnyExtension = changeAnyExtension, ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers, ts.objectAllocator = { getNodeConstructor: function () { return Node }, getTokenConstructor: function () { return Node }, getIdentifierConstructor: function () { return Node }, getSourceFileConstructor: function () { return Node }, getSymbolConstructor: function () { return Symbol }, getTypeConstructor: function () { return Type }, getSignatureConstructor: function () { return Signature }, getSourceMapSourceConstructor: function () { return SourceMapSource } }; var AssertionLevel; !function (AssertionLevel) { AssertionLevel[AssertionLevel.None = 0] = "None", AssertionLevel[AssertionLevel.Normal = 1] = "Normal", AssertionLevel[AssertionLevel.Aggressive = 2] = "Aggressive", AssertionLevel[AssertionLevel.VeryAggressive = 3] = "VeryAggressive" }(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {})); var Debug; !function (Debug) { function shouldAssert(level) { return Debug.currentAssertionLevel >= level } function assert(expression, message, verboseDebugInfo, stackCrawlMark) { expression || (verboseDebugInfo && (message += "\r\nVerbose Debug Information: " + ("string" == typeof verboseDebugInfo ? verboseDebugInfo : verboseDebugInfo())), fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert)) } function assertEqual(a, b, msg, msg2) { if (a !== b) { var message = msg ? msg2 ? msg + " " + msg2 : msg : ""; fail("Expected " + a + " === " + b + ". " + message) } } function assertLessThan(a, b, msg) { a >= b && fail("Expected " + a + " < " + b + ". " + (msg || "")) } function assertLessThanOrEqual(a, b) { a > b && fail("Expected " + a + " <= " + b) } function assertGreaterThanOrEqual(a, b) { a < b && fail("Expected " + a + " >= " + b) } function fail(message, stackCrawlMark) { var e = new Error(message ? "Debug Failure. " + message : "Debug Failure."); throw Error.captureStackTrace && Error.captureStackTrace(e, stackCrawlMark || fail), e } function assertDefined(value, message) { return assert(void 0 !== value && null !== value, message), value } function assertEachDefined(value, message) { for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { var v = value_1[_i]; assertDefined(v, message) } return value } function assertNever(member, message, stackCrawlMark) { return fail(message || "Illegal value: " + member, stackCrawlMark || assertNever) } function getFunctionName(func) { if ("function" != typeof func) return ""; if (func.hasOwnProperty("name")) return func.name; var text = Function.prototype.toString.call(func), match = /^function\s+([\w\$]+)\s*\(/.exec(text); return match ? match[1] : "" } function showSymbol(symbol) { var symbolFlags = ts.SymbolFlags; return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + map(symbol.declarations, showSyntaxKind) + " }" } function showFlags(flags, flagsEnum) { for (var out = [], pow = 0; pow <= 30; pow++) { var n = 1 << pow; flags & n && out.push(flagsEnum[n]) } return out.join("|") } function showSyntaxKind(node) { var syntaxKind = ts.SyntaxKind; return syntaxKind ? syntaxKind[node.kind] : node.kind.toString() } Debug.currentAssertionLevel = 0, Debug.isDebugging = !1, Debug.shouldAssert = shouldAssert, Debug.assert = assert, Debug.assertEqual = assertEqual, Debug.assertLessThan = assertLessThan, Debug.assertLessThanOrEqual = assertLessThanOrEqual, Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual, Debug.fail = fail, Debug.assertDefined = assertDefined, Debug.assertEachDefined = assertEachDefined, Debug.assertNever = assertNever, Debug.getFunctionName = getFunctionName, Debug.showSymbol = showSymbol, Debug.showSyntaxKind = showSyntaxKind }(Debug = ts.Debug || (ts.Debug = {})), ts.orderedRemoveItem = orderedRemoveItem, ts.orderedRemoveItemAt = orderedRemoveItemAt, ts.unorderedRemoveItemAt = unorderedRemoveItemAt, ts.unorderedRemoveItem = unorderedRemoveItem, ts.createGetCanonicalFileName = createGetCanonicalFileName, ts.matchPatternOrExact = matchPatternOrExact, ts.patternText = patternText, ts.matchedText = matchedText, ts.findBestPatternMatch = findBestPatternMatch, ts.tryParsePattern = tryParsePattern, ts.positionIsSynthesized = positionIsSynthesized, ts.extensionIsTypeScript = extensionIsTypeScript, ts.resolutionExtensionIsTypeScriptOrJson = resolutionExtensionIsTypeScriptOrJson, ts.extensionFromPath = extensionFromPath, ts.isAnySupportedFileExtension = isAnySupportedFileExtension, ts.tryGetExtensionFromPath = tryGetExtensionFromPath, ts.getAnyExtensionFromPath = getAnyExtensionFromPath, ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile, ts.and = and, ts.or = or, ts.assertTypeIsNever = assertTypeIsNever, ts.emptyFileSystemEntries = { files: ts.emptyArray, directories: ts.emptyArray }, ts.singleElementArray = singleElementArray, ts.enumerateInsertsAndDeletes = enumerateInsertsAndDeletes }(ts || (ts = {})); var ts; !function (ts) { function setStackTraceLimit() { Error.stackTraceLimit < 100 && (Error.stackTraceLimit = 100) } function getPriorityValues(highPriorityValue) { var mediumPriorityValue = 2 * highPriorityValue, lowPriorityValue = 4 * mediumPriorityValue; return [highPriorityValue, mediumPriorityValue, lowPriorityValue] } function pollingInterval(watchPriority) { return pollingIntervalsForPriority[watchPriority] } function watchFileUsingPriorityPollingInterval(host, fileName, callback, watchPriority) { return host.watchFile(fileName, callback, pollingInterval(watchPriority)) } function createPollingIntervalBasedLevels(levels) { var _a; return _a = {}, _a[PollingInterval.Low] = levels.Low, _a[PollingInterval.Medium] = levels.Medium, _a[PollingInterval.High] = levels.High, _a } function setCustomPollingValues(system) { function getLevel(envVar, level) { return system.getEnvironmentVariable(envVar + "_" + level.toUpperCase()) } function getCustomLevels(baseVariable) { function setCustomLevel(level) { var customLevel = getLevel(baseVariable, level); customLevel && ((customLevels || (customLevels = {}))[level] = Number(customLevel)) } var customLevels; return setCustomLevel("Low"), setCustomLevel("Medium"), setCustomLevel("High"), customLevels } function setCustomLevels(baseVariable, levels) { function setLevel(level) { levels[level] = customLevels[level] || levels[level] } var customLevels = getCustomLevels(baseVariable); return !!customLevels && (setLevel("Low"), setLevel("Medium"), setLevel("High"), !0) } function getCustomPollingBasedLevels(baseVariable, defaultLevels) { var customLevels = getCustomLevels(baseVariable); return (pollingIntervalChanged || customLevels) && createPollingIntervalBasedLevels(customLevels ? __assign({}, defaultLevels, customLevels) : defaultLevels) } if (system.getEnvironmentVariable) { var pollingIntervalChanged = setCustomLevels("TSC_WATCH_POLLINGINTERVAL", PollingInterval); pollingChunkSize = getCustomPollingBasedLevels("TSC_WATCH_POLLINGCHUNKSIZE", defaultChunkLevels) || pollingChunkSize, ts.unchangedPollThresholds = getCustomPollingBasedLevels("TSC_WATCH_UNCHANGEDPOLLTHRESHOLDS", defaultChunkLevels) || ts.unchangedPollThresholds } } function createDynamicPriorityPollingWatchFile(host) { function watchFile(fileName, callback, defaultPollingInterval) { var file = { fileName: fileName, callback: callback, unchangedPolls: 0, mtime: getModifiedTime(fileName) }; return watchedFiles.push(file), addToPollingIntervalQueue(file, defaultPollingInterval), { close: function () { file.isClosed = !0, ts.unorderedRemoveItem(watchedFiles, file) } } } function createPollingIntervalQueue(pollingInterval) { var queue = []; return queue.pollingInterval = pollingInterval, queue.pollIndex = 0, queue.pollScheduled = !1, queue } function pollPollingIntervalQueue(queue) { queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]), queue.length ? scheduleNextPoll(queue.pollingInterval) : (ts.Debug.assert(0 === queue.pollIndex), queue.pollScheduled = !1) } function pollLowPollingIntervalQueue(queue) { pollQueue(changedFilesInLastPoll, PollingInterval.Low, 0, changedFilesInLastPoll.length), pollPollingIntervalQueue(queue), !queue.pollScheduled && changedFilesInLastPoll.length && scheduleNextPoll(PollingInterval.Low) } function pollQueue(queue, pollingInterval, pollIndex, chunkSize) { function nextPollIndex() { pollIndex++ , pollIndex === queue.length && (definedValueCopyToIndex < pollIndex && (queue.length = definedValueCopyToIndex), pollIndex = 0, definedValueCopyToIndex = 0) } for (var needsVisit = queue.length, definedValueCopyToIndex = pollIndex, polled = 0; polled < chunkSize && needsVisit > 0; nextPollIndex(), needsVisit--) { var watchedFile = queue[pollIndex]; if (watchedFile) if (watchedFile.isClosed) queue[pollIndex] = void 0; else { polled++; var fileChanged = onWatchedFileStat(watchedFile, getModifiedTime(watchedFile.fileName)); watchedFile.isClosed ? queue[pollIndex] = void 0 : fileChanged ? (watchedFile.unchangedPolls = 0, queue !== changedFilesInLastPoll && (queue[pollIndex] = void 0, addChangedFileToLowPollingIntervalQueue(watchedFile))) : watchedFile.unchangedPolls !== ts.unchangedPollThresholds[pollingInterval] ? watchedFile.unchangedPolls++ : queue === changedFilesInLastPoll ? (watchedFile.unchangedPolls = 1, queue[pollIndex] = void 0, addToPollingIntervalQueue(watchedFile, PollingInterval.Low)) : pollingInterval !== PollingInterval.High && (watchedFile.unchangedPolls++ , queue[pollIndex] = void 0, addToPollingIntervalQueue(watchedFile, pollingInterval === PollingInterval.Low ? PollingInterval.Medium : PollingInterval.High)), queue[pollIndex] && (definedValueCopyToIndex < pollIndex && (queue[definedValueCopyToIndex] = watchedFile, queue[pollIndex] = void 0), definedValueCopyToIndex++) } } return pollIndex } function pollingIntervalQueue(pollingInterval) { switch (pollingInterval) { case PollingInterval.Low: return lowPollingIntervalQueue; case PollingInterval.Medium: return mediumPollingIntervalQueue; case PollingInterval.High: return highPollingIntervalQueue } } function addToPollingIntervalQueue(file, pollingInterval) { pollingIntervalQueue(pollingInterval).push(file), scheduleNextPollIfNotAlreadyScheduled(pollingInterval) } function addChangedFileToLowPollingIntervalQueue(file) { changedFilesInLastPoll.push(file), scheduleNextPollIfNotAlreadyScheduled(PollingInterval.Low) } function scheduleNextPollIfNotAlreadyScheduled(pollingInterval) { pollingIntervalQueue(pollingInterval).pollScheduled || scheduleNextPoll(pollingInterval) } function scheduleNextPoll(pollingInterval) { pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)) } function getModifiedTime(fileName) { return host.getModifiedTime(fileName) || ts.missingFileModifiedTime } var watchedFiles = [], changedFilesInLastPoll = [], lowPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Low), mediumPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Medium), highPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.High); return watchFile } function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(), newTime = modifiedTime.getTime(); if (oldTime !== newTime) { watchedFile.mtime = modifiedTime; var eventKind = 0 === oldTime ? FileWatcherEventKind.Created : 0 === newTime ? FileWatcherEventKind.Deleted : FileWatcherEventKind.Changed; return watchedFile.callback(watchedFile.fileName, eventKind), !0 } return !1 } function createRecursiveDirectoryWatcher(host) { function createDirectoryWatcher(dirName, callback) { var watcher = host.watchDirectory(dirName, function (fileName) { callback(fileName), updateChildWatches(result, callback) }), result = { close: function () { watcher.close(), result.childWatches.forEach(ts.closeFileWatcher), result = void 0 }, dirName: dirName, childWatches: ts.emptyArray }; return updateChildWatches(result, callback), result } function updateChildWatches(watcher, callback) { watcher && (watcher.childWatches = watchChildDirectories(watcher.dirName, watcher.childWatches, callback)) } function watchChildDirectories(parentDir, existingChildWatches, callback) { function createAndAddChildDirectoryWatcher(childName) { var result = createDirectoryWatcher(childName, callback); addChildDirectoryWatcher(result) } function addChildDirectoryWatcher(childWatcher) { (newChildWatches || (newChildWatches = [])).push(childWatcher) } var newChildWatches; return ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) { var childFullName = ts.getNormalizedAbsolutePath(child, parentDir); return 0 === host.filePathComparer(childFullName, host.realpath(childFullName)) ? childFullName : void 0 }) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName) }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher), newChildWatches || ts.emptyArray } return createDirectoryWatcher } function getNodeMajorVersion() { if ("undefined" != typeof process) { var version = process.version; if (version) { var dot = version.indexOf("."); if (dot !== -1) return parseInt(version.substring(1, dot)) } } } ts.setStackTraceLimit = setStackTraceLimit; var FileWatcherEventKind; !function (FileWatcherEventKind) { FileWatcherEventKind[FileWatcherEventKind.Created = 0] = "Created", FileWatcherEventKind[FileWatcherEventKind.Changed = 1] = "Changed", FileWatcherEventKind[FileWatcherEventKind.Deleted = 2] = "Deleted" }(FileWatcherEventKind = ts.FileWatcherEventKind || (ts.FileWatcherEventKind = {})); var PollingInterval; !function (PollingInterval) { PollingInterval[PollingInterval.High = 2e3] = "High", PollingInterval[PollingInterval.Medium = 500] = "Medium", PollingInterval[PollingInterval.Low = 250] = "Low" }(PollingInterval = ts.PollingInterval || (ts.PollingInterval = {})); var pollingIntervalsForPriority = getPriorityValues(250); ts.watchFileUsingPriorityPollingInterval = watchFileUsingPriorityPollingInterval, ts.missingFileModifiedTime = new Date(0); var defaultChunkLevels = { Low: 32, Medium: 64, High: 256 }, pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels), ts.setCustomPollingValues = setCustomPollingValues, ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile, ts.onWatchedFileStat = onWatchedFileStat, ts.createRecursiveDirectoryWatcher = createRecursiveDirectoryWatcher, ts.getNodeMajorVersion = getNodeMajorVersion, ts.sys = function () { function getNodeSystem() { function isFileSystemCaseSensitive() { return "win32" !== platform && "win64" !== platform && !fileExists(swapCase(__filename)) } function swapCase(s) { return s.replace(/\w/g, function (ch) { var up = ch.toUpperCase(); return ch === up ? ch.toLowerCase() : up }) } function getWatchFile() { switch (tscWatchFile) { case "PriorityPollingInterval": return fsWatchFile; case "DynamicPriorityPolling": return createDynamicPriorityPollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout }); case "UseFsEvents": return watchFileUsingFsWatch; case "UseFsEventsWithFallbackDynamicPolling": return dynamicPollingWatchFile = createDynamicPriorityPollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout }), createWatchFileUsingDynamicWatchFile(dynamicPollingWatchFile); case "UseFsEventsOnParentDirectory": return createNonPollingWatchFile() }return useNonPollingWatchers ? createNonPollingWatchFile() : function (fileName, callback) { return fsWatchFile(fileName, callback) } } function getWatchDirectory() { var fsSupportsRecursive = isNode4OrLater && ("win32" === process.platform || "darwin" === process.platform); if (fsSupportsRecursive) return watchDirectoryUsingFsWatch; var watchDirectory = "RecursiveDirectoryUsingFsWatchFile" === tscWatchDirectory ? createWatchDirectoryUsing(fsWatchFile) : "RecursiveDirectoryUsingDynamicPriorityPolling" === tscWatchDirectory ? createWatchDirectoryUsing(dynamicPollingWatchFile || createDynamicPriorityPollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout })) : watchDirectoryUsingFsWatch, watchDirectoryRecursively = createRecursiveDirectoryWatcher({ filePathComparer: ts.getStringComparer(!useCaseSensitiveFileNames), directoryExists: directoryExists, getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories }, watchDirectory: watchDirectory, realpath: realpath }); return function (directoryName, callback, recursive) { return recursive ? watchDirectoryRecursively(directoryName, callback) : void watchDirectory(directoryName, callback) } } function createNonPollingWatchFile() { function nonPollingWatchFile(fileName, callback) { var filePath = toCanonicalName(fileName); fileWatcherCallbacks.add(filePath, callback); var dirPath = ts.getDirectoryPath(filePath) || ".", watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(ts.getDirectoryPath(fileName) || ".", dirPath); return watcher.referenceCount++ , { close: function () { 1 === watcher.referenceCount ? (watcher.close(), dirWatchers.delete(dirPath)) : watcher.referenceCount-- , fileWatcherCallbacks.remove(filePath, callback) } } } function createDirectoryWatcher(dirName, dirPath) { var watcher = fsWatchDirectory(dirName, function (_eventName, relativeFileName) { var fileName = ts.isString(relativeFileName) ? ts.getNormalizedAbsolutePath(relativeFileName, dirName) : void 0, callbacks = fileWatcherCallbacks.get(toCanonicalName(fileName)); if (callbacks) for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { var fileCallback = callbacks_1[_i]; fileCallback(fileName, FileWatcherEventKind.Changed) } }); return watcher.referenceCount = 0, dirWatchers.set(dirPath, watcher), watcher } var fileWatcherCallbacks = ts.createMultiMap(), dirWatchers = ts.createMap(), toCanonicalName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); return nonPollingWatchFile } function fsWatchFile(fileName, callback, pollingInterval) { function fileChanged(curr, prev) { var isPreviouslyDeleted = 0 === +prev.mtime || eventKind === FileWatcherEventKind.Deleted; if (0 === +curr.mtime) { if (isPreviouslyDeleted) return; eventKind = FileWatcherEventKind.Deleted } else if (isPreviouslyDeleted) eventKind = FileWatcherEventKind.Created; else { if (+curr.mtime === +prev.mtime) return; eventKind = FileWatcherEventKind.Changed } callback(fileName, eventKind) } _fs.watchFile(fileName, { persistent: !0, interval: pollingInterval || 250 }, fileChanged); var eventKind; return { close: function () { return _fs.unwatchFile(fileName, fileChanged) } } } function createFileWatcherCallback(callback) { return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "") } } function createFsWatchCallbackForFileWatcherCallback(fileName, callback) { return function (eventName) { "rename" === eventName ? callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted) : callback(fileName, FileWatcherEventKind.Changed) } } function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback) { return function (eventName, relativeFileName) { "rename" === eventName && callback(relativeFileName ? ts.normalizePath(ts.combinePaths(directoryName, relativeFileName)) : directoryName) } } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) { function invokeCallbackAndUpdateWatcher(createWatcher) { callback("rename", ""), watcher && (watcher.close(), watcher = createWatcher()) } function watchPresentFileSystemEntry() { void 0 === options && (options = !isNode4OrLater || "win32" !== process.platform && "darwin" !== process.platform ? { persistent: !0 } : { persistent: !0, recursive: !!recursive }); try { var presentWatcher = _fs.watch(fileOrDirectory, options, callback); return presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) }), presentWatcher } catch (e) { return watchPresentFileSystemEntryWithFsWatchFile() } } function watchPresentFileSystemEntryWithFsWatchFile() { return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval) } function watchMissingFileSystemEntry() { return fallbackPollingWatchFile(fileOrDirectory, function (_fileName, eventKind) { eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind) && invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry) }, pollingInterval) } var options, watcher = fileSystemEntryExists(fileOrDirectory, entryKind) ? watchPresentFileSystemEntry() : watchMissingFileSystemEntry(); return { close: function () { watcher.close(), watcher = void 0 } } } function watchFileUsingFsWatch(fileName, callback, pollingInterval) { return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback), !1, fsWatchFile, pollingInterval) } function createWatchFileUsingDynamicWatchFile(watchFile) { return function (fileName, callback, pollingInterval) { return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback), !1, watchFile, pollingInterval) } } function fsWatchDirectory(directoryName, callback, recursive) { return fsWatch(directoryName, 1, callback, !!recursive, fsWatchFile) } function watchDirectoryUsingFsWatch(directoryName, callback, recursive) { return fsWatchDirectory(directoryName, createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback), recursive) } function createWatchDirectoryUsing(fsWatchFile) { return function (directoryName, callback) { return fsWatchFile(directoryName, function () { return callback(directoryName) }, PollingInterval.Medium) } } function readFile(fileName, _encoding) { if (fileExists(fileName)) { var buffer = _fs.readFileSync(fileName), len = buffer.length; if (len >= 2 && 254 === buffer[0] && 255 === buffer[1]) { len &= -2; for (var i = 0; i < len; i += 2) { var temp = buffer[i]; buffer[i] = buffer[i + 1], buffer[i + 1] = temp } return buffer.toString("utf16le", 2) } return len >= 2 && 255 === buffer[0] && 254 === buffer[1] ? buffer.toString("utf16le", 2) : len >= 3 && 239 === buffer[0] && 187 === buffer[1] && 191 === buffer[2] ? buffer.toString("utf8", 3) : buffer.toString("utf8") } } function writeFile(fileName, data, writeByteOrderMark) { writeByteOrderMark && (data = byteOrderMarkIndicator + data); var fd; try { fd = _fs.openSync(fileName, "w"), _fs.writeSync(fd, data, void 0, "utf8") } finally { void 0 !== fd && _fs.closeSync(fd) } } function getAccessibleFileSystemEntries(path) { try { for (var entries = _fs.readdirSync(path || ".").sort(), files = [], directories = [], _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { var entry = entries_1[_i]; if ("." !== entry && ".." !== entry) { var name = ts.combinePaths(path, entry), stat = void 0; try { stat = _fs.statSync(name) } catch (e) { continue } stat.isFile() ? files.push(entry) : stat.isDirectory() && directories.push(entry) } } return { files: files, directories: directories } } catch (e) { return ts.emptyFileSystemEntries } } function readDirectory(path, extensions, excludes, includes, depth) { return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries) } function fileSystemEntryExists(path, entryKind) { try { var stat = _fs.statSync(path); switch (entryKind) { case 0: return stat.isFile(); case 1: return stat.isDirectory() } } catch (e) { return !1 } } function fileExists(path) { return fileSystemEntryExists(path, 0) } function directoryExists(path) { return fileSystemEntryExists(path, 1) } function getDirectories(path) { return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1) }) } function realpath(path) { try { return _fs.realpathSync(path) } catch (_a) { return path } } function getModifiedTime(path) { try { return _fs.statSync(path).mtime; } catch (e) { return } } function generateDjb2Hash(data) { var chars = data.split("").map(function (str) { return str.charCodeAt(0) }); return "" + chars.reduce(function (prev, curr) { return (prev << 5) + prev + curr }, 5381) } function createMD5HashUsingNativeCrypto(data) { var hash = _crypto.createHash("md5"); return hash.update(data), hash.digest("hex") } function createSHA256Hash(data) { var hash = _crypto.createHash("sha256"); return hash.update(data), hash.digest("hex") } var _crypto, _fs = __webpack_require__(114), _path = __webpack_require__(115), _os = __webpack_require__(116); try { _crypto = __webpack_require__(117) } catch (_a) { _crypto = void 0 } var FileSystemEntryKind, Buffer = __webpack_require__(118).Buffer, nodeVersion = getNodeMajorVersion(), isNode4OrLater = nodeVersion >= 4, platform = _os.platform(), useCaseSensitiveFileNames = isFileSystemCaseSensitive(); !function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind.File = 0] = "File", FileSystemEntryKind[FileSystemEntryKind.Directory = 1] = "Directory" }(FileSystemEntryKind || (FileSystemEntryKind = {})); var dynamicPollingWatchFile, useNonPollingWatchers = process.env.TSC_NONPOLLING_WATCHER, tscWatchFile = process.env.TSC_WATCHFILE, tscWatchDirectory = process.env.TSC_WATCHDIRECTORY, nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { process.stdout.write(s) }, writeOutputIsTTY: function () { return process.stdout.isTTY }, readFile: readFile, writeFile: writeFile, watchFile: getWatchFile(), watchDirectory: getWatchDirectory(), resolvePath: function (path) { return _path.resolve(path) }, fileExists: fileExists, directoryExists: directoryExists, createDirectory: function (directoryName) { nodeSystem.directoryExists(directoryName) || _fs.mkdirSync(directoryName) }, getExecutingFilePath: function () { return __filename }, getCurrentDirectory: function () { return process.cwd() }, getDirectories: getDirectories, getEnvironmentVariable: function (name) { return process.env[name] || "" }, readDirectory: readDirectory, getModifiedTime: getModifiedTime, createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash, createSHA256Hash: _crypto ? createSHA256Hash : void 0, getMemoryUsage: function () { return global.gc && global.gc(), process.memoryUsage().heapUsed }, getFileSize: function (path) { try { var stat = _fs.statSync(path); if (stat.isFile()) return stat.size } catch (_a) { } return 0 }, exit: function (exitCode) { process.exit(exitCode) }, realpath: realpath, debugMode: ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg) }), tryEnableSourceMapsForHost: function () { try { __webpack_require__(176).install() } catch (_a) { } }, setTimeout: setTimeout, clearTimeout: clearTimeout, clearScreen: function () { process.stdout.write("c") }, setBlocking: function () { process.stdout && process.stdout._handle && process.stdout._handle.setBlocking && process.stdout._handle.setBlocking(!0) }, base64decode: Buffer.from ? function (input) { return Buffer.from(input, "base64").toString("utf8") } : function (input) { return new Buffer(input, "base64").toString("utf8") }, base64encode: Buffer.from ? function (input) { return Buffer.from(input).toString("base64") } : function (input) { return new Buffer(input).toString("base64") } }; return nodeSystem } function getChakraSystem() { var realpath = ChakraHost.realpath && function (path) { return ChakraHost.realpath(path) }; return { newLine: ChakraHost.newLine || "\r\n", args: ChakraHost.args, useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames, write: ChakraHost.echo, readFile: function (path, _encoding) { return ChakraHost.readFile(path) }, writeFile: function (path, data, writeByteOrderMark) { writeByteOrderMark && (data = byteOrderMarkIndicator + data), ChakraHost.writeFile(path, data) }, resolvePath: ChakraHost.resolvePath, fileExists: ChakraHost.fileExists, directoryExists: ChakraHost.directoryExists, createDirectory: ChakraHost.createDirectory, getExecutingFilePath: function () { return ChakraHost.executingFile }, getCurrentDirectory: function () { return ChakraHost.currentDirectory }, getDirectories: ChakraHost.getDirectories, getEnvironmentVariable: ChakraHost.getEnvironmentVariable || function () { return "" }, readDirectory: function (path, extensions, excludes, includes, _depth) { var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory); return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern) }, exit: ChakraHost.quit, realpath: realpath } } function recursiveCreateDirectory(directoryPath, sys) { var basePath = ts.getDirectoryPath(directoryPath), shouldCreateParent = "" !== basePath && directoryPath !== basePath && !sys.directoryExists(basePath); shouldCreateParent && recursiveCreateDirectory(basePath, sys), !shouldCreateParent && sys.directoryExists(directoryPath) || sys.createDirectory(directoryPath) } var sys, byteOrderMarkIndicator = "\ufeff"; if ("undefined" != typeof ChakraHost ? sys = getChakraSystem() : "undefined" != typeof process && process.nextTick && !process.browser && (sys = getNodeSystem()), sys) { var originalWriteFile_1 = sys.writeFile; sys.writeFile = function (path, data, writeBom) { var directoryPath = ts.getDirectoryPath(ts.normalizeSlashes(path)); directoryPath && !sys.directoryExists(directoryPath) && recursiveCreateDirectory(directoryPath, sys), originalWriteFile_1.call(sys, path, data, writeBom) } } return sys }(), ts.sys && ts.sys.getEnvironmentVariable && (setCustomPollingValues(ts.sys), ts.Debug.currentAssertionLevel = /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) ? 1 : 0), ts.sys && ts.sys.debugMode && (ts.Debug.isDebugging = !0) }(ts || (ts = {})); var ts; !function (ts) { function diag(code, category, key, message, reportsUnnecessary) { return { code: code, category: category, key: key, message: message, reportsUnnecessary: reportsUnnecessary } } ts.Diagnostics = { Unterminated_string_literal: diag(1002, ts.DiagnosticCategory.Error, "Unterminated_string_literal_1002", "Unterminated string literal."), Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), An_index_signature_cannot_have_a_rest_parameter: diag(1017, ts.DiagnosticCategory.Error, "An_index_signature_cannot_have_a_rest_parameter_1017", "An index signature cannot have a rest parameter."), An_index_signature_parameter_cannot_have_an_accessibility_modifier: diag(1018, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018", "An index signature parameter cannot have an accessibility modifier."), An_index_signature_parameter_cannot_have_a_question_mark: diag(1019, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_a_question_mark_1019", "An index signature parameter cannot have a question mark."), An_index_signature_parameter_cannot_have_an_initializer: diag(1020, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_initializer_1020", "An index signature parameter cannot have an initializer."), An_index_signature_must_have_a_type_annotation: diag(1021, ts.DiagnosticCategory.Error, "An_index_signature_must_have_a_type_annotation_1021", "An index signature must have a type annotation."), An_index_signature_parameter_must_have_a_type_annotation: diag(1022, ts.DiagnosticCategory.Error, "An_index_signature_parameter_must_have_a_type_annotation_1022", "An index signature parameter must have a type annotation."), An_index_signature_parameter_type_must_be_string_or_number: diag(1023, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_or_number_1023", "An index signature parameter type must be 'string' or 'number'."), readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: diag(1024, ts.DiagnosticCategory.Error, "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", "'readonly' modifier can only appear on a property declaration or index signature."), Accessibility_modifier_already_seen: diag(1028, ts.DiagnosticCategory.Error, "Accessibility_modifier_already_seen_1028", "Accessibility modifier already seen."), _0_modifier_must_precede_1_modifier: diag(1029, ts.DiagnosticCategory.Error, "_0_modifier_must_precede_1_modifier_1029", "'{0}' modifier must precede '{1}' modifier."), _0_modifier_already_seen: diag(1030, ts.DiagnosticCategory.Error, "_0_modifier_already_seen_1030", "'{0}' modifier already seen."), _0_modifier_cannot_appear_on_a_class_element: diag(1031, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_class_element_1031", "'{0}' modifier cannot appear on a class element."), super_must_be_followed_by_an_argument_list_or_member_access: diag(1034, ts.DiagnosticCategory.Error, "super_must_be_followed_by_an_argument_list_or_member_access_1034", "'super' must be followed by an argument list or member access."), Only_ambient_modules_can_use_quoted_names: diag(1035, ts.DiagnosticCategory.Error, "Only_ambient_modules_can_use_quoted_names_1035", "Only ambient modules can use quoted names."), Statements_are_not_allowed_in_ambient_contexts: diag(1036, ts.DiagnosticCategory.Error, "Statements_are_not_allowed_in_ambient_contexts_1036", "Statements are not allowed in ambient contexts."), A_declare_modifier_cannot_be_used_in_an_already_ambient_context: diag(1038, ts.DiagnosticCategory.Error, "A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038", "A 'declare' modifier cannot be used in an already ambient context."), Initializers_are_not_allowed_in_ambient_contexts: diag(1039, ts.DiagnosticCategory.Error, "Initializers_are_not_allowed_in_ambient_contexts_1039", "Initializers are not allowed in ambient contexts."), _0_modifier_cannot_be_used_in_an_ambient_context: diag(1040, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_in_an_ambient_context_1040", "'{0}' modifier cannot be used in an ambient context."), _0_modifier_cannot_be_used_with_a_class_declaration: diag(1041, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_a_class_declaration_1041", "'{0}' modifier cannot be used with a class declaration."), _0_modifier_cannot_be_used_here: diag(1042, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_here_1042", "'{0}' modifier cannot be used here."), _0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."), _0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."), A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."), A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."), A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."), A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."), A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."), A_set_accessor_cannot_have_an_optional_parameter: diag(1051, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_an_optional_parameter_1051", "A 'set' accessor cannot have an optional parameter."), A_set_accessor_parameter_cannot_have_an_initializer: diag(1052, ts.DiagnosticCategory.Error, "A_set_accessor_parameter_cannot_have_an_initializer_1052", "A 'set' accessor parameter cannot have an initializer."), A_set_accessor_cannot_have_rest_parameter: diag(1053, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_rest_parameter_1053", "A 'set' accessor cannot have rest parameter."), A_get_accessor_cannot_have_parameters: diag(1054, ts.DiagnosticCategory.Error, "A_get_accessor_cannot_have_parameters_1054", "A 'get' accessor cannot have parameters."), Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: diag(1055, ts.DiagnosticCategory.Error, "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value."), Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: diag(1056, ts.DiagnosticCategory.Error, "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", "Accessors are only available when targeting ECMAScript 5 and higher."), An_async_function_or_method_must_have_a_valid_awaitable_return_type: diag(1057, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", "An async function or method must have a valid awaitable return type."), The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1058, ts.DiagnosticCategory.Error, "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", "The return type of an async function must either be a valid promise or must not contain a callable 'then' member."), A_promise_must_have_a_then_method: diag(1059, ts.DiagnosticCategory.Error, "A_promise_must_have_a_then_method_1059", "A promise must have a 'then' method."), The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: diag(1060, ts.DiagnosticCategory.Error, "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", "The first parameter of the 'then' method of a promise must be a callback."), Enum_member_must_have_initializer: diag(1061, ts.DiagnosticCategory.Error, "Enum_member_must_have_initializer_1061", "Enum member must have initializer."), Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, ts.DiagnosticCategory.Error, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."), An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."), The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1064, ts.DiagnosticCategory.Error, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", "The return type of an async function or method must be the global Promise type."), In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, ts.DiagnosticCategory.Error, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."), Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, ts.DiagnosticCategory.Error, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."), _0_modifier_cannot_appear_on_a_type_member: diag(1070, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_member_1070", "'{0}' modifier cannot appear on a type member."), _0_modifier_cannot_appear_on_an_index_signature: diag(1071, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."), A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."), Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."), Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."), An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."), _0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."), _0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."), Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."), Type_parameters_cannot_appear_on_a_constructor_declaration: diag(1092, ts.DiagnosticCategory.Error, "Type_parameters_cannot_appear_on_a_constructor_declaration_1092", "Type parameters cannot appear on a constructor declaration."), Type_annotation_cannot_appear_on_a_constructor_declaration: diag(1093, ts.DiagnosticCategory.Error, "Type_annotation_cannot_appear_on_a_constructor_declaration_1093", "Type annotation cannot appear on a constructor declaration."), An_accessor_cannot_have_type_parameters: diag(1094, ts.DiagnosticCategory.Error, "An_accessor_cannot_have_type_parameters_1094", "An accessor cannot have type parameters."), A_set_accessor_cannot_have_a_return_type_annotation: diag(1095, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_a_return_type_annotation_1095", "A 'set' accessor cannot have a return type annotation."), An_index_signature_must_have_exactly_one_parameter: diag(1096, ts.DiagnosticCategory.Error, "An_index_signature_must_have_exactly_one_parameter_1096", "An index signature must have exactly one parameter."), _0_list_cannot_be_empty: diag(1097, ts.DiagnosticCategory.Error, "_0_list_cannot_be_empty_1097", "'{0}' list cannot be empty."), Type_parameter_list_cannot_be_empty: diag(1098, ts.DiagnosticCategory.Error, "Type_parameter_list_cannot_be_empty_1098", "Type parameter list cannot be empty."), Type_argument_list_cannot_be_empty: diag(1099, ts.DiagnosticCategory.Error, "Type_argument_list_cannot_be_empty_1099", "Type argument list cannot be empty."), Invalid_use_of_0_in_strict_mode: diag(1100, ts.DiagnosticCategory.Error, "Invalid_use_of_0_in_strict_mode_1100", "Invalid use of '{0}' in strict mode."), with_statements_are_not_allowed_in_strict_mode: diag(1101, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_strict_mode_1101", "'with' statements are not allowed in strict mode."), delete_cannot_be_called_on_an_identifier_in_strict_mode: diag(1102, ts.DiagnosticCategory.Error, "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", "'delete' cannot be called on an identifier in strict mode."), A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: diag(1103, ts.DiagnosticCategory.Error, "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", "A 'for-await-of' statement is only allowed within an async function or async generator."), A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: diag(1104, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", "A 'continue' statement can only be used within an enclosing iteration statement."), A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: diag(1105, ts.DiagnosticCategory.Error, "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", "A 'break' statement can only be used within an enclosing iteration or switch statement."), Jump_target_cannot_cross_function_boundary: diag(1107, ts.DiagnosticCategory.Error, "Jump_target_cannot_cross_function_boundary_1107", "Jump target cannot cross function boundary."), A_return_statement_can_only_be_used_within_a_function_body: diag(1108, ts.DiagnosticCategory.Error, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."), Expression_expected: diag(1109, ts.DiagnosticCategory.Error, "Expression_expected_1109", "Expression expected."), Type_expected: diag(1110, ts.DiagnosticCategory.Error, "Type_expected_1110", "Type expected."), A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, ts.DiagnosticCategory.Error, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."), Duplicate_label_0: diag(1114, ts.DiagnosticCategory.Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."), A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."), A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: diag(1116, ts.DiagnosticCategory.Error, "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", "A 'break' statement can only jump to a label of an enclosing statement."), An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: diag(1117, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", "An object literal cannot have multiple properties with the same name in strict mode."), An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."), An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."), An_export_assignment_cannot_have_modifiers: diag(1120, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."), Octal_literals_are_not_allowed_in_strict_mode: diag(1121, ts.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."), A_tuple_type_element_list_cannot_be_empty: diag(1122, ts.DiagnosticCategory.Error, "A_tuple_type_element_list_cannot_be_empty_1122", "A tuple type element list cannot be empty."), Variable_declaration_list_cannot_be_empty: diag(1123, ts.DiagnosticCategory.Error, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."), Digit_expected: diag(1124, ts.DiagnosticCategory.Error, "Digit_expected_1124", "Digit expected."), Hexadecimal_digit_expected: diag(1125, ts.DiagnosticCategory.Error, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."), Unexpected_end_of_text: diag(1126, ts.DiagnosticCategory.Error, "Unexpected_end_of_text_1126", "Unexpected end of text."), Invalid_character: diag(1127, ts.DiagnosticCategory.Error, "Invalid_character_1127", "Invalid character."), Declaration_or_statement_expected: diag(1128, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_1128", "Declaration or statement expected."), Statement_expected: diag(1129, ts.DiagnosticCategory.Error, "Statement_expected_1129", "Statement expected."), case_or_default_expected: diag(1130, ts.DiagnosticCategory.Error, "case_or_default_expected_1130", "'case' or 'default' expected."), Property_or_signature_expected: diag(1131, ts.DiagnosticCategory.Error, "Property_or_signature_expected_1131", "Property or signature expected."), Enum_member_expected: diag(1132, ts.DiagnosticCategory.Error, "Enum_member_expected_1132", "Enum member expected."), Variable_declaration_expected: diag(1134, ts.DiagnosticCategory.Error, "Variable_declaration_expected_1134", "Variable declaration expected."), Argument_expression_expected: diag(1135, ts.DiagnosticCategory.Error, "Argument_expression_expected_1135", "Argument expression expected."), Property_assignment_expected: diag(1136, ts.DiagnosticCategory.Error, "Property_assignment_expected_1136", "Property assignment expected."), Expression_or_comma_expected: diag(1137, ts.DiagnosticCategory.Error, "Expression_or_comma_expected_1137", "Expression or comma expected."), Parameter_declaration_expected: diag(1138, ts.DiagnosticCategory.Error, "Parameter_declaration_expected_1138", "Parameter declaration expected."), Type_parameter_declaration_expected: diag(1139, ts.DiagnosticCategory.Error, "Type_parameter_declaration_expected_1139", "Type parameter declaration expected."), Type_argument_expected: diag(1140, ts.DiagnosticCategory.Error, "Type_argument_expected_1140", "Type argument expected."), String_literal_expected: diag(1141, ts.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."), Line_break_not_permitted_here: diag(1142, ts.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."), or_expected: diag(1144, ts.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."), Declaration_expected: diag(1146, ts.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."), Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, ts.DiagnosticCategory.Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."), Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, ts.DiagnosticCategory.Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."), File_name_0_differs_from_already_included_file_name_1_only_in_casing: diag(1149, ts.DiagnosticCategory.Error, "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", "File name '{0}' differs from already included file name '{1}' only in casing."), new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: diag(1150, ts.DiagnosticCategory.Error, "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", "'new T[]' cannot be used to create an array. Use 'new Array()' instead."), const_declarations_must_be_initialized: diag(1155, ts.DiagnosticCategory.Error, "const_declarations_must_be_initialized_1155", "'const' declarations must be initialized."), const_declarations_can_only_be_declared_inside_a_block: diag(1156, ts.DiagnosticCategory.Error, "const_declarations_can_only_be_declared_inside_a_block_1156", "'const' declarations can only be declared inside a block."), let_declarations_can_only_be_declared_inside_a_block: diag(1157, ts.DiagnosticCategory.Error, "let_declarations_can_only_be_declared_inside_a_block_1157", "'let' declarations can only be declared inside a block."), Unterminated_template_literal: diag(1160, ts.DiagnosticCategory.Error, "Unterminated_template_literal_1160", "Unterminated template literal."), Unterminated_regular_expression_literal: diag(1161, ts.DiagnosticCategory.Error, "Unterminated_regular_expression_literal_1161", "Unterminated regular expression literal."), An_object_member_cannot_be_declared_optional: diag(1162, ts.DiagnosticCategory.Error, "An_object_member_cannot_be_declared_optional_1162", "An object member cannot be declared optional."), A_yield_expression_is_only_allowed_in_a_generator_body: diag(1163, ts.DiagnosticCategory.Error, "A_yield_expression_is_only_allowed_in_a_generator_body_1163", "A 'yield' expression is only allowed in a generator body."), Computed_property_names_are_not_allowed_in_enums: diag(1164, ts.DiagnosticCategory.Error, "Computed_property_names_are_not_allowed_in_enums_1164", "Computed property names are not allowed in enums."), A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1165, ts.DiagnosticCategory.Error, "A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165", "A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type."), A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1166, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_1166", "A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type."), A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1168, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_ty_1168", "A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type."), A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1169, ts.DiagnosticCategory.Error, "A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169", "A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type."), A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1170, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type__1170", "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type."), A_comma_expression_is_not_allowed_in_a_computed_property_name: diag(1171, ts.DiagnosticCategory.Error, "A_comma_expression_is_not_allowed_in_a_computed_property_name_1171", "A comma expression is not allowed in a computed property name."), extends_clause_already_seen: diag(1172, ts.DiagnosticCategory.Error, "extends_clause_already_seen_1172", "'extends' clause already seen."), extends_clause_must_precede_implements_clause: diag(1173, ts.DiagnosticCategory.Error, "extends_clause_must_precede_implements_clause_1173", "'extends' clause must precede 'implements' clause."), Classes_can_only_extend_a_single_class: diag(1174, ts.DiagnosticCategory.Error, "Classes_can_only_extend_a_single_class_1174", "Classes can only extend a single class."), implements_clause_already_seen: diag(1175, ts.DiagnosticCategory.Error, "implements_clause_already_seen_1175", "'implements' clause already seen."), Interface_declaration_cannot_have_implements_clause: diag(1176, ts.DiagnosticCategory.Error, "Interface_declaration_cannot_have_implements_clause_1176", "Interface declaration cannot have 'implements' clause."), Binary_digit_expected: diag(1177, ts.DiagnosticCategory.Error, "Binary_digit_expected_1177", "Binary digit expected."), Octal_digit_expected: diag(1178, ts.DiagnosticCategory.Error, "Octal_digit_expected_1178", "Octal digit expected."), Unexpected_token_expected: diag(1179, ts.DiagnosticCategory.Error, "Unexpected_token_expected_1179", "Unexpected token. '{' expected."), Property_destructuring_pattern_expected: diag(1180, ts.DiagnosticCategory.Error, "Property_destructuring_pattern_expected_1180", "Property destructuring pattern expected."), Array_element_destructuring_pattern_expected: diag(1181, ts.DiagnosticCategory.Error, "Array_element_destructuring_pattern_expected_1181", "Array element destructuring pattern expected."), A_destructuring_declaration_must_have_an_initializer: diag(1182, ts.DiagnosticCategory.Error, "A_destructuring_declaration_must_have_an_initializer_1182", "A destructuring declaration must have an initializer."), An_implementation_cannot_be_declared_in_ambient_contexts: diag(1183, ts.DiagnosticCategory.Error, "An_implementation_cannot_be_declared_in_ambient_contexts_1183", "An implementation cannot be declared in ambient contexts."), Modifiers_cannot_appear_here: diag(1184, ts.DiagnosticCategory.Error, "Modifiers_cannot_appear_here_1184", "Modifiers cannot appear here."), Merge_conflict_marker_encountered: diag(1185, ts.DiagnosticCategory.Error, "Merge_conflict_marker_encountered_1185", "Merge conflict marker encountered."), A_rest_element_cannot_have_an_initializer: diag(1186, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_an_initializer_1186", "A rest element cannot have an initializer."), A_parameter_property_may_not_be_declared_using_a_binding_pattern: diag(1187, ts.DiagnosticCategory.Error, "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187", "A parameter property may not be declared using a binding pattern."), Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: diag(1188, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188", "Only a single variable declaration is allowed in a 'for...of' statement."), The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: diag(1189, ts.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189", "The variable declaration of a 'for...in' statement cannot have an initializer."), The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: diag(1190, ts.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190", "The variable declaration of a 'for...of' statement cannot have an initializer."), An_import_declaration_cannot_have_modifiers: diag(1191, ts.DiagnosticCategory.Error, "An_import_declaration_cannot_have_modifiers_1191", "An import declaration cannot have modifiers."), Module_0_has_no_default_export: diag(1192, ts.DiagnosticCategory.Error, "Module_0_has_no_default_export_1192", "Module '{0}' has no default export."), An_export_declaration_cannot_have_modifiers: diag(1193, ts.DiagnosticCategory.Error, "An_export_declaration_cannot_have_modifiers_1193", "An export declaration cannot have modifiers."), Export_declarations_are_not_permitted_in_a_namespace: diag(1194, ts.DiagnosticCategory.Error, "Export_declarations_are_not_permitted_in_a_namespace_1194", "Export declarations are not permitted in a namespace."), Catch_clause_variable_cannot_have_a_type_annotation: diag(1196, ts.DiagnosticCategory.Error, "Catch_clause_variable_cannot_have_a_type_annotation_1196", "Catch clause variable cannot have a type annotation."), Catch_clause_variable_cannot_have_an_initializer: diag(1197, ts.DiagnosticCategory.Error, "Catch_clause_variable_cannot_have_an_initializer_1197", "Catch clause variable cannot have an initializer."), An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: diag(1198, ts.DiagnosticCategory.Error, "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."), Unterminated_Unicode_escape_sequence: diag(1199, ts.DiagnosticCategory.Error, "Unterminated_Unicode_escape_sequence_1199", "Unterminated Unicode escape sequence."), Line_terminator_not_permitted_before_arrow: diag(1200, ts.DiagnosticCategory.Error, "Line_terminator_not_permitted_before_arrow_1200", "Line terminator not permitted before arrow."), Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(1202, ts.DiagnosticCategory.Error, "Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202", "Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead."), Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead: diag(1203, ts.DiagnosticCategory.Error, "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203", "Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead."), Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."), Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."), Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."), Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."), Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: diag(1209, ts.DiagnosticCategory.Error, "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", "Ambient const enums are not allowed when the '--isolatedModules' flag is provided."), Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."), A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."), Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."), Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: diag(1213, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."), Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: diag(1214, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."), Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."), Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."), Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."), Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."), Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."), Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."), An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."), _0_tag_already_specified: diag(1223, ts.DiagnosticCategory.Error, "_0_tag_already_specified_1223", "'{0}' tag already specified."), Signature_0_must_be_a_type_predicate: diag(1224, ts.DiagnosticCategory.Error, "Signature_0_must_be_a_type_predicate_1224", "Signature '{0}' must be a type predicate."), Cannot_find_parameter_0: diag(1225, ts.DiagnosticCategory.Error, "Cannot_find_parameter_0_1225", "Cannot find parameter '{0}'."), Type_predicate_0_is_not_assignable_to_1: diag(1226, ts.DiagnosticCategory.Error, "Type_predicate_0_is_not_assignable_to_1_1226", "Type predicate '{0}' is not assignable to '{1}'."), Parameter_0_is_not_in_the_same_position_as_parameter_1: diag(1227, ts.DiagnosticCategory.Error, "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227", "Parameter '{0}' is not in the same position as parameter '{1}'."), A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: diag(1228, ts.DiagnosticCategory.Error, "A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228", "A type predicate is only allowed in return type position for functions and methods."), A_type_predicate_cannot_reference_a_rest_parameter: diag(1229, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."), A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: diag(1230, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."), An_export_assignment_can_only_be_used_in_a_module: diag(1231, ts.DiagnosticCategory.Error, "An_export_assignment_can_only_be_used_in_a_module_1231", "An export assignment can only be used in a module."), An_import_declaration_can_only_be_used_in_a_namespace_or_module: diag(1232, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232", "An import declaration can only be used in a namespace or module."), An_export_declaration_can_only_be_used_in_a_module: diag(1233, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_in_a_module_1233", "An export declaration can only be used in a module."), An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: diag(1234, ts.DiagnosticCategory.Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."), A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: diag(1235, ts.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235", "A namespace declaration is only allowed in a namespace or module."), The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: diag(1236, ts.DiagnosticCategory.Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."), The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: diag(1237, ts.DiagnosticCategory.Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."), Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: diag(1238, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."), Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: diag(1239, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", "Unable to resolve signature of parameter decorator when called as an expression."), Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: diag(1240, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", "Unable to resolve signature of property decorator when called as an expression."), Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: diag(1241, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", "Unable to resolve signature of method decorator when called as an expression."), abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: diag(1242, ts.DiagnosticCategory.Error, "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", "'abstract' modifier can only appear on a class, method, or property declaration."), _0_modifier_cannot_be_used_with_1_modifier: diag(1243, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_1_modifier_1243", "'{0}' modifier cannot be used with '{1}' modifier."), Abstract_methods_can_only_appear_within_an_abstract_class: diag(1244, ts.DiagnosticCategory.Error, "Abstract_methods_can_only_appear_within_an_abstract_class_1244", "Abstract methods can only appear within an abstract class."), Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: diag(1245, ts.DiagnosticCategory.Error, "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", "Method '{0}' cannot have an implementation because it is marked abstract."), An_interface_property_cannot_have_an_initializer: diag(1246, ts.DiagnosticCategory.Error, "An_interface_property_cannot_have_an_initializer_1246", "An interface property cannot have an initializer."), A_type_literal_property_cannot_have_an_initializer: diag(1247, ts.DiagnosticCategory.Error, "A_type_literal_property_cannot_have_an_initializer_1247", "A type literal property cannot have an initializer."), A_class_member_cannot_have_the_0_keyword: diag(1248, ts.DiagnosticCategory.Error, "A_class_member_cannot_have_the_0_keyword_1248", "A class member cannot have the '{0}' keyword."), A_decorator_can_only_decorate_a_method_implementation_not_an_overload: diag(1249, ts.DiagnosticCategory.Error, "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", "A decorator can only decorate a method implementation, not an overload."), Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: diag(1250, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."), Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: diag(1251, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."), Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: diag(1252, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."), _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: diag(1253, ts.DiagnosticCategory.Error, "_0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag_1253", "'{0}' tag cannot be used independently as a top level JSDoc tag."), A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: diag(1254, ts.DiagnosticCategory.Error, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_1254", "A 'const' initializer in an ambient context must be a string or numeric literal."), A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."), can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."), The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."), Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."), Global_module_exports_may_only_appear_in_declaration_files: diag(1315, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_declaration_files_1315", "Global module exports may only appear in declaration files."), Global_module_exports_may_only_appear_at_top_level: diag(1316, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_at_top_level_1316", "Global module exports may only appear at top level."), A_parameter_property_cannot_be_declared_using_a_rest_parameter: diag(1317, ts.DiagnosticCategory.Error, "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", "A parameter property cannot be declared using a rest parameter."), An_abstract_accessor_cannot_have_an_implementation: diag(1318, ts.DiagnosticCategory.Error, "An_abstract_accessor_cannot_have_an_implementation_1318", "An abstract accessor cannot have an implementation."), A_default_export_can_only_be_used_in_an_ECMAScript_style_module: diag(1319, ts.DiagnosticCategory.Error, "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", "A default export can only be used in an ECMAScript-style module."), Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."), Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."), Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."), Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext_1323", "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'."), Dynamic_import_must_have_one_specifier_as_an_argument: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_import_must_have_one_specifier_as_an_argument_1324", "Dynamic import must have one specifier as an argument."), Specifier_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Specifier_of_dynamic_import_cannot_be_spread_element_1325", "Specifier of dynamic import cannot be spread element."), Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments"), String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."), Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: diag(1328, ts.DiagnosticCategory.Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."), _0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0: diag(1329, ts.DiagnosticCategory.Error, "_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329", "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"), A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly: diag(1330, ts.DiagnosticCategory.Error, "A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330", "A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'."), A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly: diag(1331, ts.DiagnosticCategory.Error, "A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331", "A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'."), A_variable_whose_type_is_a_unique_symbol_type_must_be_const: diag(1332, ts.DiagnosticCategory.Error, "A_variable_whose_type_is_a_unique_symbol_type_must_be_const_1332", "A variable whose type is a 'unique symbol' type must be 'const'."), unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name: diag(1333, ts.DiagnosticCategory.Error, "unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name_1333", "'unique symbol' types may not be used on a variable declaration with a binding name."), unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement: diag(1334, ts.DiagnosticCategory.Error, "unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement_1334", "'unique symbol' types are only allowed on variables in a variable statement."), unique_symbol_types_are_not_allowed_here: diag(1335, ts.DiagnosticCategory.Error, "unique_symbol_types_are_not_allowed_here_1335", "'unique symbol' types are not allowed here."), An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: diag(1336, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead_1336", "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead."), An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead_1337", "An index signature parameter type cannot be a union type. Consider using a mapped object type instead."), infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_1340", "Module '{0}' does not refer to a type, but is used as a type here."), Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_option_1343", "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options."), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), Circular_definition_of_import_alias_0: diag(2303, ts.DiagnosticCategory.Error, "Circular_definition_of_import_alias_0_2303", "Circular definition of import alias '{0}'."), Cannot_find_name_0: diag(2304, ts.DiagnosticCategory.Error, "Cannot_find_name_0_2304", "Cannot find name '{0}'."), Module_0_has_no_exported_member_1: diag(2305, ts.DiagnosticCategory.Error, "Module_0_has_no_exported_member_1_2305", "Module '{0}' has no exported member '{1}'."), File_0_is_not_a_module: diag(2306, ts.DiagnosticCategory.Error, "File_0_is_not_a_module_2306", "File '{0}' is not a module."), Cannot_find_module_0: diag(2307, ts.DiagnosticCategory.Error, "Cannot_find_module_0_2307", "Cannot find module '{0}'."), Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: diag(2308, ts.DiagnosticCategory.Error, "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."), An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: diag(2309, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", "An export assignment cannot be used in a module with other exported elements."), Type_0_recursively_references_itself_as_a_base_type: diag(2310, ts.DiagnosticCategory.Error, "Type_0_recursively_references_itself_as_a_base_type_2310", "Type '{0}' recursively references itself as a base type."), A_class_may_only_extend_another_class: diag(2311, ts.DiagnosticCategory.Error, "A_class_may_only_extend_another_class_2311", "A class may only extend another class."), An_interface_may_only_extend_a_class_or_another_interface: diag(2312, ts.DiagnosticCategory.Error, "An_interface_may_only_extend_a_class_or_another_interface_2312", "An interface may only extend a class or another interface."), Type_parameter_0_has_a_circular_constraint: diag(2313, ts.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_constraint_2313", "Type parameter '{0}' has a circular constraint."), Generic_type_0_requires_1_type_argument_s: diag(2314, ts.DiagnosticCategory.Error, "Generic_type_0_requires_1_type_argument_s_2314", "Generic type '{0}' requires {1} type argument(s)."), Type_0_is_not_generic: diag(2315, ts.DiagnosticCategory.Error, "Type_0_is_not_generic_2315", "Type '{0}' is not generic."), Global_type_0_must_be_a_class_or_interface_type: diag(2316, ts.DiagnosticCategory.Error, "Global_type_0_must_be_a_class_or_interface_type_2316", "Global type '{0}' must be a class or interface type."), Global_type_0_must_have_1_type_parameter_s: diag(2317, ts.DiagnosticCategory.Error, "Global_type_0_must_have_1_type_parameter_s_2317", "Global type '{0}' must have {1} type parameter(s)."), Cannot_find_global_type_0: diag(2318, ts.DiagnosticCategory.Error, "Cannot_find_global_type_0_2318", "Cannot find global type '{0}'."), Named_property_0_of_types_1_and_2_are_not_identical: diag(2319, ts.DiagnosticCategory.Error, "Named_property_0_of_types_1_and_2_are_not_identical_2319", "Named property '{0}' of types '{1}' and '{2}' are not identical."), Interface_0_cannot_simultaneously_extend_types_1_and_2: diag(2320, ts.DiagnosticCategory.Error, "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."), Excessive_stack_depth_comparing_types_0_and_1: diag(2321, ts.DiagnosticCategory.Error, "Excessive_stack_depth_comparing_types_0_and_1_2321", "Excessive stack depth comparing types '{0}' and '{1}'."), Type_0_is_not_assignable_to_type_1: diag(2322, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_2322", "Type '{0}' is not assignable to type '{1}'."), Cannot_redeclare_exported_variable_0: diag(2323, ts.DiagnosticCategory.Error, "Cannot_redeclare_exported_variable_0_2323", "Cannot redeclare exported variable '{0}'."), Property_0_is_missing_in_type_1: diag(2324, ts.DiagnosticCategory.Error, "Property_0_is_missing_in_type_1_2324", "Property '{0}' is missing in type '{1}'."), Property_0_is_private_in_type_1_but_not_in_type_2: diag(2325, ts.DiagnosticCategory.Error, "Property_0_is_private_in_type_1_but_not_in_type_2_2325", "Property '{0}' is private in type '{1}' but not in type '{2}'."), Types_of_property_0_are_incompatible: diag(2326, ts.DiagnosticCategory.Error, "Types_of_property_0_are_incompatible_2326", "Types of property '{0}' are incompatible."), Property_0_is_optional_in_type_1_but_required_in_type_2: diag(2327, ts.DiagnosticCategory.Error, "Property_0_is_optional_in_type_1_but_required_in_type_2_2327", "Property '{0}' is optional in type '{1}' but required in type '{2}'."), Types_of_parameters_0_and_1_are_incompatible: diag(2328, ts.DiagnosticCategory.Error, "Types_of_parameters_0_and_1_are_incompatible_2328", "Types of parameters '{0}' and '{1}' are incompatible."), Index_signature_is_missing_in_type_0: diag(2329, ts.DiagnosticCategory.Error, "Index_signature_is_missing_in_type_0_2329", "Index signature is missing in type '{0}'."), Index_signatures_are_incompatible: diag(2330, ts.DiagnosticCategory.Error, "Index_signatures_are_incompatible_2330", "Index signatures are incompatible."), this_cannot_be_referenced_in_a_module_or_namespace_body: diag(2331, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", "'this' cannot be referenced in a module or namespace body."), this_cannot_be_referenced_in_current_location: diag(2332, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_current_location_2332", "'this' cannot be referenced in current location."), this_cannot_be_referenced_in_constructor_arguments: diag(2333, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_constructor_arguments_2333", "'this' cannot be referenced in constructor arguments."), this_cannot_be_referenced_in_a_static_property_initializer: diag(2334, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_static_property_initializer_2334", "'this' cannot be referenced in a static property initializer."), super_can_only_be_referenced_in_a_derived_class: diag(2335, ts.DiagnosticCategory.Error, "super_can_only_be_referenced_in_a_derived_class_2335", "'super' can only be referenced in a derived class."), super_cannot_be_referenced_in_constructor_arguments: diag(2336, ts.DiagnosticCategory.Error, "super_cannot_be_referenced_in_constructor_arguments_2336", "'super' cannot be referenced in constructor arguments."), Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: diag(2337, ts.DiagnosticCategory.Error, "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337", "Super calls are not permitted outside constructors or in nested functions inside constructors."), super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: diag(2338, ts.DiagnosticCategory.Error, "super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338", "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."), Property_0_does_not_exist_on_type_1: diag(2339, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_2339", "Property '{0}' does not exist on type '{1}'."), Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: diag(2340, ts.DiagnosticCategory.Error, "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", "Only public and protected methods of the base class are accessible via the 'super' keyword."), Property_0_is_private_and_only_accessible_within_class_1: diag(2341, ts.DiagnosticCategory.Error, "Property_0_is_private_and_only_accessible_within_class_1_2341", "Property '{0}' is private and only accessible within class '{1}'."), An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: diag(2342, ts.DiagnosticCategory.Error, "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'."), This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: diag(2343, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'."), Type_0_does_not_satisfy_the_constraint_1: diag(2344, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."), Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, ts.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."), Call_target_does_not_contain_any_signatures: diag(2346, ts.DiagnosticCategory.Error, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."), Untyped_function_calls_may_not_accept_type_arguments: diag(2347, ts.DiagnosticCategory.Error, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."), Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, ts.DiagnosticCategory.Error, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"), Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: diag(2349, ts.DiagnosticCategory.Error, "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatur_2349", "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures."), Only_a_void_function_can_be_called_with_the_new_keyword: diag(2350, ts.DiagnosticCategory.Error, "Only_a_void_function_can_be_called_with_the_new_keyword_2350", "Only a void function can be called with the 'new' keyword."), Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: diag(2351, ts.DiagnosticCategory.Error, "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", "Cannot use 'new' with an expression whose type lacks a call or construct signature."), Type_0_cannot_be_converted_to_type_1: diag(2352, ts.DiagnosticCategory.Error, "Type_0_cannot_be_converted_to_type_1_2352", "Type '{0}' cannot be converted to type '{1}'."), Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: diag(2353, ts.DiagnosticCategory.Error, "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."), This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: diag(2354, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", "This syntax requires an imported helper but module '{0}' cannot be found."), A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: diag(2355, ts.DiagnosticCategory.Error, "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", "A function whose declared type is neither 'void' nor 'any' must return a value."), An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: diag(2356, ts.DiagnosticCategory.Error, "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number' or an enum type."), The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'."), The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: diag(2371, ts.DiagnosticCategory.Error, "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", "A parameter initializer is only allowed in a function or constructor implementation."), Parameter_0_cannot_be_referenced_in_its_initializer: diag(2372, ts.DiagnosticCategory.Error, "Parameter_0_cannot_be_referenced_in_its_initializer_2372", "Parameter '{0}' cannot be referenced in its initializer."), Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: diag(2373, ts.DiagnosticCategory.Error, "Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373", "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it."), Duplicate_string_index_signature: diag(2374, ts.DiagnosticCategory.Error, "Duplicate_string_index_signature_2374", "Duplicate string index signature."), Duplicate_number_index_signature: diag(2375, ts.DiagnosticCategory.Error, "Duplicate_number_index_signature_2375", "Duplicate number index signature."), A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: diag(2376, ts.DiagnosticCategory.Error, "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties."), Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, ts.DiagnosticCategory.Error, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."), A_get_accessor_must_return_a_value: diag(2378, ts.DiagnosticCategory.Error, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."), Getter_and_setter_accessors_do_not_agree_in_visibility: diag(2379, ts.DiagnosticCategory.Error, "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", "Getter and setter accessors do not agree in visibility."), get_and_set_accessor_must_have_the_same_type: diag(2380, ts.DiagnosticCategory.Error, "get_and_set_accessor_must_have_the_same_type_2380", "'get' and 'set' accessor must have the same type."), A_signature_with_an_implementation_cannot_use_a_string_literal_type: diag(2381, ts.DiagnosticCategory.Error, "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", "A signature with an implementation cannot use a string literal type."), Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: diag(2382, ts.DiagnosticCategory.Error, "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", "Specialized overload signature is not assignable to any non-specialized signature."), Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."), Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."), Overload_signatures_must_all_be_public_private_or_protected: diag(2385, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."), Overload_signatures_must_all_be_optional_or_required: diag(2386, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_optional_or_required_2386", "Overload signatures must all be optional or required."), Function_overload_must_be_static: diag(2387, ts.DiagnosticCategory.Error, "Function_overload_must_be_static_2387", "Function overload must be static."), Function_overload_must_not_be_static: diag(2388, ts.DiagnosticCategory.Error, "Function_overload_must_not_be_static_2388", "Function overload must not be static."), Function_implementation_name_must_be_0: diag(2389, ts.DiagnosticCategory.Error, "Function_implementation_name_must_be_0_2389", "Function implementation name must be '{0}'."), Constructor_implementation_is_missing: diag(2390, ts.DiagnosticCategory.Error, "Constructor_implementation_is_missing_2390", "Constructor implementation is missing."), Function_implementation_is_missing_or_not_immediately_following_the_declaration: diag(2391, ts.DiagnosticCategory.Error, "Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391", "Function implementation is missing or not immediately following the declaration."), Multiple_constructor_implementations_are_not_allowed: diag(2392, ts.DiagnosticCategory.Error, "Multiple_constructor_implementations_are_not_allowed_2392", "Multiple constructor implementations are not allowed."), Duplicate_function_implementation: diag(2393, ts.DiagnosticCategory.Error, "Duplicate_function_implementation_2393", "Duplicate function implementation."), Overload_signature_is_not_compatible_with_function_implementation: diag(2394, ts.DiagnosticCategory.Error, "Overload_signature_is_not_compatible_with_function_implementation_2394", "Overload signature is not compatible with function implementation."), Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: diag(2395, ts.DiagnosticCategory.Error, "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", "Individual declarations in merged declaration '{0}' must be all exported or all local."), Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: diag(2396, ts.DiagnosticCategory.Error, "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."), Declaration_name_conflicts_with_built_in_global_identifier_0: diag(2397, ts.DiagnosticCategory.Error, "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", "Declaration name conflicts with built-in global identifier '{0}'."), Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: diag(2399, ts.DiagnosticCategory.Error, "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."), Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: diag(2400, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."), Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: diag(2401, ts.DiagnosticCategory.Error, "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference."), Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: diag(2402, ts.DiagnosticCategory.Error, "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", "Expression resolves to '_super' that compiler uses to capture base class reference."), Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: diag(2403, ts.DiagnosticCategory.Error, "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."), The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), Property_0_of_type_1_is_not_assignable_to_string_index_type_2: diag(2411, ts.DiagnosticCategory.Error, "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", "Property '{0}' of type '{1}' is not assignable to string index type '{2}'."), Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: diag(2412, ts.DiagnosticCategory.Error, "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'."), Numeric_index_type_0_is_not_assignable_to_string_index_type_1: diag(2413, ts.DiagnosticCategory.Error, "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", "Numeric index type '{0}' is not assignable to string index type '{1}'."), Class_name_cannot_be_0: diag(2414, ts.DiagnosticCategory.Error, "Class_name_cannot_be_0_2414", "Class name cannot be '{0}'."), Class_0_incorrectly_extends_base_class_1: diag(2415, ts.DiagnosticCategory.Error, "Class_0_incorrectly_extends_base_class_1_2415", "Class '{0}' incorrectly extends base class '{1}'."), Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2: diag(2416, ts.DiagnosticCategory.Error, "Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2_2416", "Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'."), Class_static_side_0_incorrectly_extends_base_class_static_side_1: diag(2417, ts.DiagnosticCategory.Error, "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", "Class static side '{0}' incorrectly extends base class static side '{1}'."), Class_0_incorrectly_implements_interface_1: diag(2420, ts.DiagnosticCategory.Error, "Class_0_incorrectly_implements_interface_1_2420", "Class '{0}' incorrectly implements interface '{1}'."), A_class_may_only_implement_another_class_or_interface: diag(2422, ts.DiagnosticCategory.Error, "A_class_may_only_implement_another_class_or_interface_2422", "A class may only implement another class or interface."), Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: diag(2423, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."), Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: diag(2424, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property."), Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2425, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."), Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2426, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."), Interface_name_cannot_be_0: diag(2427, ts.DiagnosticCategory.Error, "Interface_name_cannot_be_0_2427", "Interface name cannot be '{0}'."), All_declarations_of_0_must_have_identical_type_parameters: diag(2428, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_type_parameters_2428", "All declarations of '{0}' must have identical type parameters."), Interface_0_incorrectly_extends_interface_1: diag(2430, ts.DiagnosticCategory.Error, "Interface_0_incorrectly_extends_interface_1_2430", "Interface '{0}' incorrectly extends interface '{1}'."), Enum_name_cannot_be_0: diag(2431, ts.DiagnosticCategory.Error, "Enum_name_cannot_be_0_2431", "Enum name cannot be '{0}'."), In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: diag(2432, ts.DiagnosticCategory.Error, "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."), A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: diag(2433, ts.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", "A namespace declaration cannot be in a different file from a class or function with which it is merged."), A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: diag(2434, ts.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", "A namespace declaration cannot be located prior to a class or function with which it is merged."), Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: diag(2435, ts.DiagnosticCategory.Error, "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", "Ambient modules cannot be nested in other modules or namespaces."), Ambient_module_declaration_cannot_specify_relative_module_name: diag(2436, ts.DiagnosticCategory.Error, "Ambient_module_declaration_cannot_specify_relative_module_name_2436", "Ambient module declaration cannot specify relative module name."), Module_0_is_hidden_by_a_local_declaration_with_the_same_name: diag(2437, ts.DiagnosticCategory.Error, "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", "Module '{0}' is hidden by a local declaration with the same name."), Import_name_cannot_be_0: diag(2438, ts.DiagnosticCategory.Error, "Import_name_cannot_be_0_2438", "Import name cannot be '{0}'."), Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: diag(2439, ts.DiagnosticCategory.Error, "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", "Import or export declaration in an ambient module declaration cannot reference module through relative module name."), Import_declaration_conflicts_with_local_declaration_of_0: diag(2440, ts.DiagnosticCategory.Error, "Import_declaration_conflicts_with_local_declaration_of_0_2440", "Import declaration conflicts with local declaration of '{0}'."), Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: diag(2441, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."), Types_have_separate_declarations_of_a_private_property_0: diag(2442, ts.DiagnosticCategory.Error, "Types_have_separate_declarations_of_a_private_property_0_2442", "Types have separate declarations of a private property '{0}'."), Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: diag(2443, ts.DiagnosticCategory.Error, "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."), Property_0_is_protected_in_type_1_but_public_in_type_2: diag(2444, ts.DiagnosticCategory.Error, "Property_0_is_protected_in_type_1_but_public_in_type_2_2444", "Property '{0}' is protected in type '{1}' but public in type '{2}'."), Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: diag(2445, ts.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445", "Property '{0}' is protected and only accessible within class '{1}' and its subclasses."), Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: diag(2446, ts.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", "Property '{0}' is protected and only accessible through an instance of class '{1}'."), The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: diag(2447, ts.DiagnosticCategory.Error, "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."), Block_scoped_variable_0_used_before_its_declaration: diag(2448, ts.DiagnosticCategory.Error, "Block_scoped_variable_0_used_before_its_declaration_2448", "Block-scoped variable '{0}' used before its declaration."), Class_0_used_before_its_declaration: diag(2449, ts.DiagnosticCategory.Error, "Class_0_used_before_its_declaration_2449", "Class '{0}' used before its declaration."), Enum_0_used_before_its_declaration: diag(2450, ts.DiagnosticCategory.Error, "Enum_0_used_before_its_declaration_2450", "Enum '{0}' used before its declaration."), Cannot_redeclare_block_scoped_variable_0: diag(2451, ts.DiagnosticCategory.Error, "Cannot_redeclare_block_scoped_variable_0_2451", "Cannot redeclare block-scoped variable '{0}'."), An_enum_member_cannot_have_a_numeric_name: diag(2452, ts.DiagnosticCategory.Error, "An_enum_member_cannot_have_a_numeric_name_2452", "An enum member cannot have a numeric name."), The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: diag(2453, ts.DiagnosticCategory.Error, "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly."), Variable_0_is_used_before_being_assigned: diag(2454, ts.DiagnosticCategory.Error, "Variable_0_is_used_before_being_assigned_2454", "Variable '{0}' is used before being assigned."), Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: diag(2455, ts.DiagnosticCategory.Error, "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'."), Type_alias_0_circularly_references_itself: diag(2456, ts.DiagnosticCategory.Error, "Type_alias_0_circularly_references_itself_2456", "Type alias '{0}' circularly references itself."), Type_alias_name_cannot_be_0: diag(2457, ts.DiagnosticCategory.Error, "Type_alias_name_cannot_be_0_2457", "Type alias name cannot be '{0}'."), An_AMD_module_cannot_have_multiple_name_assignments: diag(2458, ts.DiagnosticCategory.Error, "An_AMD_module_cannot_have_multiple_name_assignments_2458", "An AMD module cannot have multiple name assignments."), Type_0_has_no_property_1_and_no_string_index_signature: diag(2459, ts.DiagnosticCategory.Error, "Type_0_has_no_property_1_and_no_string_index_signature_2459", "Type '{0}' has no property '{1}' and no string index signature."), Type_0_has_no_property_1: diag(2460, ts.DiagnosticCategory.Error, "Type_0_has_no_property_1_2460", "Type '{0}' has no property '{1}'."), Type_0_is_not_an_array_type: diag(2461, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_2461", "Type '{0}' is not an array type."), A_rest_element_must_be_last_in_a_destructuring_pattern: diag(2462, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", "A rest element must be last in a destructuring pattern."), A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: diag(2463, ts.DiagnosticCategory.Error, "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", "A binding pattern parameter cannot be optional in an implementation signature."), A_computed_property_name_must_be_of_type_string_number_symbol_or_any: diag(2464, ts.DiagnosticCategory.Error, "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", "A computed property name must be of type 'string', 'number', 'symbol', or 'any'."), this_cannot_be_referenced_in_a_computed_property_name: diag(2465, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_computed_property_name_2465", "'this' cannot be referenced in a computed property name."), super_cannot_be_referenced_in_a_computed_property_name: diag(2466, ts.DiagnosticCategory.Error, "super_cannot_be_referenced_in_a_computed_property_name_2466", "'super' cannot be referenced in a computed property name."), A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: diag(2467, ts.DiagnosticCategory.Error, "A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467", "A computed property name cannot reference a type parameter from its containing type."), Cannot_find_global_value_0: diag(2468, ts.DiagnosticCategory.Error, "Cannot_find_global_value_0_2468", "Cannot find global value '{0}'."), The_0_operator_cannot_be_applied_to_type_symbol: diag(2469, ts.DiagnosticCategory.Error, "The_0_operator_cannot_be_applied_to_type_symbol_2469", "The '{0}' operator cannot be applied to type 'symbol'."), Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: diag(2470, ts.DiagnosticCategory.Error, "Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470", "'Symbol' reference does not refer to the global Symbol constructor object."), A_computed_property_name_of_the_form_0_must_be_of_type_symbol: diag(2471, ts.DiagnosticCategory.Error, "A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471", "A computed property name of the form '{0}' must be of type 'symbol'."), Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: diag(2472, ts.DiagnosticCategory.Error, "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."), Enum_declarations_must_all_be_const_or_non_const: diag(2473, ts.DiagnosticCategory.Error, "Enum_declarations_must_all_be_const_or_non_const_2473", "Enum declarations must all be const or non-const."), In_const_enum_declarations_member_initializer_must_be_constant_expression: diag(2474, ts.DiagnosticCategory.Error, "In_const_enum_declarations_member_initializer_must_be_constant_expression_2474", "In 'const' enum declarations member initializer must be constant expression."), const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query: diag(2475, ts.DiagnosticCategory.Error, "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."), A_const_enum_member_can_only_be_accessed_using_a_string_literal: diag(2476, ts.DiagnosticCategory.Error, "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", "A const enum member can only be accessed using a string literal."), const_enum_member_initializer_was_evaluated_to_a_non_finite_value: diag(2477, ts.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", "'const' enum member initializer was evaluated to a non-finite value."), const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: diag(2478, ts.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478", "'const' enum member initializer was evaluated to disallowed value 'NaN'."), Property_0_does_not_exist_on_const_enum_1: diag(2479, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_const_enum_1_2479", "Property '{0}' does not exist on 'const' enum '{1}'."), let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: diag(2480, ts.DiagnosticCategory.Error, "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", "'let' is not allowed to be used as a name in 'let' or 'const' declarations."), Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: diag(2481, ts.DiagnosticCategory.Error, "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."), The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), Cannot_redeclare_identifier_0_in_catch_clause: diag(2492, ts.DiagnosticCategory.Error, "Cannot_redeclare_identifier_0_in_catch_clause_2492", "Cannot redeclare identifier '{0}' in catch clause."), Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: diag(2493, ts.DiagnosticCategory.Error, "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'."), Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: diag(2494, ts.DiagnosticCategory.Error, "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."), Type_0_is_not_an_array_type_or_a_string_type: diag(2495, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_2495", "Type '{0}' is not an array type or a string type."), The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: diag(2496, ts.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496", "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."), Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: diag(2497, ts.DiagnosticCategory.Error, "Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497", "Module '{0}' resolves to a non-module entity and cannot be imported using this construct."), Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: diag(2498, ts.DiagnosticCategory.Error, "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498", "Module '{0}' uses 'export =' and cannot be used with 'export *'."), An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2499, ts.DiagnosticCategory.Error, "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499", "An interface can only extend an identifier/qualified-name with optional type arguments."), A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2500, ts.DiagnosticCategory.Error, "A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500", "A class can only implement an identifier/qualified-name with optional type arguments."), A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), No_base_constructor_has_the_specified_number_of_type_arguments: diag(2508, ts.DiagnosticCategory.Error, "No_base_constructor_has_the_specified_number_of_type_arguments_2508", "No base constructor has the specified number of type arguments."), Base_constructor_return_type_0_is_not_a_class_or_interface_type: diag(2509, ts.DiagnosticCategory.Error, "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", "Base constructor return type '{0}' is not a class or interface type."), Base_constructors_must_all_have_the_same_return_type: diag(2510, ts.DiagnosticCategory.Error, "Base_constructors_must_all_have_the_same_return_type_2510", "Base constructors must all have the same return type."), Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."), Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."), Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."), Classes_containing_abstract_methods_must_be_marked_abstract: diag(2514, ts.DiagnosticCategory.Error, "Classes_containing_abstract_methods_must_be_marked_abstract_2514", "Classes containing abstract methods must be marked abstract."), Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."), All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."), Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."), A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, ts.DiagnosticCategory.Error, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."), An_async_iterator_must_have_a_next_method: diag(2519, ts.DiagnosticCategory.Error, "An_async_iterator_must_have_a_next_method_2519", "An async iterator must have a 'next()' method."), Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: diag(2520, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."), Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: diag(2521, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", "Expression resolves to variable declaration '{0}' that compiler uses to support async functions."), The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: diag(2522, ts.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method."), yield_expressions_cannot_be_used_in_a_parameter_initializer: diag(2523, ts.DiagnosticCategory.Error, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."), await_expressions_cannot_be_used_in_a_parameter_initializer: diag(2524, ts.DiagnosticCategory.Error, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."), Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: diag(2525, ts.DiagnosticCategory.Error, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."), A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: diag(2526, ts.DiagnosticCategory.Error, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."), The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary: diag(2527, ts.DiagnosticCategory.Error, "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."), A_module_cannot_have_multiple_default_exports: diag(2528, ts.DiagnosticCategory.Error, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."), Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: diag(2529, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."), Property_0_is_incompatible_with_index_signature: diag(2530, ts.DiagnosticCategory.Error, "Property_0_is_incompatible_with_index_signature_2530", "Property '{0}' is incompatible with index signature."), Object_is_possibly_null: diag(2531, ts.DiagnosticCategory.Error, "Object_is_possibly_null_2531", "Object is possibly 'null'."), Object_is_possibly_undefined: diag(2532, ts.DiagnosticCategory.Error, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."), Object_is_possibly_null_or_undefined: diag(2533, ts.DiagnosticCategory.Error, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."), A_function_returning_never_cannot_have_a_reachable_end_point: diag(2534, ts.DiagnosticCategory.Error, "A_function_returning_never_cannot_have_a_reachable_end_point_2534", "A function returning 'never' cannot have a reachable end point."), Enum_type_0_has_members_with_initializers_that_are_not_literals: diag(2535, ts.DiagnosticCategory.Error, "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", "Enum type '{0}' has members with initializers that are not literals."), Type_0_cannot_be_used_to_index_type_1: diag(2536, ts.DiagnosticCategory.Error, "Type_0_cannot_be_used_to_index_type_1_2536", "Type '{0}' cannot be used to index type '{1}'."), Type_0_has_no_matching_index_signature_for_type_1: diag(2537, ts.DiagnosticCategory.Error, "Type_0_has_no_matching_index_signature_for_type_1_2537", "Type '{0}' has no matching index signature for type '{1}'."), Type_0_cannot_be_used_as_an_index_type: diag(2538, ts.DiagnosticCategory.Error, "Type_0_cannot_be_used_as_an_index_type_2538", "Type '{0}' cannot be used as an index type."), Cannot_assign_to_0_because_it_is_not_a_variable: diag(2539, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_not_a_variable_2539", "Cannot assign to '{0}' because it is not a variable."), Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: diag(2540, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", "Cannot assign to '{0}' because it is a constant or a read-only property."), The_target_of_an_assignment_must_be_a_variable_or_a_property_access: diag(2541, ts.DiagnosticCategory.Error, "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", "The target of an assignment must be a variable or a property access."), Index_signature_in_type_0_only_permits_reading: diag(2542, ts.DiagnosticCategory.Error, "Index_signature_in_type_0_only_permits_reading_2542", "Index signature in type '{0}' only permits reading."), Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: diag(2543, ts.DiagnosticCategory.Error, "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference."), Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: diag(2544, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference."), A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: diag(2545, ts.DiagnosticCategory.Error, "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", "A mixin class must have a constructor with a single rest parameter of type 'any[]'."), Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: diag(2546, ts.DiagnosticCategory.Error, "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'."), The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: diag(2547, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property."), Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2548, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator."), Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2549, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator."), Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: diag(2550, ts.DiagnosticCategory.Error, "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", "Generic type instantiation is excessively deep and possibly infinite."), Property_0_does_not_exist_on_type_1_Did_you_mean_2: diag(2551, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551", "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?"), Cannot_find_name_0_Did_you_mean_1: diag(2552, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_1_2552", "Cannot find name '{0}'. Did you mean '{1}'?"), Computed_values_are_not_permitted_in_an_enum_with_string_valued_members: diag(2553, ts.DiagnosticCategory.Error, "Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553", "Computed values are not permitted in an enum with string valued members."), Expected_0_arguments_but_got_1: diag(2554, ts.DiagnosticCategory.Error, "Expected_0_arguments_but_got_1_2554", "Expected {0} arguments, but got {1}."), Expected_at_least_0_arguments_but_got_1: diag(2555, ts.DiagnosticCategory.Error, "Expected_at_least_0_arguments_but_got_1_2555", "Expected at least {0} arguments, but got {1}."), Expected_0_arguments_but_got_1_or_more: diag(2556, ts.DiagnosticCategory.Error, "Expected_0_arguments_but_got_1_or_more_2556", "Expected {0} arguments, but got {1} or more."), Expected_at_least_0_arguments_but_got_1_or_more: diag(2557, ts.DiagnosticCategory.Error, "Expected_at_least_0_arguments_but_got_1_or_more_2557", "Expected at least {0} arguments, but got {1} or more."), Expected_0_type_arguments_but_got_1: diag(2558, ts.DiagnosticCategory.Error, "Expected_0_type_arguments_but_got_1_2558", "Expected {0} type arguments, but got {1}."), Type_0_has_no_properties_in_common_with_type_1: diag(2559, ts.DiagnosticCategory.Error, "Type_0_has_no_properties_in_common_with_type_1_2559", "Type '{0}' has no properties in common with type '{1}'."), Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it: diag(2560, ts.DiagnosticCategory.Error, "Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it_2560", "Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?"), Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2: diag(2561, ts.DiagnosticCategory.Error, "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561", "Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?"), Base_class_expressions_cannot_reference_class_type_parameters: diag(2562, ts.DiagnosticCategory.Error, "Base_class_expressions_cannot_reference_class_type_parameters_2562", "Base class expressions cannot reference class type parameters."), The_containing_function_or_module_body_is_too_large_for_control_flow_analysis: diag(2563, ts.DiagnosticCategory.Error, "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563", "The containing function or module body is too large for control flow analysis."), Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor: diag(2564, ts.DiagnosticCategory.Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor_2564", "Property '{0}' has no initializer and is not definitely assigned in the constructor."), Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2568, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators_2568", "Type '{0}' is not an array type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."), Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await: diag(2570, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570", "Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?"), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), Property_0_in_type_1_is_not_assignable_to_type_2: diag(2603, ts.DiagnosticCategory.Error, "Property_0_in_type_1_is_not_assignable_to_type_2_2603", "Property '{0}' in type '{1}' is not assignable to type '{2}'."), JSX_element_type_0_does_not_have_any_construct_or_call_signatures: diag(2604, ts.DiagnosticCategory.Error, "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", "JSX element type '{0}' does not have any construct or call signatures."), JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: diag(2605, ts.DiagnosticCategory.Error, "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", "JSX element type '{0}' is not a constructor function for JSX elements."), Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: diag(2606, ts.DiagnosticCategory.Error, "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", "Property '{0}' of JSX spread attribute is not assignable to target property."), JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: diag(2607, ts.DiagnosticCategory.Error, "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", "JSX element class does not support attributes because it does not have a '{0}' property."), The_global_type_JSX_0_may_not_have_more_than_one_property: diag(2608, ts.DiagnosticCategory.Error, "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", "The global type 'JSX.{0}' may not have more than one property."), JSX_spread_child_must_be_an_array_type: diag(2609, ts.DiagnosticCategory.Error, "JSX_spread_child_must_be_an_array_type_2609", "JSX spread child must be an array type."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, ts.DiagnosticCategory.Error, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."), Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: diag(2654, ts.DiagnosticCategory.Error, "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition."), Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: diag(2656, ts.DiagnosticCategory.Error, "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition."), JSX_expressions_must_have_one_parent_element: diag(2657, ts.DiagnosticCategory.Error, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."), Type_0_provides_no_match_for_the_signature_1: diag(2658, ts.DiagnosticCategory.Error, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."), super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, ts.DiagnosticCategory.Error, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."), super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: diag(2660, ts.DiagnosticCategory.Error, "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", "'super' can only be referenced in members of derived classes or object literal expressions."), Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: diag(2661, ts.DiagnosticCategory.Error, "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", "Cannot export '{0}'. Only local declarations can be exported from a module."), Cannot_find_name_0_Did_you_mean_the_static_member_1_0: diag(2662, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"), Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: diag(2663, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"), Invalid_module_name_in_augmentation_module_0_cannot_be_found: diag(2664, ts.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", "Invalid module name in augmentation, module '{0}' cannot be found."), Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: diag(2665, ts.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented."), Exports_and_export_assignments_are_not_permitted_in_module_augmentations: diag(2666, ts.DiagnosticCategory.Error, "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", "Exports and export assignments are not permitted in module augmentations."), Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: diag(2667, ts.DiagnosticCategory.Error, "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."), export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: diag(2668, ts.DiagnosticCategory.Error, "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."), Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: diag(2669, ts.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."), Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: diag(2670, ts.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."), Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: diag(2671, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", "Cannot augment module '{0}' because it resolves to a non-module entity."), Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: diag(2672, ts.DiagnosticCategory.Error, "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", "Cannot assign a '{0}' constructor type to a '{1}' constructor type."), Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: diag(2673, ts.DiagnosticCategory.Error, "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", "Constructor of class '{0}' is private and only accessible within the class declaration."), Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: diag(2674, ts.DiagnosticCategory.Error, "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", "Constructor of class '{0}' is protected and only accessible within the class declaration."), Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: diag(2675, ts.DiagnosticCategory.Error, "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", "Cannot extend a class '{0}'. Class constructor is marked as private."), Accessors_must_both_be_abstract_or_non_abstract: diag(2676, ts.DiagnosticCategory.Error, "Accessors_must_both_be_abstract_or_non_abstract_2676", "Accessors must both be abstract or non-abstract."), A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: diag(2677, ts.DiagnosticCategory.Error, "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", "A type predicate's type must be assignable to its parameter's type."), Type_0_is_not_comparable_to_type_1: diag(2678, ts.DiagnosticCategory.Error, "Type_0_is_not_comparable_to_type_1_2678", "Type '{0}' is not comparable to type '{1}'."), A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: diag(2679, ts.DiagnosticCategory.Error, "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'."), A_0_parameter_must_be_the_first_parameter: diag(2680, ts.DiagnosticCategory.Error, "A_0_parameter_must_be_the_first_parameter_2680", "A '{0}' parameter must be the first parameter."), A_constructor_cannot_have_a_this_parameter: diag(2681, ts.DiagnosticCategory.Error, "A_constructor_cannot_have_a_this_parameter_2681", "A constructor cannot have a 'this' parameter."), get_and_set_accessor_must_have_the_same_this_type: diag(2682, ts.DiagnosticCategory.Error, "get_and_set_accessor_must_have_the_same_this_type_2682", "'get' and 'set' accessor must have the same 'this' type."), this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: diag(2683, ts.DiagnosticCategory.Error, "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", "'this' implicitly has type 'any' because it does not have a type annotation."), The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: diag(2684, ts.DiagnosticCategory.Error, "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'."), The_this_types_of_each_signature_are_incompatible: diag(2685, ts.DiagnosticCategory.Error, "The_this_types_of_each_signature_are_incompatible_2685", "The 'this' types of each signature are incompatible."), _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: diag(2686, ts.DiagnosticCategory.Error, "_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686", "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead."), All_declarations_of_0_must_have_identical_modifiers: diag(2687, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_modifiers_2687", "All declarations of '{0}' must have identical modifiers."), Cannot_find_type_definition_file_for_0: diag(2688, ts.DiagnosticCategory.Error, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."), Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, ts.DiagnosticCategory.Error, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"), An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, ts.DiagnosticCategory.Error, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."), _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, ts.DiagnosticCategory.Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."), _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."), Namespace_0_has_no_exported_member_1: diag(2694, ts.DiagnosticCategory.Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."), Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects.", !0), The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: diag(2696, ts.DiagnosticCategory.Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"), An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2697, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option."), Spread_types_may_only_be_created_from_object_types: diag(2698, ts.DiagnosticCategory.Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."), Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: diag(2699, ts.DiagnosticCategory.Error, "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'."), Rest_types_may_only_be_created_from_object_types: diag(2700, ts.DiagnosticCategory.Error, "Rest_types_may_only_be_created_from_object_types_2700", "Rest types may only be created from object types."), The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: diag(2701, ts.DiagnosticCategory.Error, "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", "The target of an object rest assignment must be a variable or a property access."), _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: diag(2702, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", "'{0}' only refers to a type, but is being used as a namespace here."), The_operand_of_a_delete_operator_must_be_a_property_reference: diag(2703, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", "The operand of a delete operator must be a property reference."), The_operand_of_a_delete_operator_cannot_be_a_read_only_property: diag(2704, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", "The operand of a delete operator cannot be a read-only property."), An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: diag(2705, ts.DiagnosticCategory.Error, "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option."), Required_type_parameters_may_not_follow_optional_type_parameters: diag(2706, ts.DiagnosticCategory.Error, "Required_type_parameters_may_not_follow_optional_type_parameters_2706", "Required type parameters may not follow optional type parameters."), Generic_type_0_requires_between_1_and_2_type_arguments: diag(2707, ts.DiagnosticCategory.Error, "Generic_type_0_requires_between_1_and_2_type_arguments_2707", "Generic type '{0}' requires between {1} and {2} type arguments."), Cannot_use_namespace_0_as_a_value: diag(2708, ts.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_value_2708", "Cannot use namespace '{0}' as a value."), Cannot_use_namespace_0_as_a_type: diag(2709, ts.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_type_2709", "Cannot use namespace '{0}' as a type."), _0_are_specified_twice_The_attribute_named_0_will_be_overwritten: diag(2710, ts.DiagnosticCategory.Error, "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710", "'{0}' are specified twice. The attribute named '{0}' will be overwritten."), A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2711, ts.DiagnosticCategory.Error, "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711", "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option."), A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: diag(2712, ts.DiagnosticCategory.Error, "A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712", "A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option."), Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1: diag(2713, ts.DiagnosticCategory.Error, "Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_p_2713", "Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?"), The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context: diag(2714, ts.DiagnosticCategory.Error, "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714", "The expression of an export assignment must be an identifier or qualified name in an ambient context."), Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor: diag(2715, ts.DiagnosticCategory.Error, "Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor_2715", "Abstract property '{0}' in class '{1}' cannot be accessed in the constructor."), Type_parameter_0_has_a_circular_default: diag(2716, ts.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_default_2716", "Type parameter '{0}' has a circular default."), Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2: diag(2717, ts.DiagnosticCategory.Error, "Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717", "Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'."), Duplicate_declaration_0: diag(2718, ts.DiagnosticCategory.Error, "Duplicate_declaration_0_2718", "Duplicate declaration '{0}'."), Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: diag(2719, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719", "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated."), Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass: diag(2720, ts.DiagnosticCategory.Error, "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720", "Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?"), Cannot_invoke_an_object_which_is_possibly_null: diag(2721, ts.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_null_2721", "Cannot invoke an object which is possibly 'null'."), Cannot_invoke_an_object_which_is_possibly_undefined: diag(2722, ts.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_undefined_2722", "Cannot invoke an object which is possibly 'undefined'."), Cannot_invoke_an_object_which_is_possibly_null_or_undefined: diag(2723, ts.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723", "Cannot invoke an object which is possibly 'null' or 'undefined'."), Module_0_has_no_exported_member_1_Did_you_mean_2: diag(2724, ts.DiagnosticCategory.Error, "Module_0_has_no_exported_member_1_Did_you_mean_2_2724", "Module '{0}' has no exported member '{1}'. Did you mean '{2}'?"), Import_declaration_0_is_using_private_name_1: diag(4e3, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4006, ts.DiagnosticCategory.Error, "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006", "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."), Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4008, ts.DiagnosticCategory.Error, "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008", "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."), Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4010, ts.DiagnosticCategory.Error, "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010", "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."), Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4012, ts.DiagnosticCategory.Error, "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012", "Type parameter '{0}' of public method from exported class has or is using private name '{1}'."), Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4014, ts.DiagnosticCategory.Error, "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", "Type parameter '{0}' of method from exported interface has or is using private name '{1}'."), Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4016, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", "Type parameter '{0}' of exported function has or is using private name '{1}'."), Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4019, ts.DiagnosticCategory.Error, "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", "Implements clause of exported class '{0}' has or is using private name '{1}'."), extends_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4020, ts.DiagnosticCategory.Error, "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", "'extends' clause of exported class '{0}' has or is using private name '{1}'."), extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: diag(4022, ts.DiagnosticCategory.Error, "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", "'extends' clause of exported interface '{0}' has or is using private name '{1}'."), Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4023, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."), Exported_variable_0_has_or_is_using_name_1_from_private_module_2: diag(4024, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", "Exported variable '{0}' has or is using name '{1}' from private module '{2}'."), Exported_variable_0_has_or_is_using_private_name_1: diag(4025, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_private_name_1_4025", "Exported variable '{0}' has or is using private name '{1}'."), Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4026, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026", "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4027, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027", "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."), Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4028, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028", "Public static property '{0}' of exported class has or is using private name '{1}'."), Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4029, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029", "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4030, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030", "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."), Public_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4031, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031", "Public property '{0}' of exported class has or is using private name '{1}'."), Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4032, ts.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032", "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."), Property_0_of_exported_interface_has_or_is_using_private_name_1: diag(4033, ts.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033", "Property '{0}' of exported interface has or is using private name '{1}'."), Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4034, ts.DiagnosticCategory.Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034", "Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1: diag(4035, ts.DiagnosticCategory.Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035", "Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'."), Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4036, ts.DiagnosticCategory.Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036", "Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1: diag(4037, ts.DiagnosticCategory.Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037", "Parameter type of public setter '{0}' from exported class has or is using private name '{1}'."), Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4038, ts.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_modul_4038", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."), Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4039, ts.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1: diag(4040, ts.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040", "Return type of public static getter '{0}' from exported class has or is using private name '{1}'."), Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4041, ts.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_4041", "Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."), Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4042, ts.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042", "Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1: diag(4043, ts.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043", "Return type of public getter '{0}' from exported class has or is using private name '{1}'."), Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4044, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044", "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."), Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4045, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045", "Return type of constructor signature from exported interface has or is using private name '{0}'."), Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4046, ts.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046", "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."), Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4047, ts.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047", "Return type of call signature from exported interface has or is using private name '{0}'."), Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4048, ts.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048", "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."), Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4049, ts.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049", "Return type of index signature from exported interface has or is using private name '{0}'."), Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4050, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050", "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."), Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4051, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051", "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."), Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: diag(4052, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052", "Return type of public static method from exported class has or is using private name '{0}'."), Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4053, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053", "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."), Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4054, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054", "Return type of public method from exported class has or is using name '{0}' from private module '{1}'."), Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: diag(4055, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055", "Return type of public method from exported class has or is using private name '{0}'."), Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4056, ts.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056", "Return type of method from exported interface has or is using name '{0}' from private module '{1}'."), Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: diag(4057, ts.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057", "Return type of method from exported interface has or is using private name '{0}'."), Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4058, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058", "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."), Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: diag(4059, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059", "Return type of exported function has or is using name '{0}' from private module '{1}'."), Return_type_of_exported_function_has_or_is_using_private_name_0: diag(4060, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_private_name_0_4060", "Return type of exported function has or is using private name '{0}'."), Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4061, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."), Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4062, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."), Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: diag(4063, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063", "Parameter '{0}' of constructor from exported class has or is using private name '{1}'."), Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4064, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064", "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."), Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4065, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065", "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."), Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4066, ts.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066", "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."), Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4067, ts.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067", "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."), Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4068, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."), Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4069, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."), Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4070, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070", "Parameter '{0}' of public static method from exported class has or is using private name '{1}'."), Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4071, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071", "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."), Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4072, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072", "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."), Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4073, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073", "Parameter '{0}' of public method from exported class has or is using private name '{1}'."), Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4074, ts.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074", "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."), Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4075, ts.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075", "Parameter '{0}' of method from exported interface has or is using private name '{1}'."), Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4076, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076", "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."), Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: diag(4077, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077", "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."), Parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4078, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", "Parameter '{0}' of exported function has or is using private name '{1}'."), Exported_type_alias_0_has_or_is_using_private_name_1: diag(4081, ts.DiagnosticCategory.Error, "Exported_type_alias_0_has_or_is_using_private_name_1_4081", "Exported type alias '{0}' has or is using private name '{1}'."), Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, ts.DiagnosticCategory.Error, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."), Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."), Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, ts.DiagnosticCategory.Error, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."), Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, ts.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."), Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, ts.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."), Property_0_of_exported_class_expression_may_not_be_private_or_protected: diag(4094, ts.DiagnosticCategory.Error, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."), Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4095, ts.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4096, ts.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."), Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4097, ts.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."), Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4098, ts.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098", "Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4099, ts.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099", "Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'."), Public_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4100, ts.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100", "Public method '{0}' of exported class has or is using private name '{1}'."), Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."), Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."), The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."), Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."), File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."), Cannot_read_file_0_Colon_1: diag(5012, ts.DiagnosticCategory.Error, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."), Failed_to_parse_file_0_Colon_1: diag(5014, ts.DiagnosticCategory.Error, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."), Unknown_compiler_option_0: diag(5023, ts.DiagnosticCategory.Error, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."), Compiler_option_0_requires_a_value_of_type_1: diag(5024, ts.DiagnosticCategory.Error, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."), Could_not_write_file_0_Colon_1: diag(5033, ts.DiagnosticCategory.Error, "Could_not_write_file_0_Colon_1_5033", "Could not write file '{0}': {1}."), Option_project_cannot_be_mixed_with_source_files_on_a_command_line: diag(5042, ts.DiagnosticCategory.Error, "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", "Option 'project' cannot be mixed with source files on a command line."), Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: diag(5047, ts.DiagnosticCategory.Error, "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."), Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: diag(5051, ts.DiagnosticCategory.Error, "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."), Option_0_cannot_be_specified_without_specifying_option_1: diag(5052, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_without_specifying_option_1_5052", "Option '{0}' cannot be specified without specifying option '{1}'."), Option_0_cannot_be_specified_with_option_1: diag(5053, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_with_option_1_5053", "Option '{0}' cannot be specified with option '{1}'."), A_tsconfig_json_file_is_already_defined_at_Colon_0: diag(5054, ts.DiagnosticCategory.Error, "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", "A 'tsconfig.json' file is already defined at: '{0}'."), Cannot_write_file_0_because_it_would_overwrite_input_file: diag(5055, ts.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", "Cannot write file '{0}' because it would overwrite input file."), Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: diag(5056, ts.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", "Cannot write file '{0}' because it would be overwritten by multiple input files."), Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: diag(5057, ts.DiagnosticCategory.Error, "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", "Cannot find a tsconfig.json file at the specified directory: '{0}'."), The_specified_path_does_not_exist_Colon_0: diag(5058, ts.DiagnosticCategory.Error, "The_specified_path_does_not_exist_Colon_0_5058", "The specified path does not exist: '{0}'."), Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: diag(5059, ts.DiagnosticCategory.Error, "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier."), Option_paths_cannot_be_used_without_specifying_baseUrl_option: diag(5060, ts.DiagnosticCategory.Error, "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", "Option 'paths' cannot be used without specifying '--baseUrl' option."), Pattern_0_can_have_at_most_one_Asterisk_character: diag(5061, ts.DiagnosticCategory.Error, "Pattern_0_can_have_at_most_one_Asterisk_character_5061", "Pattern '{0}' can have at most one '*' character."), Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: diag(5062, ts.DiagnosticCategory.Error, "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", "Substitution '{0}' in pattern '{1}' in can have at most one '*' character."), Substitutions_for_pattern_0_should_be_an_array: diag(5063, ts.DiagnosticCategory.Error, "Substitutions_for_pattern_0_should_be_an_array_5063", "Substitutions for pattern '{0}' should be an array."), Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: diag(5064, ts.DiagnosticCategory.Error, "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'."), File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5065, ts.DiagnosticCategory.Error, "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'."), Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: diag(5066, ts.DiagnosticCategory.Error, "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", "Substitutions for pattern '{0}' shouldn't be an empty array."), Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(5067, ts.DiagnosticCategory.Error, "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."), Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: diag(5068, ts.DiagnosticCategory.Error, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."), Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: diag(5069, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."), Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy: diag(5070, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070", "Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: diag(6003, ts.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", "Specify the location where debugger should locate map files instead of generated locations."), Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: diag(6004, ts.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", "Specify the location where debugger should locate TypeScript files instead of source locations."), Watch_input_files: diag(6005, ts.DiagnosticCategory.Message, "Watch_input_files_6005", "Watch input files."), Redirect_output_structure_to_the_directory: diag(6006, ts.DiagnosticCategory.Message, "Redirect_output_structure_to_the_directory_6006", "Redirect output structure to the directory."), Do_not_erase_const_enum_declarations_in_generated_code: diag(6007, ts.DiagnosticCategory.Message, "Do_not_erase_const_enum_declarations_in_generated_code_6007", "Do not erase const enum declarations in generated code."), Do_not_emit_outputs_if_any_errors_were_reported: diag(6008, ts.DiagnosticCategory.Message, "Do_not_emit_outputs_if_any_errors_were_reported_6008", "Do not emit outputs if any errors were reported."), Do_not_emit_comments_to_output: diag(6009, ts.DiagnosticCategory.Message, "Do_not_emit_comments_to_output_6009", "Do not emit comments to output."), Do_not_emit_outputs: diag(6010, ts.DiagnosticCategory.Message, "Do_not_emit_outputs_6010", "Do not emit outputs."), Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: diag(6011, ts.DiagnosticCategory.Message, "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", "Allow default imports from modules with no default export. This does not affect code emit, just typechecking."), Skip_type_checking_of_declaration_files: diag(6012, ts.DiagnosticCategory.Message, "Skip_type_checking_of_declaration_files_6012", "Skip type checking of declaration files."), Do_not_resolve_the_real_path_of_symlinks: diag(6013, ts.DiagnosticCategory.Message, "Do_not_resolve_the_real_path_of_symlinks_6013", "Do not resolve the real path of symlinks."), Only_emit_d_ts_declaration_files: diag(6014, ts.DiagnosticCategory.Message, "Only_emit_d_ts_declaration_files_6014", "Only emit '.d.ts' declaration files."), Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_or_ESNEXT: diag(6015, ts.DiagnosticCategory.Message, "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_or_ESNEXT_6015", "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'."), Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext: diag(6016, ts.DiagnosticCategory.Message, "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016", "Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'."), Print_this_message: diag(6017, ts.DiagnosticCategory.Message, "Print_this_message_6017", "Print this message."), Print_the_compiler_s_version: diag(6019, ts.DiagnosticCategory.Message, "Print_the_compiler_s_version_6019", "Print the compiler's version."), Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: diag(6020, ts.DiagnosticCategory.Message, "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'."), Syntax_Colon_0: diag(6023, ts.DiagnosticCategory.Message, "Syntax_Colon_0_6023", "Syntax: {0}"), options: diag(6024, ts.DiagnosticCategory.Message, "options_6024", "options"), file: diag(6025, ts.DiagnosticCategory.Message, "file_6025", "file"), Examples_Colon_0: diag(6026, ts.DiagnosticCategory.Message, "Examples_Colon_0_6026", "Examples: {0}"), Options_Colon: diag(6027, ts.DiagnosticCategory.Message, "Options_Colon_6027", "Options:"), Version_0: diag(6029, ts.DiagnosticCategory.Message, "Version_0_6029", "Version {0}"), Insert_command_line_options_and_files_from_a_file: diag(6030, ts.DiagnosticCategory.Message, "Insert_command_line_options_and_files_from_a_file_6030", "Insert command line options and files from a file."), Starting_compilation_in_watch_mode: diag(6031, ts.DiagnosticCategory.Message, "Starting_compilation_in_watch_mode_6031", "Starting compilation in watch mode..."), File_change_detected_Starting_incremental_compilation: diag(6032, ts.DiagnosticCategory.Message, "File_change_detected_Starting_incremental_compilation_6032", "File change detected. Starting incremental compilation..."), KIND: diag(6034, ts.DiagnosticCategory.Message, "KIND_6034", "KIND"), FILE: diag(6035, ts.DiagnosticCategory.Message, "FILE_6035", "FILE"), VERSION: diag(6036, ts.DiagnosticCategory.Message, "VERSION_6036", "VERSION"), LOCATION: diag(6037, ts.DiagnosticCategory.Message, "LOCATION_6037", "LOCATION"), DIRECTORY: diag(6038, ts.DiagnosticCategory.Message, "DIRECTORY_6038", "DIRECTORY"), STRATEGY: diag(6039, ts.DiagnosticCategory.Message, "STRATEGY_6039", "STRATEGY"), FILE_OR_DIRECTORY: diag(6040, ts.DiagnosticCategory.Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"), Generates_corresponding_map_file: diag(6043, ts.DiagnosticCategory.Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."), Compiler_option_0_expects_an_argument: diag(6044, ts.DiagnosticCategory.Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."), Unterminated_quoted_string_in_response_file_0: diag(6045, ts.DiagnosticCategory.Error, "Unterminated_quoted_string_in_response_file_0_6045", "Unterminated quoted string in response file '{0}'."), Argument_for_0_option_must_be_Colon_1: diag(6046, ts.DiagnosticCategory.Error, "Argument_for_0_option_must_be_Colon_1_6046", "Argument for '{0}' option must be: {1}."), Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: diag(6048, ts.DiagnosticCategory.Error, "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", "Locale must be of the form or -. For example '{0}' or '{1}'."), Unsupported_locale_0: diag(6049, ts.DiagnosticCategory.Error, "Unsupported_locale_0_6049", "Unsupported locale '{0}'."), Unable_to_open_file_0: diag(6050, ts.DiagnosticCategory.Error, "Unable_to_open_file_0_6050", "Unable to open file '{0}'."), Corrupted_locale_file_0: diag(6051, ts.DiagnosticCategory.Error, "Corrupted_locale_file_0_6051", "Corrupted locale file {0}."), Raise_error_on_expressions_and_declarations_with_an_implied_any_type: diag(6052, ts.DiagnosticCategory.Message, "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052", "Raise error on expressions and declarations with an implied 'any' type."), File_0_not_found: diag(6053, ts.DiagnosticCategory.Error, "File_0_not_found_6053", "File '{0}' not found."), File_0_has_unsupported_extension_The_only_supported_extensions_are_1: diag(6054, ts.DiagnosticCategory.Error, "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", "File '{0}' has unsupported extension. The only supported extensions are {1}."), Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: diag(6055, ts.DiagnosticCategory.Message, "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", "Suppress noImplicitAny errors for indexing objects lacking index signatures."), Do_not_emit_declarations_for_code_that_has_an_internal_annotation: diag(6056, ts.DiagnosticCategory.Message, "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", "Do not emit declarations for code that has an '@internal' annotation."), Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: diag(6058, ts.DiagnosticCategory.Message, "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", "Specify the root directory of input files. Use to control the output directory structure with --outDir."), File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: diag(6059, ts.DiagnosticCategory.Error, "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."), Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: diag(6060, ts.DiagnosticCategory.Message, "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."), NEWLINE: diag(6061, ts.DiagnosticCategory.Message, "NEWLINE_6061", "NEWLINE"), Option_0_can_only_be_specified_in_tsconfig_json_file: diag(6064, ts.DiagnosticCategory.Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", "Option '{0}' can only be specified in 'tsconfig.json' file."), Enables_experimental_support_for_ES7_decorators: diag(6065, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_ES7_decorators_6065", "Enables experimental support for ES7 decorators."), Enables_experimental_support_for_emitting_type_metadata_for_decorators: diag(6066, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", "Enables experimental support for emitting type metadata for decorators."), Enables_experimental_support_for_ES7_async_functions: diag(6068, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_ES7_async_functions_6068", "Enables experimental support for ES7 async functions."), Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: diag(6069, ts.DiagnosticCategory.Message, "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)."), Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: diag(6070, ts.DiagnosticCategory.Message, "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", "Initializes a TypeScript project and creates a tsconfig.json file."), Successfully_created_a_tsconfig_json_file: diag(6071, ts.DiagnosticCategory.Message, "Successfully_created_a_tsconfig_json_file_6071", "Successfully created a tsconfig.json file."), Suppress_excess_property_checks_for_object_literals: diag(6072, ts.DiagnosticCategory.Message, "Suppress_excess_property_checks_for_object_literals_6072", "Suppress excess property checks for object literals."), Stylize_errors_and_messages_using_color_and_context_experimental: diag(6073, ts.DiagnosticCategory.Message, "Stylize_errors_and_messages_using_color_and_context_experimental_6073", "Stylize errors and messages using color and context (experimental)."), Do_not_report_errors_on_unused_labels: diag(6074, ts.DiagnosticCategory.Message, "Do_not_report_errors_on_unused_labels_6074", "Do not report errors on unused labels."), Report_error_when_not_all_code_paths_in_function_return_a_value: diag(6075, ts.DiagnosticCategory.Message, "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", "Report error when not all code paths in function return a value."), Report_errors_for_fallthrough_cases_in_switch_statement: diag(6076, ts.DiagnosticCategory.Message, "Report_errors_for_fallthrough_cases_in_switch_statement_6076", "Report errors for fallthrough cases in switch statement."), Do_not_report_errors_on_unreachable_code: diag(6077, ts.DiagnosticCategory.Message, "Do_not_report_errors_on_unreachable_code_6077", "Do not report errors on unreachable code."), Disallow_inconsistently_cased_references_to_the_same_file: diag(6078, ts.DiagnosticCategory.Message, "Disallow_inconsistently_cased_references_to_the_same_file_6078", "Disallow inconsistently-cased references to the same file."), Specify_library_files_to_be_included_in_the_compilation: diag(6079, ts.DiagnosticCategory.Message, "Specify_library_files_to_be_included_in_the_compilation_6079", "Specify library files to be included in the compilation."), Specify_JSX_code_generation_Colon_preserve_react_native_or_react: diag(6080, ts.DiagnosticCategory.Message, "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", "Specify JSX code generation: 'preserve', 'react-native', or 'react'."), File_0_has_an_unsupported_extension_so_skipping_it: diag(6081, ts.DiagnosticCategory.Message, "File_0_has_an_unsupported_extension_so_skipping_it_6081", "File '{0}' has an unsupported extension, so skipping it."), Only_amd_and_system_modules_are_supported_alongside_0: diag(6082, ts.DiagnosticCategory.Error, "Only_amd_and_system_modules_are_supported_alongside_0_6082", "Only 'amd' and 'system' modules are supported alongside --{0}."), Base_directory_to_resolve_non_absolute_module_names: diag(6083, ts.DiagnosticCategory.Message, "Base_directory_to_resolve_non_absolute_module_names_6083", "Base directory to resolve non-absolute module names."), Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: diag(6084, ts.DiagnosticCategory.Message, "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit"), Enable_tracing_of_the_name_resolution_process: diag(6085, ts.DiagnosticCategory.Message, "Enable_tracing_of_the_name_resolution_process_6085", "Enable tracing of the name resolution process."), Resolving_module_0_from_1: diag(6086, ts.DiagnosticCategory.Message, "Resolving_module_0_from_1_6086", "======== Resolving module '{0}' from '{1}'. ========"), Explicitly_specified_module_resolution_kind_Colon_0: diag(6087, ts.DiagnosticCategory.Message, "Explicitly_specified_module_resolution_kind_Colon_0_6087", "Explicitly specified module resolution kind: '{0}'."), Module_resolution_kind_is_not_specified_using_0: diag(6088, ts.DiagnosticCategory.Message, "Module_resolution_kind_is_not_specified_using_0_6088", "Module resolution kind is not specified, using '{0}'."), Module_name_0_was_successfully_resolved_to_1: diag(6089, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_6089", "======== Module name '{0}' was successfully resolved to '{1}'. ========"), Module_name_0_was_not_resolved: diag(6090, ts.DiagnosticCategory.Message, "Module_name_0_was_not_resolved_6090", "======== Module name '{0}' was not resolved. ========"), paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: diag(6091, ts.DiagnosticCategory.Message, "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", "'paths' option is specified, looking for a pattern to match module name '{0}'."), Module_name_0_matched_pattern_1: diag(6092, ts.DiagnosticCategory.Message, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."), Trying_substitution_0_candidate_module_location_Colon_1: diag(6093, ts.DiagnosticCategory.Message, "Trying_substitution_0_candidate_module_location_Colon_1_6093", "Trying substitution '{0}', candidate module location: '{1}'."), Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, ts.DiagnosticCategory.Message, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."), Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: diag(6095, ts.DiagnosticCategory.Message, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", "Loading module as file / folder, candidate module location '{0}', target file type '{1}'."), File_0_does_not_exist: diag(6096, ts.DiagnosticCategory.Message, "File_0_does_not_exist_6096", "File '{0}' does not exist."), File_0_exist_use_it_as_a_name_resolution_result: diag(6097, ts.DiagnosticCategory.Message, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."), Loading_module_0_from_node_modules_folder_target_file_type_1: diag(6098, ts.DiagnosticCategory.Message, "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", "Loading module '{0}' from 'node_modules' folder, target file type '{1}'."), Found_package_json_at_0: diag(6099, ts.DiagnosticCategory.Message, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."), package_json_does_not_have_a_0_field: diag(6100, ts.DiagnosticCategory.Message, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."), package_json_has_0_field_1_that_references_2: diag(6101, ts.DiagnosticCategory.Message, "package_json_has_0_field_1_that_references_2_6101", "'package.json' has '{0}' field '{1}' that references '{2}'."), Allow_javascript_files_to_be_compiled: diag(6102, ts.DiagnosticCategory.Message, "Allow_javascript_files_to_be_compiled_6102", "Allow javascript files to be compiled."), Option_0_should_have_array_of_strings_as_a_value: diag(6103, ts.DiagnosticCategory.Error, "Option_0_should_have_array_of_strings_as_a_value_6103", "Option '{0}' should have array of strings as a value."), Checking_if_0_is_the_longest_matching_prefix_for_1_2: diag(6104, ts.DiagnosticCategory.Message, "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'."), Expected_type_of_0_field_in_package_json_to_be_string_got_1: diag(6105, ts.DiagnosticCategory.Message, "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'."), baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: diag(6106, ts.DiagnosticCategory.Message, "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'."), rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: diag(6107, ts.DiagnosticCategory.Message, "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", "'rootDirs' option is set, using it to resolve relative module name '{0}'."), Longest_matching_prefix_for_0_is_1: diag(6108, ts.DiagnosticCategory.Message, "Longest_matching_prefix_for_0_is_1_6108", "Longest matching prefix for '{0}' is '{1}'."), Loading_0_from_the_root_dir_1_candidate_location_2: diag(6109, ts.DiagnosticCategory.Message, "Loading_0_from_the_root_dir_1_candidate_location_2_6109", "Loading '{0}' from the root dir '{1}', candidate location '{2}'."), Trying_other_entries_in_rootDirs: diag(6110, ts.DiagnosticCategory.Message, "Trying_other_entries_in_rootDirs_6110", "Trying other entries in 'rootDirs'."), Module_resolution_using_rootDirs_has_failed: diag(6111, ts.DiagnosticCategory.Message, "Module_resolution_using_rootDirs_has_failed_6111", "Module resolution using 'rootDirs' has failed."), Do_not_emit_use_strict_directives_in_module_output: diag(6112, ts.DiagnosticCategory.Message, "Do_not_emit_use_strict_directives_in_module_output_6112", "Do not emit 'use strict' directives in module output."), Enable_strict_null_checks: diag(6113, ts.DiagnosticCategory.Message, "Enable_strict_null_checks_6113", "Enable strict null checks."), Unknown_option_excludes_Did_you_mean_exclude: diag(6114, ts.DiagnosticCategory.Error, "Unknown_option_excludes_Did_you_mean_exclude_6114", "Unknown option 'excludes'. Did you mean 'exclude'?"), Raise_error_on_this_expressions_with_an_implied_any_type: diag(6115, ts.DiagnosticCategory.Message, "Raise_error_on_this_expressions_with_an_implied_any_type_6115", "Raise error on 'this' expressions with an implied 'any' type."), Resolving_type_reference_directive_0_containing_file_1_root_directory_2: diag(6116, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========"), Resolving_using_primary_search_paths: diag(6117, ts.DiagnosticCategory.Message, "Resolving_using_primary_search_paths_6117", "Resolving using primary search paths..."), Resolving_from_node_modules_folder: diag(6118, ts.DiagnosticCategory.Message, "Resolving_from_node_modules_folder_6118", "Resolving from node_modules folder..."), Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: diag(6119, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========"), Type_reference_directive_0_was_not_resolved: diag(6120, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_not_resolved_6120", "======== Type reference directive '{0}' was not resolved. ========"), Resolving_with_primary_search_path_0: diag(6121, ts.DiagnosticCategory.Message, "Resolving_with_primary_search_path_0_6121", "Resolving with primary search path '{0}'."), Root_directory_cannot_be_determined_skipping_primary_search_paths: diag(6122, ts.DiagnosticCategory.Message, "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", "Root directory cannot be determined, skipping primary search paths."), Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: diag(6123, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========"), Type_declaration_files_to_be_included_in_compilation: diag(6124, ts.DiagnosticCategory.Message, "Type_declaration_files_to_be_included_in_compilation_6124", "Type declaration files to be included in compilation."), Looking_up_in_node_modules_folder_initial_location_0: diag(6125, ts.DiagnosticCategory.Message, "Looking_up_in_node_modules_folder_initial_location_0_6125", "Looking up in 'node_modules' folder, initial location '{0}'."), Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: diag(6126, ts.DiagnosticCategory.Message, "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."), Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: diag(6127, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========"), Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: diag(6128, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========"), Resolving_real_path_for_0_result_1: diag(6130, ts.DiagnosticCategory.Message, "Resolving_real_path_for_0_result_1_6130", "Resolving real path for '{0}', result '{1}'."), Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: diag(6131, ts.DiagnosticCategory.Error, "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."), File_name_0_has_a_1_extension_stripping_it: diag(6132, ts.DiagnosticCategory.Message, "File_name_0_has_a_1_extension_stripping_it_6132", "File name '{0}' has a '{1}' extension - stripping it."), _0_is_declared_but_its_value_is_never_read: diag(6133, ts.DiagnosticCategory.Error, "_0_is_declared_but_its_value_is_never_read_6133", "'{0}' is declared but its value is never read.", !0), Report_errors_on_unused_locals: diag(6134, ts.DiagnosticCategory.Message, "Report_errors_on_unused_locals_6134", "Report errors on unused locals."), Report_errors_on_unused_parameters: diag(6135, ts.DiagnosticCategory.Message, "Report_errors_on_unused_parameters_6135", "Report errors on unused parameters."), The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: diag(6136, ts.DiagnosticCategory.Message, "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", "The maximum dependency depth to search under node_modules and load JavaScript files."), Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1: diag(6137, ts.DiagnosticCategory.Error, "Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137", "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."), Property_0_is_declared_but_its_value_is_never_read: diag(6138, ts.DiagnosticCategory.Error, "Property_0_is_declared_but_its_value_is_never_read_6138", "Property '{0}' is declared but its value is never read.", !0), Import_emit_helpers_from_tslib: diag(6139, ts.DiagnosticCategory.Message, "Import_emit_helpers_from_tslib_6139", "Import emit helpers from 'tslib'."), Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: diag(6140, ts.DiagnosticCategory.Error, "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."), Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, ts.DiagnosticCategory.Message, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", 'Parse in strict mode and emit "use strict" for each source file.'), Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, ts.DiagnosticCategory.Error, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."), Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, ts.DiagnosticCategory.Message, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."), Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, ts.DiagnosticCategory.Message, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."), Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, ts.DiagnosticCategory.Message, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."), Resolution_for_module_0_was_found_in_cache_from_location_1: diag(6147, ts.DiagnosticCategory.Message, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."), Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, ts.DiagnosticCategory.Message, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."), Show_diagnostic_information: diag(6149, ts.DiagnosticCategory.Message, "Show_diagnostic_information_6149", "Show diagnostic information."), Show_verbose_diagnostic_information: diag(6150, ts.DiagnosticCategory.Message, "Show_verbose_diagnostic_information_6150", "Show verbose diagnostic information."), Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: diag(6151, ts.DiagnosticCategory.Message, "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", "Emit a single file with source maps instead of having a separate file."), Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: diag(6152, ts.DiagnosticCategory.Message, "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set."), Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: diag(6153, ts.DiagnosticCategory.Message, "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", "Transpile each file as a separate module (similar to 'ts.transpileModule')."), Print_names_of_generated_files_part_of_the_compilation: diag(6154, ts.DiagnosticCategory.Message, "Print_names_of_generated_files_part_of_the_compilation_6154", "Print names of generated files part of the compilation."), Print_names_of_files_part_of_the_compilation: diag(6155, ts.DiagnosticCategory.Message, "Print_names_of_files_part_of_the_compilation_6155", "Print names of files part of the compilation."), The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: diag(6156, ts.DiagnosticCategory.Message, "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", "The locale used when displaying messages to the user (e.g. 'en-us')"), Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: diag(6157, ts.DiagnosticCategory.Message, "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", "Do not generate custom helper functions like '__extends' in compiled output."), Do_not_include_the_default_library_file_lib_d_ts: diag(6158, ts.DiagnosticCategory.Message, "Do_not_include_the_default_library_file_lib_d_ts_6158", "Do not include the default library file (lib.d.ts)."), Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: diag(6159, ts.DiagnosticCategory.Message, "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", "Do not add triple-slash references or imported modules to the list of compiled files."), Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: diag(6160, ts.DiagnosticCategory.Message, "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files."), List_of_folders_to_include_type_definitions_from: diag(6161, ts.DiagnosticCategory.Message, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."), Disable_size_limitations_on_JavaScript_projects: diag(6162, ts.DiagnosticCategory.Message, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."), The_character_set_of_the_input_files: diag(6163, ts.DiagnosticCategory.Message, "The_character_set_of_the_input_files_6163", "The character set of the input files."), Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: diag(6164, ts.DiagnosticCategory.Message, "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."), Do_not_truncate_error_messages: diag(6165, ts.DiagnosticCategory.Message, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."), Output_directory_for_generated_declaration_files: diag(6166, ts.DiagnosticCategory.Message, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."), A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: diag(6167, ts.DiagnosticCategory.Message, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."), List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: diag(6168, ts.DiagnosticCategory.Message, "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", "List of root folders whose combined content represents the structure of the project at runtime."), Show_all_compiler_options: diag(6169, ts.DiagnosticCategory.Message, "Show_all_compiler_options_6169", "Show all compiler options."), Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: diag(6170, ts.DiagnosticCategory.Message, "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file"), Command_line_Options: diag(6171, ts.DiagnosticCategory.Message, "Command_line_Options_6171", "Command-line Options"), Basic_Options: diag(6172, ts.DiagnosticCategory.Message, "Basic_Options_6172", "Basic Options"), Strict_Type_Checking_Options: diag(6173, ts.DiagnosticCategory.Message, "Strict_Type_Checking_Options_6173", "Strict Type-Checking Options"), Module_Resolution_Options: diag(6174, ts.DiagnosticCategory.Message, "Module_Resolution_Options_6174", "Module Resolution Options"), Source_Map_Options: diag(6175, ts.DiagnosticCategory.Message, "Source_Map_Options_6175", "Source Map Options"), Additional_Checks: diag(6176, ts.DiagnosticCategory.Message, "Additional_Checks_6176", "Additional Checks"), Experimental_Options: diag(6177, ts.DiagnosticCategory.Message, "Experimental_Options_6177", "Experimental Options"), Advanced_Options: diag(6178, ts.DiagnosticCategory.Message, "Advanced_Options_6178", "Advanced Options"), Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: diag(6179, ts.DiagnosticCategory.Message, "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'."), Enable_all_strict_type_checking_options: diag(6180, ts.DiagnosticCategory.Message, "Enable_all_strict_type_checking_options_6180", "Enable all strict type-checking options."), List_of_language_service_plugins: diag(6181, ts.DiagnosticCategory.Message, "List_of_language_service_plugins_6181", "List of language service plugins."), Scoped_package_detected_looking_in_0: diag(6182, ts.DiagnosticCategory.Message, "Scoped_package_detected_looking_in_0_6182", "Scoped package detected, looking in '{0}'"), Reusing_resolution_of_module_0_to_file_1_from_old_program: diag(6183, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183", "Reusing resolution of module '{0}' to file '{1}' from old program."), Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program: diag(6184, ts.DiagnosticCategory.Message, "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184", "Reusing module resolutions originating in '{0}' since resolutions are unchanged from old program."), Disable_strict_checking_of_generic_signatures_in_function_types: diag(6185, ts.DiagnosticCategory.Message, "Disable_strict_checking_of_generic_signatures_in_function_types_6185", "Disable strict checking of generic signatures in function types."), Enable_strict_checking_of_function_types: diag(6186, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_function_types_6186", "Enable strict checking of function types."), Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."), Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."), Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."), Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."), Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."), All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", !0), Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."), Found_0_errors_Watching_for_file_changes: diag(6194, ts.DiagnosticCategory.Message, "Found_0_errors_Watching_for_file_changes_6194", "Found {0} errors. Watching for file changes."), Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols: diag(6195, ts.DiagnosticCategory.Message, "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195", "Resolve 'keyof' to string valued property names only (no numbers or symbols)."), _0_is_declared_but_never_used: diag(6196, ts.DiagnosticCategory.Error, "_0_is_declared_but_never_used_6196", "'{0}' is declared but never used.", !0), Include_modules_imported_with_json_extension: diag(6197, ts.DiagnosticCategory.Message, "Include_modules_imported_with_json_extension_6197", "Include modules imported with '.json' extension"), All_destructured_elements_are_unused: diag(6198, ts.DiagnosticCategory.Error, "All_destructured_elements_are_unused_6198", "All destructured elements are unused.", !0), All_variables_are_unused: diag(6199, ts.DiagnosticCategory.Error, "All_variables_are_unused_6199", "All variables are unused.", !0), Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"), Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"), Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"), Composite_projects_may_not_disable_declaration_emit: diag(6304, ts.DiagnosticCategory.Error, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."), Output_file_0_has_not_been_built_from_source_file_1: diag(6305, ts.DiagnosticCategory.Error, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."), Referenced_project_0_must_have_setting_composite_Colon_true: diag(6306, ts.DiagnosticCategory.Error, "Referenced_project_0_must_have_setting_composite_Colon_true_6306", "Referenced project '{0}' must have setting \"composite\": true."), File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern: diag(6307, ts.DiagnosticCategory.Error, "File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern_6307", "File '{0}' is not in project file list. Projects must list all files or use an 'include' pattern."), Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"), Output_file_0_from_project_1_does_not_exist: diag(6309, ts.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"), Variable_0_implicitly_has_an_1_type: diag(7005, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."), Parameter_0_implicitly_has_an_1_type: diag(7006, ts.DiagnosticCategory.Error, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."), Member_0_implicitly_has_an_1_type: diag(7008, ts.DiagnosticCategory.Error, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."), new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, ts.DiagnosticCategory.Error, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."), _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, ts.DiagnosticCategory.Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."), Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, ts.DiagnosticCategory.Error, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."), Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, ts.DiagnosticCategory.Error, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."), Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."), Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: diag(7016, ts.DiagnosticCategory.Error, "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type."), Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: diag(7017, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", "Element implicitly has an 'any' type because type '{0}' has no index signature."), Object_literal_s_property_0_implicitly_has_an_1_type: diag(7018, ts.DiagnosticCategory.Error, "Object_literal_s_property_0_implicitly_has_an_1_type_7018", "Object literal's property '{0}' implicitly has an '{1}' type."), Rest_parameter_0_implicitly_has_an_any_type: diag(7019, ts.DiagnosticCategory.Error, "Rest_parameter_0_implicitly_has_an_any_type_7019", "Rest parameter '{0}' implicitly has an 'any[]' type."), Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7020, ts.DiagnosticCategory.Error, "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", "Call signature, which lacks return-type annotation, implicitly has an 'any' return type."), _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: diag(7022, ts.DiagnosticCategory.Error, "_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022", "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."), _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: diag(7023, ts.DiagnosticCategory.Error, "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."), Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: diag(7024, ts.DiagnosticCategory.Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."), Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: diag(7025, ts.DiagnosticCategory.Error, "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type."), JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: diag(7026, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."), Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected.", !0), Unused_label: diag(7028, ts.DiagnosticCategory.Error, "Unused_label_7028", "Unused label.", !0), Fallthrough_case_in_switch: diag(7029, ts.DiagnosticCategory.Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."), Not_all_code_paths_return_a_value: diag(7030, ts.DiagnosticCategory.Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."), Binding_element_0_implicitly_has_an_1_type: diag(7031, ts.DiagnosticCategory.Error, "Binding_element_0_implicitly_has_an_1_type_7031", "Binding element '{0}' implicitly has an '{1}' type."), Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: diag(7032, ts.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation."), Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: diag(7033, ts.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation."), Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: diag(7034, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined."), Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: diag(7035, ts.DiagnosticCategory.Error, "Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_mod_7035", "Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"), Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: diag(7036, ts.DiagnosticCategory.Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."), Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports: diag(7037, ts.DiagnosticCategory.Message, "Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037", "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."), A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime: diag(7038, ts.DiagnosticCategory.Error, "A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038", "A namespace-style import cannot be called or constructed, and will cause a failure at runtime."), Mapped_object_type_implicitly_has_an_any_template_type: diag(7039, ts.DiagnosticCategory.Error, "Mapped_object_type_implicitly_has_an_any_template_type_7039", "Mapped object type implicitly has an 'any' template type."), You_cannot_rename_this_element: diag(8e3, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."), You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."), import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."), export_can_only_be_used_in_a_ts_file: diag(8003, ts.DiagnosticCategory.Error, "export_can_only_be_used_in_a_ts_file_8003", "'export=' can only be used in a .ts file."), type_parameter_declarations_can_only_be_used_in_a_ts_file: diag(8004, ts.DiagnosticCategory.Error, "type_parameter_declarations_can_only_be_used_in_a_ts_file_8004", "'type parameter declarations' can only be used in a .ts file."), implements_clauses_can_only_be_used_in_a_ts_file: diag(8005, ts.DiagnosticCategory.Error, "implements_clauses_can_only_be_used_in_a_ts_file_8005", "'implements clauses' can only be used in a .ts file."), interface_declarations_can_only_be_used_in_a_ts_file: diag(8006, ts.DiagnosticCategory.Error, "interface_declarations_can_only_be_used_in_a_ts_file_8006", "'interface declarations' can only be used in a .ts file."), module_declarations_can_only_be_used_in_a_ts_file: diag(8007, ts.DiagnosticCategory.Error, "module_declarations_can_only_be_used_in_a_ts_file_8007", "'module declarations' can only be used in a .ts file."), type_aliases_can_only_be_used_in_a_ts_file: diag(8008, ts.DiagnosticCategory.Error, "type_aliases_can_only_be_used_in_a_ts_file_8008", "'type aliases' can only be used in a .ts file."), _0_can_only_be_used_in_a_ts_file: diag(8009, ts.DiagnosticCategory.Error, "_0_can_only_be_used_in_a_ts_file_8009", "'{0}' can only be used in a .ts file."), types_can_only_be_used_in_a_ts_file: diag(8010, ts.DiagnosticCategory.Error, "types_can_only_be_used_in_a_ts_file_8010", "'types' can only be used in a .ts file."), type_arguments_can_only_be_used_in_a_ts_file: diag(8011, ts.DiagnosticCategory.Error, "type_arguments_can_only_be_used_in_a_ts_file_8011", "'type arguments' can only be used in a .ts file."), parameter_modifiers_can_only_be_used_in_a_ts_file: diag(8012, ts.DiagnosticCategory.Error, "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", "'parameter modifiers' can only be used in a .ts file."), non_null_assertions_can_only_be_used_in_a_ts_file: diag(8013, ts.DiagnosticCategory.Error, "non_null_assertions_can_only_be_used_in_a_ts_file_8013", "'non-null assertions' can only be used in a .ts file."), enum_declarations_can_only_be_used_in_a_ts_file: diag(8015, ts.DiagnosticCategory.Error, "enum_declarations_can_only_be_used_in_a_ts_file_8015", "'enum declarations' can only be used in a .ts file."), type_assertion_expressions_can_only_be_used_in_a_ts_file: diag(8016, ts.DiagnosticCategory.Error, "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", "'type assertion expressions' can only be used in a .ts file."), Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: diag(8017, ts.DiagnosticCategory.Error, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."), Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: diag(8018, ts.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."), Report_errors_in_js_files: diag(8019, ts.DiagnosticCategory.Message, "Report_errors_in_js_files_8019", "Report errors in .js files."), JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, ts.DiagnosticCategory.Error, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."), JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, ts.DiagnosticCategory.Error, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."), JSDoc_0_is_not_attached_to_a_class: diag(8022, ts.DiagnosticCategory.Error, "JSDoc_0_is_not_attached_to_a_class_8022", "JSDoc '@{0}' is not attached to a class."), JSDoc_0_1_does_not_match_the_extends_2_clause: diag(8023, ts.DiagnosticCategory.Error, "JSDoc_0_1_does_not_match_the_extends_2_clause_8023", "JSDoc '@{0} {1}' does not match the 'extends {2}' clause."), JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name: diag(8024, ts.DiagnosticCategory.Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name."), Class_declarations_cannot_have_more_than_one_augments_or_extends_tag: diag(8025, ts.DiagnosticCategory.Error, "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025", "Class declarations cannot have more than one `@augments` or `@extends` tag."), Expected_0_type_arguments_provide_these_with_an_extends_tag: diag(8026, ts.DiagnosticCategory.Error, "Expected_0_type_arguments_provide_these_with_an_extends_tag_8026", "Expected {0} type arguments; provide these with an '@extends' tag."), Expected_0_1_type_arguments_provide_these_with_an_extends_tag: diag(8027, ts.DiagnosticCategory.Error, "Expected_0_1_type_arguments_provide_these_with_an_extends_tag_8027", "Expected {0}-{1} type arguments; provide these with an '@extends' tag."), JSDoc_may_only_appear_in_the_last_parameter_of_a_signature: diag(8028, ts.DiagnosticCategory.Error, "JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028", "JSDoc '...' may only appear in the last parameter of a signature."), JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type: diag(8029, ts.DiagnosticCategory.Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type."), Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: diag(9002, ts.DiagnosticCategory.Error, "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause."), class_expressions_are_not_currently_supported: diag(9003, ts.DiagnosticCategory.Error, "class_expressions_are_not_currently_supported_9003", "'class' expressions are not currently supported."), Language_service_is_disabled: diag(9004, ts.DiagnosticCategory.Error, "Language_service_is_disabled_9004", "Language service is disabled."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, ts.DiagnosticCategory.Error, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."), Expected_corresponding_JSX_closing_tag_for_0: diag(17002, ts.DiagnosticCategory.Error, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."), JSX_attribute_expected: diag(17003, ts.DiagnosticCategory.Error, "JSX_attribute_expected_17003", "JSX attribute expected."), Cannot_use_JSX_unless_the_jsx_flag_is_provided: diag(17004, ts.DiagnosticCategory.Error, "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", "Cannot use JSX unless the '--jsx' flag is provided."), A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: diag(17005, ts.DiagnosticCategory.Error, "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", "A constructor cannot contain a 'super' call when its class extends 'null'."), An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: diag(17006, ts.DiagnosticCategory.Error, "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."), A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: diag(17007, ts.DiagnosticCategory.Error, "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."), JSX_element_0_has_no_corresponding_closing_tag: diag(17008, ts.DiagnosticCategory.Error, "JSX_element_0_has_no_corresponding_closing_tag_17008", "JSX element '{0}' has no corresponding closing tag."), super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: diag(17009, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", "'super' must be called before accessing 'this' in the constructor of a derived class."), Unknown_type_acquisition_option_0: diag(17010, ts.DiagnosticCategory.Error, "Unknown_type_acquisition_option_0_17010", "Unknown type acquisition option '{0}'."), super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), JSX_fragment_is_not_supported_when_using_jsxFactory: diag(17016, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_jsxFactory_17016", "JSX fragment is not supported when using --jsxFactory"), JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma: diag(17017, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma_17017", "JSX fragment is not supported when using an inline JSX factory pragma"), Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, ts.DiagnosticCategory.Error, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."), File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module: diag(80001, ts.DiagnosticCategory.Suggestion, "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module_80001", "File is a CommonJS module; it may be converted to an ES6 module."), This_constructor_function_may_be_converted_to_a_class_declaration: diag(80002, ts.DiagnosticCategory.Suggestion, "This_constructor_function_may_be_converted_to_a_class_declaration_80002", "This constructor function may be converted to a class declaration."), Import_may_be_converted_to_a_default_import: diag(80003, ts.DiagnosticCategory.Suggestion, "Import_may_be_converted_to_a_default_import_80003", "Import may be converted to a default import."), JSDoc_types_may_be_moved_to_TypeScript_types: diag(80004, ts.DiagnosticCategory.Suggestion, "JSDoc_types_may_be_moved_to_TypeScript_types_80004", "JSDoc types may be moved to TypeScript types."), require_call_may_be_converted_to_an_import: diag(80005, ts.DiagnosticCategory.Suggestion, "require_call_may_be_converted_to_an_import_80005", "'require' call may be converted to an import."), Add_missing_super_call: diag(90001, ts.DiagnosticCategory.Message, "Add_missing_super_call_90001", "Add missing 'super()' call"), Make_super_call_the_first_statement_in_the_constructor: diag(90002, ts.DiagnosticCategory.Message, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"), Change_extends_to_implements: diag(90003, ts.DiagnosticCategory.Message, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"), Remove_declaration_for_Colon_0: diag(90004, ts.DiagnosticCategory.Message, "Remove_declaration_for_Colon_0_90004", "Remove declaration for: '{0}'"), Remove_import_from_0: diag(90005, ts.DiagnosticCategory.Message, "Remove_import_from_0_90005", "Remove import from '{0}'"), Implement_interface_0: diag(90006, ts.DiagnosticCategory.Message, "Implement_interface_0_90006", "Implement interface '{0}'"), Implement_inherited_abstract_class: diag(90007, ts.DiagnosticCategory.Message, "Implement_inherited_abstract_class_90007", "Implement inherited abstract class"), Add_0_to_unresolved_variable: diag(90008, ts.DiagnosticCategory.Message, "Add_0_to_unresolved_variable_90008", "Add '{0}.' to unresolved variable"), Remove_destructuring: diag(90009, ts.DiagnosticCategory.Message, "Remove_destructuring_90009", "Remove destructuring"), Remove_variable_statement: diag(90010, ts.DiagnosticCategory.Message, "Remove_variable_statement_90010", "Remove variable statement"), Import_0_from_module_1: diag(90013, ts.DiagnosticCategory.Message, "Import_0_from_module_1_90013", "Import '{0}' from module \"{1}\""), Change_0_to_1: diag(90014, ts.DiagnosticCategory.Message, "Change_0_to_1_90014", "Change '{0}' to '{1}'"), Add_0_to_existing_import_declaration_from_1: diag(90015, ts.DiagnosticCategory.Message, "Add_0_to_existing_import_declaration_from_1_90015", "Add '{0}' to existing import declaration from \"{1}\""), Declare_property_0: diag(90016, ts.DiagnosticCategory.Message, "Declare_property_0_90016", "Declare property '{0}'"), Add_index_signature_for_property_0: diag(90017, ts.DiagnosticCategory.Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'"), Disable_checking_for_this_file: diag(90018, ts.DiagnosticCategory.Message, "Disable_checking_for_this_file_90018", "Disable checking for this file"), Ignore_this_error_message: diag(90019, ts.DiagnosticCategory.Message, "Ignore_this_error_message_90019", "Ignore this error message"), Initialize_property_0_in_the_constructor: diag(90020, ts.DiagnosticCategory.Message, "Initialize_property_0_in_the_constructor_90020", "Initialize property '{0}' in the constructor"), Initialize_static_property_0: diag(90021, ts.DiagnosticCategory.Message, "Initialize_static_property_0_90021", "Initialize static property '{0}'"), Change_spelling_to_0: diag(90022, ts.DiagnosticCategory.Message, "Change_spelling_to_0_90022", "Change spelling to '{0}'"), Declare_method_0: diag(90023, ts.DiagnosticCategory.Message, "Declare_method_0_90023", "Declare method '{0}'"), Declare_static_method_0: diag(90024, ts.DiagnosticCategory.Message, "Declare_static_method_0_90024", "Declare static method '{0}'"), Prefix_0_with_an_underscore: diag(90025, ts.DiagnosticCategory.Message, "Prefix_0_with_an_underscore_90025", "Prefix '{0}' with an underscore"), Rewrite_as_the_indexed_access_type_0: diag(90026, ts.DiagnosticCategory.Message, "Rewrite_as_the_indexed_access_type_0_90026", "Rewrite as the indexed access type '{0}'"), Declare_static_property_0: diag(90027, ts.DiagnosticCategory.Message, "Declare_static_property_0_90027", "Declare static property '{0}'"), Call_decorator_expression: diag(90028, ts.DiagnosticCategory.Message, "Call_decorator_expression_90028", "Call decorator expression"), Add_async_modifier_to_containing_function: diag(90029, ts.DiagnosticCategory.Message, "Add_async_modifier_to_containing_function_90029", "Add async modifier to containing function"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_function_0_to_class: diag(95002, ts.DiagnosticCategory.Message, "Convert_function_0_to_class_95002", "Convert function '{0}' to class"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), Extract_function: diag(95005, ts.DiagnosticCategory.Message, "Extract_function_95005", "Extract function"), Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), Annotate_with_types_from_JSDoc: diag(95010, ts.DiagnosticCategory.Message, "Annotate_with_types_from_JSDoc_95010", "Annotate with types from JSDoc"), Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage"), Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage"), Convert_to_default_import: diag(95013, ts.DiagnosticCategory.Message, "Convert_to_default_import_95013", "Convert to default import"), Install_0: diag(95014, ts.DiagnosticCategory.Message, "Install_0_95014", "Install '{0}'"), Replace_import_with_0: diag(95015, ts.DiagnosticCategory.Message, "Replace_import_with_0_95015", "Replace import with '{0}'."), Use_synthetic_default_member: diag(95016, ts.DiagnosticCategory.Message, "Use_synthetic_default_member_95016", "Use synthetic 'default' member."), Convert_to_ES6_module: diag(95017, ts.DiagnosticCategory.Message, "Convert_to_ES6_module_95017", "Convert to ES6 module"), Add_undefined_type_to_property_0: diag(95018, ts.DiagnosticCategory.Message, "Add_undefined_type_to_property_0_95018", "Add 'undefined' type to property '{0}'"), Add_initializer_to_property_0: diag(95019, ts.DiagnosticCategory.Message, "Add_initializer_to_property_0_95019", "Add initializer to property '{0}'"), Add_definite_assignment_assertion_to_property_0: diag(95020, ts.DiagnosticCategory.Message, "Add_definite_assignment_assertion_to_property_0_95020", "Add definite assignment assertion to property '{0}'"), Add_all_missing_members: diag(95022, ts.DiagnosticCategory.Message, "Add_all_missing_members_95022", "Add all missing members"), Infer_all_types_from_usage: diag(95023, ts.DiagnosticCategory.Message, "Infer_all_types_from_usage_95023", "Infer all types from usage"), Delete_all_unused_declarations: diag(95024, ts.DiagnosticCategory.Message, "Delete_all_unused_declarations_95024", "Delete all unused declarations"), Prefix_all_unused_declarations_with_where_possible: diag(95025, ts.DiagnosticCategory.Message, "Prefix_all_unused_declarations_with_where_possible_95025", "Prefix all unused declarations with '_' where possible"), Fix_all_detected_spelling_errors: diag(95026, ts.DiagnosticCategory.Message, "Fix_all_detected_spelling_errors_95026", "Fix all detected spelling errors"), Add_initializers_to_all_uninitialized_properties: diag(95027, ts.DiagnosticCategory.Message, "Add_initializers_to_all_uninitialized_properties_95027", "Add initializers to all uninitialized properties"), Add_definite_assignment_assertions_to_all_uninitialized_properties: diag(95028, ts.DiagnosticCategory.Message, "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028", "Add definite assignment assertions to all uninitialized properties"), Add_undefined_type_to_all_uninitialized_properties: diag(95029, ts.DiagnosticCategory.Message, "Add_undefined_type_to_all_uninitialized_properties_95029", "Add undefined type to all uninitialized properties"), Change_all_jsdoc_style_types_to_TypeScript: diag(95030, ts.DiagnosticCategory.Message, "Change_all_jsdoc_style_types_to_TypeScript_95030", "Change all jsdoc-style types to TypeScript"), Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types: diag(95031, ts.DiagnosticCategory.Message, "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031", "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)"), Implement_all_unimplemented_interfaces: diag(95032, ts.DiagnosticCategory.Message, "Implement_all_unimplemented_interfaces_95032", "Implement all unimplemented interfaces"), Install_all_missing_types_packages: diag(95033, ts.DiagnosticCategory.Message, "Install_all_missing_types_packages_95033", "Install all missing types packages"), Rewrite_all_as_indexed_access_types: diag(95034, ts.DiagnosticCategory.Message, "Rewrite_all_as_indexed_access_types_95034", "Rewrite all as indexed access types"), Convert_all_to_default_imports: diag(95035, ts.DiagnosticCategory.Message, "Convert_all_to_default_imports_95035", "Convert all to default imports"), Make_all_super_calls_the_first_statement_in_their_constructor: diag(95036, ts.DiagnosticCategory.Message, "Make_all_super_calls_the_first_statement_in_their_constructor_95036", "Make all 'super()' calls the first statement in their constructor"), Add_qualifier_to_all_unresolved_variables_matching_a_member_name: diag(95037, ts.DiagnosticCategory.Message, "Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037", "Add qualifier to all unresolved variables matching a member name"), Change_all_extended_interfaces_to_implements: diag(95038, ts.DiagnosticCategory.Message, "Change_all_extended_interfaces_to_implements_95038", "Change all extended interfaces to 'implements'"), Add_all_missing_super_calls: diag(95039, ts.DiagnosticCategory.Message, "Add_all_missing_super_calls_95039", "Add all missing super calls"), Implement_all_inherited_abstract_classes: diag(95040, ts.DiagnosticCategory.Message, "Implement_all_inherited_abstract_classes_95040", "Implement all inherited abstract classes"), Add_all_missing_async_modifiers: diag(95041, ts.DiagnosticCategory.Message, "Add_all_missing_async_modifiers_95041", "Add all missing 'async' modifiers"), Add_ts_ignore_to_all_error_messages: diag(95042, ts.DiagnosticCategory.Message, "Add_ts_ignore_to_all_error_messages_95042", "Add '@ts-ignore' to all error messages"), Annotate_everything_with_types_from_JSDoc: diag(95043, ts.DiagnosticCategory.Message, "Annotate_everything_with_types_from_JSDoc_95043", "Annotate everything with types from JSDoc"), Add_to_all_uncalled_decorators: diag(95044, ts.DiagnosticCategory.Message, "Add_to_all_uncalled_decorators_95044", "Add '()' to all uncalled decorators"), Convert_all_constructor_functions_to_classes: diag(95045, ts.DiagnosticCategory.Message, "Convert_all_constructor_functions_to_classes_95045", "Convert all constructor functions to classes"), Generate_get_and_set_accessors: diag(95046, ts.DiagnosticCategory.Message, "Generate_get_and_set_accessors_95046", "Generate 'get' and 'set' accessors"), Convert_require_to_import: diag(95047, ts.DiagnosticCategory.Message, "Convert_require_to_import_95047", "Convert 'require' to 'import'"), Convert_all_require_to_import: diag(95048, ts.DiagnosticCategory.Message, "Convert_all_require_to_import_95048", "Convert all 'require' to 'import'"), Move_to_a_new_file: diag(95049, ts.DiagnosticCategory.Message, "Move_to_a_new_file_95049", "Move to a new file"), Remove_unreachable_code: diag(95050, ts.DiagnosticCategory.Message, "Remove_unreachable_code_95050", "Remove unreachable code"), Remove_all_unreachable_code: diag(95051, ts.DiagnosticCategory.Message, "Remove_all_unreachable_code_95051", "Remove all unreachable code"), Add_missing_typeof: diag(95052, ts.DiagnosticCategory.Message, "Add_missing_typeof_95052", "Add missing 'typeof'"), Remove_unused_label: diag(95053, ts.DiagnosticCategory.Message, "Remove_unused_label_95053", "Remove unused label"), Remove_all_unused_labels: diag(95054, ts.DiagnosticCategory.Message, "Remove_all_unused_labels_95054", "Remove all unused labels") } }(ts || (ts = {})); var ts; !function (ts) { function tokenIsIdentifierOrKeyword(token) { return token >= 71 } function tokenIsIdentifierOrKeywordOrGreaterThan(token) { return 29 === token || tokenIsIdentifierOrKeyword(token) } function lookupInUnicodeMap(code, map) { if (code < map[0]) return !1; for (var mid, lo = 0, hi = map.length; lo + 1 < hi;) { if (mid = lo + (hi - lo) / 2, mid -= mid % 2, map[mid] <= code && code <= map[mid + 1]) return !0; code < map[mid] ? hi = mid : lo = mid + 2 } return !1 } function isUnicodeIdentifierStart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart) } function isUnicodeIdentifierPart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart) } function makeReverseMap(source) { var result = []; return source.forEach(function (value, name) { result[value] = name }), result } function tokenToString(t) { return tokenStrings[t] } function stringToToken(s) { return textToToken.get(s) } function computeLineStarts(text) { for (var result = new Array, pos = 0, lineStart = 0; pos < text.length;) { var ch = text.charCodeAt(pos); switch (pos++ , ch) { case 13: 10 === text.charCodeAt(pos) && pos++; case 10: result.push(lineStart), lineStart = pos; break; default: ch > 127 && isLineBreak(ch) && (result.push(lineStart), lineStart = pos) } } return result.push(lineStart), result } function getPositionOfLineAndCharacter(sourceFile, line, character) { return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character, sourceFile.text) } function computePositionOfLineAndCharacter(lineStarts, line, character, debugText) { (line < 0 || line >= lineStarts.length) && ts.Debug.fail("Bad line number. Line: " + line + ", lineStarts.length: " + lineStarts.length + " , line map is correct? " + (void 0 !== debugText ? ts.arraysEqual(lineStarts, computeLineStarts(debugText)) : "unknown")); var res = lineStarts[line] + character; return line < lineStarts.length - 1 ? ts.Debug.assert(res < lineStarts[line + 1]) : void 0 !== debugText && ts.Debug.assert(res <= debugText.length), res } function getLineStarts(sourceFile) { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)) } function computeLineAndCharacterOfPosition(lineStarts, position) { var lineNumber = ts.binarySearch(lineStarts, position, ts.identity, ts.compareValues); return lineNumber < 0 && (lineNumber = ~lineNumber - 1, ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file")), { line: lineNumber, character: position - lineStarts[lineNumber] } } function getLineAndCharacterOfPosition(sourceFile, position) { return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position) } function isWhiteSpaceLike(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch) } function isWhiteSpaceSingleLine(ch) { return 32 === ch || 9 === ch || 11 === ch || 12 === ch || 160 === ch || 133 === ch || 5760 === ch || ch >= 8192 && ch <= 8203 || 8239 === ch || 8287 === ch || 12288 === ch || 65279 === ch } function isLineBreak(ch) { return 10 === ch || 13 === ch || 8232 === ch || 8233 === ch } function isDigit(ch) { return ch >= 48 && ch <= 57 } function isOctalDigit(ch) { return ch >= 48 && ch <= 55 } function couldStartTrivia(text, pos) { var ch = text.charCodeAt(pos); switch (ch) { case 13: case 10: case 9: case 11: case 12: case 32: case 47: case 60: case 124: case 61: case 62: return !0; case 35: return 0 === pos; default: return ch > 127 } } function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) { if (void 0 === stopAtComments && (stopAtComments = !1), ts.positionIsSynthesized(pos)) return pos; for (; ;) { var ch = text.charCodeAt(pos); switch (ch) { case 13: 10 === text.charCodeAt(pos + 1) && pos++; case 10: if (pos++ , stopAfterLineBreak) return pos; continue; case 9: case 11: case 12: case 32: pos++; continue; case 47: if (stopAtComments) break; if (47 === text.charCodeAt(pos + 1)) { for (pos += 2; pos < text.length && !isLineBreak(text.charCodeAt(pos));)pos++; continue } if (42 === text.charCodeAt(pos + 1)) { for (pos += 2; pos < text.length;) { if (42 === text.charCodeAt(pos) && 47 === text.charCodeAt(pos + 1)) { pos += 2; break } pos++ } continue } break; case 60: case 124: case 61: case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos); continue } break; case 35: if (0 === pos && isShebangTrivia(text, pos)) { pos = scanShebangTrivia(text, pos); continue } break; default: if (ch > 127 && isWhiteSpaceLike(ch)) { pos++; continue } }return pos } } function isConflictMarkerTrivia(text, pos) { if (ts.Debug.assert(pos >= 0), 0 === pos || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if (pos + mergeConflictMarkerLength < text.length) { for (var i = 0; i < mergeConflictMarkerLength; i++)if (text.charCodeAt(pos + i) !== ch) return !1; return 61 === ch || 32 === text.charCodeAt(pos + mergeConflictMarkerLength) } } return !1 } function scanConflictMarkerTrivia(text, pos, error) { error && error(ts.Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength); var ch = text.charCodeAt(pos), len = text.length; if (60 === ch || 62 === ch) for (; pos < len && !isLineBreak(text.charCodeAt(pos));)pos++; else for (ts.Debug.assert(124 === ch || 61 === ch); pos < len;) { var currentChar = text.charCodeAt(pos); if ((61 === currentChar || 62 === currentChar) && currentChar !== ch && isConflictMarkerTrivia(text, pos)) break; pos++ } return pos } function isShebangTrivia(text, pos) { return ts.Debug.assert(0 === pos), shebangTriviaRegex.test(text) } function scanShebangTrivia(text, pos) { var shebang = shebangTriviaRegex.exec(text)[0]; return pos += shebang.length } function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) { var pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, hasPendingCommentRange = !1, collecting = trailing || 0 === pos, accumulator = initial; scan: for (; pos >= 0 && pos < text.length;) { var ch = text.charCodeAt(pos); switch (ch) { case 13: 10 === text.charCodeAt(pos + 1) && pos++; case 10: if (pos++ , trailing) break scan; collecting = !0, hasPendingCommentRange && (pendingHasTrailingNewLine = !0); continue; case 9: case 11: case 12: case 32: pos++; continue; case 47: var nextChar = text.charCodeAt(pos + 1), hasTrailingNewLine = !1; if (47 === nextChar || 42 === nextChar) { var kind = 47 === nextChar ? 2 : 3, startPos = pos; if (pos += 2, 47 === nextChar) for (; pos < text.length;) { if (isLineBreak(text.charCodeAt(pos))) { hasTrailingNewLine = !0; break } pos++ } else for (; pos < text.length;) { if (42 === text.charCodeAt(pos) && 47 === text.charCodeAt(pos + 1)) { pos += 2; break } pos++ } if (collecting) { if (hasPendingCommentRange && (accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator), !reduce && accumulator)) return accumulator; pendingPos = startPos, pendingEnd = pos, pendingKind = kind, pendingHasTrailingNewLine = hasTrailingNewLine, hasPendingCommentRange = !0 } continue } break scan; default: if (ch > 127 && isWhiteSpaceLike(ch)) { hasPendingCommentRange && isLineBreak(ch) && (pendingHasTrailingNewLine = !0), pos++; continue } break scan } } return hasPendingCommentRange && (accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator)), accumulator } function forEachLeadingCommentRange(text, pos, cb, state) { return iterateCommentRanges(!1, text, pos, !1, cb, state) } function forEachTrailingCommentRange(text, pos, cb, state) { return iterateCommentRanges(!1, text, pos, !0, cb, state) } function reduceEachLeadingCommentRange(text, pos, cb, state, initial) { return iterateCommentRanges(!0, text, pos, !1, cb, state, initial) } function reduceEachTrailingCommentRange(text, pos, cb, state, initial) { return iterateCommentRanges(!0, text, pos, !0, cb, state, initial) } function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) { return comments || (comments = []), comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }), comments } function getLeadingCommentRanges(text, pos) { return reduceEachLeadingCommentRange(text, pos, appendCommentRange, void 0, void 0) } function getTrailingCommentRanges(text, pos) { return reduceEachTrailingCommentRange(text, pos, appendCommentRange, void 0, void 0) } function getShebang(text) { var match = shebangTriviaRegex.exec(text); if (match) return match[0] } function isIdentifierStart(ch, languageVersion) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || 36 === ch || 95 === ch || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion) } function isIdentifierPart(ch, languageVersion) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || 36 === ch || 95 === ch || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion) } function isIdentifierText(name, languageVersion) { if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) return !1; for (var i = 1; i < name.length; i++)if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) return !1; return !0 } function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { function error(message, errPos, length) { if (void 0 === errPos && (errPos = pos), onError) { var oldPos = pos; pos = errPos, onError(message, length || 0), pos = oldPos } } function scanNumberFragment() { for (var start = pos, allowSeparator = !1, isPreviousTokenSeparator = !1, result = ""; ;) { var ch = text.charCodeAt(pos); if (95 !== ch) { if (!isDigit(ch)) break; allowSeparator = !0, isPreviousTokenSeparator = !1, pos++ } else tokenFlags |= 512, allowSeparator ? (allowSeparator = !1, isPreviousTokenSeparator = !0, result += text.substring(start, pos)) : isPreviousTokenSeparator ? error(ts.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1) : error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1), pos++ , start = pos } return 95 === text.charCodeAt(pos - 1) && error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1), result + text.substring(start, pos) } function scanNumber() { var decimalFragment, scientificFragment, start = pos, mainFragment = scanNumberFragment(); 46 === text.charCodeAt(pos) && (pos++ , decimalFragment = scanNumberFragment()); var end = pos; if (69 === text.charCodeAt(pos) || 101 === text.charCodeAt(pos)) { pos++ , tokenFlags |= 16, 43 !== text.charCodeAt(pos) && 45 !== text.charCodeAt(pos) || pos++; var preNumericPart = pos, finalFragment = scanNumberFragment(); finalFragment ? (scientificFragment = text.substring(end, preNumericPart) + finalFragment, end = pos) : error(ts.Diagnostics.Digit_expected) } if (512 & tokenFlags) { var result = mainFragment; return decimalFragment && (result += "." + decimalFragment), scientificFragment && (result += scientificFragment), "" + +result } return "" + +text.substring(start, end) } function scanOctalDigits() { for (var start = pos; isOctalDigit(text.charCodeAt(pos));)pos++; return +text.substring(start, pos) } function scanExactNumberOfHexDigits(count, canHaveSeparators) { return scanHexDigits(count, !1, canHaveSeparators) } function scanMinimumNumberOfHexDigits(count, canHaveSeparators) { return scanHexDigits(count, !0, canHaveSeparators) } function scanHexDigits(minCount, scanAsManyAsPossible, canHaveSeparators) { for (var digits = 0, value = 0, allowSeparator = !1, isPreviousTokenSeparator = !1; digits < minCount || scanAsManyAsPossible;) { var ch = text.charCodeAt(pos); if (canHaveSeparators && 95 === ch) tokenFlags |= 512, allowSeparator ? (allowSeparator = !1, isPreviousTokenSeparator = !0) : isPreviousTokenSeparator ? error(ts.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1) : error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1), pos++; else { if (allowSeparator = canHaveSeparators, ch >= 48 && ch <= 57) value = 16 * value + ch - 48; else if (ch >= 65 && ch <= 70) value = 16 * value + ch - 65 + 10; else { if (!(ch >= 97 && ch <= 102)) break; value = 16 * value + ch - 97 + 10 } pos++ , digits++ , isPreviousTokenSeparator = !1 } } return digits < minCount && (value = -1), 95 === text.charCodeAt(pos - 1) && error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1), value } function scanString(jsxAttributeString) { void 0 === jsxAttributeString && (jsxAttributeString = !1); var quote = text.charCodeAt(pos); pos++; for (var result = "", start = pos; ;) { if (pos >= end) { result += text.substring(start, pos), tokenFlags |= 4, error(ts.Diagnostics.Unterminated_string_literal); break } var ch = text.charCodeAt(pos); if (ch === quote) { result += text.substring(start, pos), pos++; break } if (92 !== ch || jsxAttributeString) { if (isLineBreak(ch) && !jsxAttributeString) { result += text.substring(start, pos), tokenFlags |= 4, error(ts.Diagnostics.Unterminated_string_literal); break } pos++ } else result += text.substring(start, pos), result += scanEscapeSequence(), start = pos } return result } function scanTemplateAndSetTokenValue() { var startedWithBacktick = 96 === text.charCodeAt(pos); pos++; for (var resultingToken, start = pos, contents = ""; ;) { if (pos >= end) { contents += text.substring(start, pos), tokenFlags |= 4, error(ts.Diagnostics.Unterminated_template_literal), resultingToken = startedWithBacktick ? 13 : 16; break } var currChar = text.charCodeAt(pos); if (96 === currChar) { contents += text.substring(start, pos), pos++ , resultingToken = startedWithBacktick ? 13 : 16; break } if (36 === currChar && pos + 1 < end && 123 === text.charCodeAt(pos + 1)) { contents += text.substring(start, pos), pos += 2, resultingToken = startedWithBacktick ? 14 : 15; break } 92 !== currChar ? 13 !== currChar ? pos++ : (contents += text.substring(start, pos), pos++ , pos < end && 10 === text.charCodeAt(pos) && pos++ , contents += "\n", start = pos) : (contents += text.substring(start, pos), contents += scanEscapeSequence(), start = pos) } return ts.Debug.assert(void 0 !== resultingToken), tokenValue = contents, resultingToken } function scanEscapeSequence() { if (pos++ , pos >= end) return error(ts.Diagnostics.Unexpected_end_of_text), ""; var ch = text.charCodeAt(pos); switch (pos++ , ch) { case 48: return "\0"; case 98: return "\b"; case 116: return "\t"; case 110: return "\n"; case 118: return "\v"; case 102: return "\f"; case 114: return "\r"; case 39: return "'"; case 34: return '"'; case 117: return pos < end && 123 === text.charCodeAt(pos) ? (tokenFlags |= 8, pos++ , scanExtendedUnicodeEscape()) : scanHexadecimalEscape(4); case 120: return scanHexadecimalEscape(2); case 13: pos < end && 10 === text.charCodeAt(pos) && pos++; case 10: case 8232: case 8233: return ""; default: return String.fromCharCode(ch) } } function scanHexadecimalEscape(numDigits) { var escapedValue = scanExactNumberOfHexDigits(numDigits, !1); return escapedValue >= 0 ? String.fromCharCode(escapedValue) : (error(ts.Diagnostics.Hexadecimal_digit_expected), "") } function scanExtendedUnicodeEscape() { var escapedValue = scanMinimumNumberOfHexDigits(1, !1), isInvalidExtendedEscape = !1; return escapedValue < 0 ? (error(ts.Diagnostics.Hexadecimal_digit_expected), isInvalidExtendedEscape = !0) : escapedValue > 1114111 && (error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive), isInvalidExtendedEscape = !0), pos >= end ? (error(ts.Diagnostics.Unexpected_end_of_text), isInvalidExtendedEscape = !0) : 125 === text.charCodeAt(pos) ? pos++ : (error(ts.Diagnostics.Unterminated_Unicode_escape_sequence), isInvalidExtendedEscape = !0), isInvalidExtendedEscape ? "" : utf16EncodeAsString(escapedValue) } function utf16EncodeAsString(codePoint) { if (ts.Debug.assert(0 <= codePoint && codePoint <= 1114111), codePoint <= 65535) return String.fromCharCode(codePoint); var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 55296, codeUnit2 = (codePoint - 65536) % 1024 + 56320; return String.fromCharCode(codeUnit1, codeUnit2) } function peekUnicodeEscape() { if (pos + 5 < end && 117 === text.charCodeAt(pos + 1)) { var start_1 = pos; pos += 2; var value = scanExactNumberOfHexDigits(4, !1); return pos = start_1, value } return -1 } function scanIdentifierParts() { for (var result = "", start = pos; pos < end;) { var ch = text.charCodeAt(pos); if (isIdentifierPart(ch, languageVersion)) pos++; else { if (92 !== ch) break; if (ch = peekUnicodeEscape(), !(ch >= 0 && isIdentifierPart(ch, languageVersion))) break; result += text.substring(start, pos), result += String.fromCharCode(ch), pos += 6, start = pos } } return result += text.substring(start, pos) } function getIdentifierToken() { var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); if (ch >= 97 && ch <= 122 && (token = textToToken.get(tokenValue), void 0 !== token)) return token } return token = 71 } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(2 === base || 8 === base, "Expected either base 2 or base 8"); for (var value = 0, numberOfDigits = 0, separatorAllowed = !1, isPreviousTokenSeparator = !1; ;) { var ch = text.charCodeAt(pos); if (95 !== ch) { separatorAllowed = !0; var valueOfCh = ch - 48; if (!isDigit(ch) || valueOfCh >= base) break; value = value * base + valueOfCh, pos++ , numberOfDigits++ , isPreviousTokenSeparator = !1 } else tokenFlags |= 512, separatorAllowed ? (separatorAllowed = !1, isPreviousTokenSeparator = !0) : isPreviousTokenSeparator ? error(ts.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1) : error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1), pos++ } return 0 === numberOfDigits ? -1 : 95 === text.charCodeAt(pos - 1) ? (error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1), value) : value } function scan() { for (startPos = pos, tokenFlags = 0; ;) { if (tokenPos = pos, pos >= end) return token = 1; var ch = text.charCodeAt(pos); if (35 === ch && 0 === pos && isShebangTrivia(text, pos)) { if (pos = scanShebangTrivia(text, pos), skipTrivia) continue; return token = 6 } switch (ch) { case 10: case 13: if (tokenFlags |= 1, skipTrivia) { pos++; continue } return 13 === ch && pos + 1 < end && 10 === text.charCodeAt(pos + 1) ? pos += 2 : pos++ , token = 4; case 9: case 11: case 12: case 32: if (skipTrivia) { pos++; continue } for (; pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos));)pos++; return token = 5; case 33: return 61 === text.charCodeAt(pos + 1) ? 61 === text.charCodeAt(pos + 2) ? (pos += 3, token = 35) : (pos += 2, token = 33) : (pos++ , token = 51); case 34: case 39: return tokenValue = scanString(), token = 9; case 96: return token = scanTemplateAndSetTokenValue(); case 37: return 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 64) : (pos++ , token = 42); case 38: return 38 === text.charCodeAt(pos + 1) ? (pos += 2, token = 53) : 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 68) : (pos++ , token = 48); case 40: return pos++ , token = 19; case 41: return pos++ , token = 20; case 42: return 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 61) : 42 === text.charCodeAt(pos + 1) ? 61 === text.charCodeAt(pos + 2) ? (pos += 3, token = 62) : (pos += 2, token = 40) : (pos++ , token = 39); case 43: return 43 === text.charCodeAt(pos + 1) ? (pos += 2, token = 43) : 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 59) : (pos++ , token = 37); case 44: return pos++ , token = 26; case 45: return 45 === text.charCodeAt(pos + 1) ? (pos += 2, token = 44) : 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 60) : (pos++ , token = 38); case 46: return isDigit(text.charCodeAt(pos + 1)) ? (tokenValue = scanNumber(), token = 8) : 46 === text.charCodeAt(pos + 1) && 46 === text.charCodeAt(pos + 2) ? (pos += 3, token = 24) : (pos++ , token = 23); case 47: if (47 === text.charCodeAt(pos + 1)) { for (pos += 2; pos < end && !isLineBreak(text.charCodeAt(pos));)pos++; if (skipTrivia) continue; return token = 2 } if (42 === text.charCodeAt(pos + 1)) { pos += 2, 42 === text.charCodeAt(pos) && 47 !== text.charCodeAt(pos + 1) && (tokenFlags |= 2); for (var commentClosed = !1; pos < end;) { var ch_1 = text.charCodeAt(pos); if (42 === ch_1 && 47 === text.charCodeAt(pos + 1)) { pos += 2, commentClosed = !0; break } isLineBreak(ch_1) && (tokenFlags |= 1), pos++ } if (commentClosed || error(ts.Diagnostics.Asterisk_Slash_expected), skipTrivia) continue; return commentClosed || (tokenFlags |= 4), token = 3 } return 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 63) : (pos++ , token = 41); case 48: if (pos + 2 < end && (88 === text.charCodeAt(pos + 1) || 120 === text.charCodeAt(pos + 1))) { pos += 2; var value = scanMinimumNumberOfHexDigits(1, !0); return value < 0 && (error(ts.Diagnostics.Hexadecimal_digit_expected), value = 0), tokenValue = "" + value, tokenFlags |= 64, token = 8 } if (pos + 2 < end && (66 === text.charCodeAt(pos + 1) || 98 === text.charCodeAt(pos + 1))) { pos += 2; var value = scanBinaryOrOctalDigits(2); return value < 0 && (error(ts.Diagnostics.Binary_digit_expected), value = 0), tokenValue = "" + value, tokenFlags |= 128, token = 8 } if (pos + 2 < end && (79 === text.charCodeAt(pos + 1) || 111 === text.charCodeAt(pos + 1))) { pos += 2; var value = scanBinaryOrOctalDigits(8); return value < 0 && (error(ts.Diagnostics.Octal_digit_expected), value = 0), tokenValue = "" + value, tokenFlags |= 256, token = 8 } if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) return tokenValue = "" + scanOctalDigits(), tokenFlags |= 32, token = 8; case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: return tokenValue = scanNumber(), token = 8; case 58: return pos++ , token = 56; case 59: return pos++ , token = 25; case 60: if (isConflictMarkerTrivia(text, pos)) { if (pos = scanConflictMarkerTrivia(text, pos, error), skipTrivia) continue; return token = 7 } return 60 === text.charCodeAt(pos + 1) ? 61 === text.charCodeAt(pos + 2) ? (pos += 3, token = 65) : (pos += 2, token = 45) : 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 30) : 1 === languageVariant && 47 === text.charCodeAt(pos + 1) && 42 !== text.charCodeAt(pos + 2) ? (pos += 2, token = 28) : (pos++ , token = 27); case 61: if (isConflictMarkerTrivia(text, pos)) { if (pos = scanConflictMarkerTrivia(text, pos, error), skipTrivia) continue; return token = 7 } return 61 === text.charCodeAt(pos + 1) ? 61 === text.charCodeAt(pos + 2) ? (pos += 3, token = 34) : (pos += 2, token = 32) : 62 === text.charCodeAt(pos + 1) ? (pos += 2, token = 36) : (pos++ , token = 58); case 62: if (isConflictMarkerTrivia(text, pos)) { if (pos = scanConflictMarkerTrivia(text, pos, error), skipTrivia) continue; return token = 7 } return pos++ , token = 29; case 63: return pos++ , token = 55; case 91: return pos++ , token = 21; case 93: return pos++ , token = 22; case 94: return 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 70) : (pos++ , token = 50); case 123: return pos++ , token = 17; case 124: if (isConflictMarkerTrivia(text, pos)) { if (pos = scanConflictMarkerTrivia(text, pos, error), skipTrivia) continue; return token = 7 } return 124 === text.charCodeAt(pos + 1) ? (pos += 2, token = 54) : 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 69) : (pos++ , token = 49); case 125: return pos++ , token = 18; case 126: return pos++ , token = 52; case 64: return pos++ , token = 57; case 92: var cookedChar = peekUnicodeEscape(); return cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion) ? (pos += 6, tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(), token = getIdentifierToken()) : (error(ts.Diagnostics.Invalid_character), pos++ , token = 0); default: if (isIdentifierStart(ch, languageVersion)) { for (pos++; pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion);)pos++; return tokenValue = text.substring(tokenPos, pos), 92 === ch && (tokenValue += scanIdentifierParts()), token = getIdentifierToken() } if (isWhiteSpaceSingleLine(ch)) { pos++; continue } if (isLineBreak(ch)) { tokenFlags |= 1, pos++; continue } return error(ts.Diagnostics.Invalid_character), pos++ , token = 0 } } } function reScanGreaterToken() { if (29 === token) { if (62 === text.charCodeAt(pos)) return 62 === text.charCodeAt(pos + 1) ? 61 === text.charCodeAt(pos + 2) ? (pos += 3, token = 67) : (pos += 2, token = 47) : 61 === text.charCodeAt(pos + 1) ? (pos += 2, token = 66) : (pos++ , token = 46); if (61 === text.charCodeAt(pos)) return pos++ , token = 31 } return token } function reScanSlashToken() { if (41 === token || 63 === token) { for (var p = tokenPos + 1, inEscape = !1, inCharacterClass = !1; ;) { if (p >= end) { tokenFlags |= 4, error(ts.Diagnostics.Unterminated_regular_expression_literal); break } var ch = text.charCodeAt(p); if (isLineBreak(ch)) { tokenFlags |= 4, error(ts.Diagnostics.Unterminated_regular_expression_literal); break } if (inEscape) inEscape = !1; else { if (47 === ch && !inCharacterClass) { p++; break } 91 === ch ? inCharacterClass = !0 : 92 === ch ? inEscape = !0 : 93 === ch && (inCharacterClass = !1) } p++ } for (; p < end && isIdentifierPart(text.charCodeAt(p), languageVersion);)p++; pos = p, tokenValue = text.substring(tokenPos, pos), token = 12 } return token } function reScanTemplateToken() { return ts.Debug.assert(18 === token, "'reScanTemplateToken' should only be called on a '}'"), pos = tokenPos, token = scanTemplateAndSetTokenValue() } function reScanJsxToken() { return pos = tokenPos = startPos, token = scanJsxToken() } function scanJsxToken() { if (startPos = tokenPos = pos, pos >= end) return token = 1; var char = text.charCodeAt(pos); if (60 === char) return 47 === text.charCodeAt(pos + 1) ? (pos += 2, token = 28) : (pos++ , token = 27); if (123 === char) return pos++ , token = 17; for (var firstNonWhitespace = 0; pos < end && (char = text.charCodeAt(pos), 123 !== char);) { if (60 === char) { if (isConflictMarkerTrivia(text, pos)) return pos = scanConflictMarkerTrivia(text, pos, error), token = 7; break } isLineBreak(char) && 0 === firstNonWhitespace ? firstNonWhitespace = -1 : isWhiteSpaceLike(char) || (firstNonWhitespace = pos), pos++ } return firstNonWhitespace === -1 ? 11 : 10 } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { for (var firstCharPosition = pos; pos < end;) { var ch = text.charCodeAt(pos); if (45 !== ch && (firstCharPosition === pos ? !isIdentifierStart(ch, languageVersion) : !isIdentifierPart(ch, languageVersion))) break; pos++ } tokenValue += text.substring(firstCharPosition, pos) } return token } function scanJsxAttributeValue() { switch (startPos = pos, text.charCodeAt(pos)) { case 34: case 39: return tokenValue = scanString(!0), token = 9; default: return scan() } } function scanJSDocToken() { if (startPos = tokenPos = pos, pos >= end) return token = 1; var ch = text.charCodeAt(pos); switch (pos++ , ch) { case 9: case 11: case 12: case 32: for (; pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos));)pos++; return token = 5; case 64: return token = 57; case 10: case 13: return token = 4; case 42: return token = 39; case 123: return token = 17; case 125: return token = 18; case 91: return token = 21; case 93: return token = 22; case 60: return token = 27; case 61: return token = 58; case 44: return token = 26; case 46: return token = 23; case 96: for (; pos < end && 96 !== text.charCodeAt(pos);)pos++; return tokenValue = text.substring(tokenPos + 1, pos), pos++ , token = 13 }if (isIdentifierStart(ch, 6)) { for (; isIdentifierPart(text.charCodeAt(pos), 6) && pos < end;)pos++; return tokenValue = text.substring(tokenPos, pos), token = 71 } return token = 0 } function speculationHelper(callback, isLookahead) { var savePos = pos, saveStartPos = startPos, saveTokenPos = tokenPos, saveToken = token, saveTokenValue = tokenValue, saveTokenFlags = tokenFlags, result = callback(); return result && !isLookahead || (pos = savePos, startPos = saveStartPos, tokenPos = saveTokenPos, token = saveToken, tokenValue = saveTokenValue, tokenFlags = saveTokenFlags), result } function scanRange(start, length, callback) { var saveEnd = end, savePos = pos, saveStartPos = startPos, saveTokenPos = tokenPos, saveToken = token, saveTokenValue = tokenValue, saveTokenFlags = tokenFlags; setText(text, start, length); var result = callback(); return end = saveEnd, pos = savePos, startPos = saveStartPos, tokenPos = saveTokenPos, token = saveToken, tokenValue = saveTokenValue, tokenFlags = saveTokenFlags, result } function lookAhead(callback) { return speculationHelper(callback, !0) } function tryScan(callback) { return speculationHelper(callback, !1) } function getText() { return text } function setText(newText, start, length) { text = newText || "", end = void 0 === length ? text.length : start + length, setTextPos(start || 0) } function setOnError(errorCallback) { onError = errorCallback } function setScriptTarget(scriptTarget) { languageVersion = scriptTarget } function setLanguageVariant(variant) { languageVariant = variant } function setTextPos(textPos) { ts.Debug.assert(textPos >= 0), pos = textPos, startPos = textPos, tokenPos = textPos, token = 0, tokenValue = void 0, tokenFlags = 0 } void 0 === languageVariant && (languageVariant = 0); var pos, end, startPos, tokenPos, token, tokenValue, tokenFlags; return setText(text, start, length), { getStartPos: function () { return startPos }, getTextPos: function () { return pos }, getToken: function () { return token }, getTokenPos: function () { return tokenPos }, getTokenText: function () { return text.substring(tokenPos, pos) }, getTokenValue: function () { return tokenValue }, hasExtendedUnicodeEscape: function () { return 0 !== (8 & tokenFlags) }, hasPrecedingLineBreak: function () { return 0 !== (1 & tokenFlags) }, isIdentifier: function () { return 71 === token || token > 107 }, isReservedWord: function () { return token >= 72 && token <= 107 }, isUnterminated: function () { return 0 !== (4 & tokenFlags) }, getTokenFlags: function () { return tokenFlags }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, scanJsxIdentifier: scanJsxIdentifier, scanJsxAttributeValue: scanJsxAttributeValue, reScanJsxToken: reScanJsxToken, scanJsxToken: scanJsxToken, scanJSDocToken: scanJSDocToken, scan: scan, getText: getText, setText: setText, setScriptTarget: setScriptTarget, setLanguageVariant: setLanguageVariant, setOnError: setOnError, setTextPos: setTextPos, tryScan: tryScan, lookAhead: lookAhead, scanRange: scanRange } } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword, ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToToken = ts.createMapFromTemplate({ abstract: 117, any: 119, as: 118, boolean: 122, break: 72, case: 73, catch: 74, class: 75, continue: 77, const: 76, constructor: 123, debugger: 78, declare: 124, default: 79, delete: 80, do: 81, else: 82, enum: 83, export: 84, extends: 85, false: 86, finally: 87, for: 88, from: 142, function: 89, get: 125, if: 90, implements: 108, import: 91, in: 92, infer: 126, instanceof: 93, interface: 109, is: 127, keyof: 128, let: 110, module: 129, namespace: 130, never: 131, new: 94, null: 95, number: 134, object: 135, package: 111, private: 112, protected: 113, public: 114, readonly: 132, require: 133, global: 143, return: 96, set: 136, static: 115, string: 137, super: 97, switch: 98, symbol: 138, this: 99, throw: 100, true: 101, try: 102, type: 139, typeof: 103, undefined: 140, unique: 141, var: 104, void: 105, while: 106, with: 107, yield: 116, async: 120, await: 121, of: 144, "{": 17, "}": 18, "(": 19, ")": 20, "[": 21, "]": 22, ".": 23, "...": 24, ";": 25, ",": 26, "<": 27, ">": 29, "<=": 30, ">=": 31, "==": 32, "!=": 33, "===": 34, "!==": 35, "=>": 36, "+": 37, "-": 38, "**": 40, "*": 39, "/": 41, "%": 42, "++": 43, "--": 44, "<<": 45, ">": 46, ">>>": 47, "&": 48, "|": 49, "^": 50, "!": 51, "~": 52, "&&": 53, "||": 54, "?": 55, ":": 56, "=": 58, "+=": 59, "-=": 60, "*=": 61, "**=": 62, "/=": 63, "%=": 64, "<<=": 65, ">>=": 66, ">>>=": 67, "&=": 68, "|=": 69, "^=": 70, "@": 57 }), unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500], unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500], unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500], unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6e3, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; var tokenStrings = makeReverseMap(textToToken); ts.tokenToString = tokenToString, ts.stringToToken = stringToToken, ts.computeLineStarts = computeLineStarts, ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter, ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter, ts.getLineStarts = getLineStarts, ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition, ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition, ts.isWhiteSpaceLike = isWhiteSpaceLike, ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine, ts.isLineBreak = isLineBreak, ts.isOctalDigit = isOctalDigit, ts.couldStartTrivia = couldStartTrivia, ts.skipTrivia = skipTrivia; var mergeConflictMarkerLength = "<<<<<<<".length, shebangTriviaRegex = /^#!.*/; ts.forEachLeadingCommentRange = forEachLeadingCommentRange, ts.forEachTrailingCommentRange = forEachTrailingCommentRange, ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange, ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange, ts.getLeadingCommentRanges = getLeadingCommentRanges, ts.getTrailingCommentRanges = getTrailingCommentRanges, ts.getShebang = getShebang, ts.isIdentifierStart = isIdentifierStart, ts.isIdentifierPart = isIdentifierPart, ts.isIdentifierText = isIdentifierText, ts.createScanner = createScanner }(ts || (ts = {})); var ts; !function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; if (declarations) for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { var declaration = declarations_1[_i]; if (declaration.kind === kind) return declaration } } function createSingleLineStringWriter() { var str = "", writeText = function (text) { return str += text }; return { getText: function () { return str }, write: writeText, rawWrite: writeText, writeTextOfNode: writeText, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, writeSpace: writeText, writeStringLiteral: writeText, writeLiteral: writeText, writeParameter: writeText, writeProperty: writeText, writeSymbol: writeText, getTextPos: function () { return str.length }, getLine: function () { return 0 }, getColumn: function () { return 0 }, getIndent: function () { return 0 }, isAtStartOfLine: function () { return !1 }, writeLine: function () { return str += " " }, increaseIndent: ts.noop, decreaseIndent: ts.noop, clear: function () { return str = "" }, trackSymbol: ts.noop, reportInaccessibleThisError: ts.noop, reportInaccessibleUniqueSymbolError: ts.noop, reportPrivateInBaseOfClassExpression: ts.noop } } function usingSingleLineStringWriter(action) { var oldString = stringWriter.getText(); try { return action(stringWriter), stringWriter.getText() } finally { stringWriter.clear(), stringWriter.writeKeyword(oldString) } } function getFullWidth(node) { return node.end - node.pos } function getResolvedModule(sourceFile, moduleNameText) { return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText) } function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { sourceFile.resolvedModules || (sourceFile.resolvedModules = ts.createMap()), sourceFile.resolvedModules.set(moduleNameText, resolvedModule) } function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { sourceFile.resolvedTypeReferenceDirectiveNames || (sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap()), sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective) } function moduleResolutionIsEqualTo(oldResolution, newResolution) { return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && oldResolution.extension === newResolution.extension && oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.originalPath === newResolution.originalPath && packageIdIsEqual(oldResolution.packageId, newResolution.packageId) } function packageIdIsEqual(a, b) { return a === b || a && b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version } function packageIdToString(_a) { var name = _a.name, subModuleName = _a.subModuleName, version = _a.version, fullName = subModuleName ? name + "/" + subModuleName : name; return fullName + "@" + version } function typeDirectiveIsEqualTo(oldResolution, newResolution) { return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary } function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { ts.Debug.assert(names.length === newResolutions.length); for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i], oldResolution = oldResolutions && oldResolutions.get(names[i]), changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; if (changed) return !0 } return !1 } function containsParseError(node) { return aggregateChildData(node), 0 !== (131072 & node.flags) } function aggregateChildData(node) { if (!(262144 & node.flags)) { var thisNodeOrAnySubNodesHasError = 0 !== (32768 & node.flags) || ts.forEachChild(node, containsParseError); thisNodeOrAnySubNodesHasError && (node.flags |= 131072), node.flags |= 262144 } } function getSourceFileOfNode(node) { for (; node && 273 !== node.kind;)node = node.parent; return node } function isStatementWithLocals(node) { switch (node.kind) { case 212: case 240: case 219: case 220: case 221: return !0 }return !1 } function getStartPositionOfLine(line, sourceFile) { return ts.Debug.assert(line >= 0), ts.getLineStarts(sourceFile)[line] } function nodePosToString(node) { var file = getSourceFileOfNode(node), loc = ts.getLineAndCharacterOfPosition(file, node.pos); return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")" } function getEndLinePosition(line, sourceFile) { ts.Debug.assert(line >= 0); var lineStarts = ts.getLineStarts(sourceFile), lineIndex = line, sourceText = sourceFile.text; if (lineIndex + 1 === lineStarts.length) return sourceText.length - 1; var start = lineStarts[lineIndex], pos = lineStarts[lineIndex + 1] - 1; for (ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos));)pos--; return pos } function isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) { return !(hasGlobalName && hasGlobalName(name) || currentSourceFile.identifiers.has(name)) } function nodeIsMissing(node) { return void 0 === node || node.pos === node.end && node.pos >= 0 && 1 !== node.kind } function nodeIsPresent(node) { return !nodeIsMissing(node) } function prependStatements(to, from) { if (void 0 === from || 0 === from.length) return to; if (void 0 === to) return from.slice(); var prologue = to.length && isPrologueDirective(to[0]) && to.shift(); return to.unshift.apply(to, from), prologue && to.unshift(prologue), to } function isRecognizedTripleSlashComment(text, commentPos, commentEnd) { if (47 === text.charCodeAt(commentPos + 1) && commentPos + 2 < commentEnd && 47 === text.charCodeAt(commentPos + 2)) { var textSubStr = text.substring(commentPos, commentEnd); return !!(textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) || textSubStr.match(fullTripleSlashReferenceTypeReferenceDirectiveRegEx) || textSubStr.match(defaultLibReferenceRegEx)) } return !1 } function isPinnedComment(text, start) { return 42 === text.charCodeAt(start + 1) && 33 === text.charCodeAt(start + 2) } function getTokenPosOfNode(node, sourceFile, includeJsDoc) { return nodeIsMissing(node) ? node.pos : ts.isJSDocNode(node) ? ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, !1, !0) : includeJsDoc && ts.hasJSDocNodes(node) ? getTokenPosOfNode(node.jsDoc[0]) : 298 === node.kind && node._children.length > 0 ? getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc) : ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos) } function getNonDecoratorTokenPosOfNode(node, sourceFile) { return nodeIsMissing(node) || !node.decorators ? getTokenPosOfNode(node, sourceFile) : ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end) } function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { return void 0 === includeTrivia && (includeTrivia = !1), getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia) } function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) { return void 0 === includeTrivia && (includeTrivia = !1), nodeIsMissing(node) ? "" : sourceText.substring(includeTrivia ? node.pos : ts.skipTrivia(sourceText, node.pos), node.end) } function getTextOfNode(node, includeTrivia) { return void 0 === includeTrivia && (includeTrivia = !1), getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia) } function getPos(range) { return range.pos } function indexOfNode(nodeArray, node) { return ts.binarySearch(nodeArray, node, getPos, ts.compareValues) } function getEmitFlags(node) { var emitNode = node.emitNode; return emitNode && emitNode.flags } function getLiteralText(node, sourceFile) { if (!nodeIsSynthesized(node) && node.parent && !(ts.isNumericLiteral(node) && 512 & node.numericLiteralFlags)) return getSourceTextOfNodeFromSourceFile(sourceFile, node); var escapeText = 16777216 & getEmitFlags(node) ? escapeString : escapeNonAsciiString; switch (node.kind) { case 9: return node.singleQuote ? "'" + escapeText(node.text, 39) + "'" : '"' + escapeText(node.text, 34) + '"'; case 13: return "`" + escapeText(node.text, 96) + "`"; case 14: return "`" + escapeText(node.text, 96) + "${"; case 15: return "}" + escapeText(node.text, 96) + "${"; case 16: return "}" + escapeText(node.text, 96) + "`"; case 8: case 12: return node.text }ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for.") } function getTextOfConstantValue(value) { return ts.isString(value) ? '"' + escapeNonAsciiString(value) + '"' : "" + value } function escapeLeadingUnderscores(identifier) { return identifier.length >= 2 && 95 === identifier.charCodeAt(0) && 95 === identifier.charCodeAt(1) ? "_" + identifier : identifier } function escapeIdentifier(identifier) { return identifier } function makeIdentifierFromModuleName(moduleName) { return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_") } function isBlockOrCatchScoped(declaration) { return 0 !== (3 & ts.getCombinedNodeFlags(declaration)) || isCatchClauseVariableDeclarationOrBindingElement(declaration) } function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); return 231 === node.kind && 268 === node.parent.kind } function isAmbientModule(node) { return ts.isModuleDeclaration(node) && (9 === node.name.kind || isGlobalScopeAugmentation(node)) } function isModuleWithStringLiteralName(node) { return ts.isModuleDeclaration(node) && 9 === node.name.kind } function isNonGlobalAmbientModule(node) { return ts.isModuleDeclaration(node) && ts.isStringLiteral(node.name) } function isShorthandAmbientModuleSymbol(moduleSymbol) { return isShorthandAmbientModule(moduleSymbol.valueDeclaration) } function isShorthandAmbientModule(node) { return node && 238 === node.kind && !node.body } function isBlockScopedContainerTopLevel(node) { return 273 === node.kind || 238 === node.kind || ts.isFunctionLike(node) } function isGlobalScopeAugmentation(module) { return !!(512 & module.flags) } function isExternalModuleAugmentation(node) { return isAmbientModule(node) && isModuleAugmentationExternal(node) } function isModuleAugmentationExternal(node) { switch (node.parent.kind) { case 273: return ts.isExternalModule(node.parent); case 239: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent) }return !1 } function isEffectiveExternalModule(node, compilerOptions) { return ts.isExternalModule(node) || compilerOptions.isolatedModules || ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS && !!node.commonJsModuleIndicator } function isBlockScope(node, parentNode) { switch (node.kind) { case 273: case 240: case 268: case 238: case 219: case 220: case 221: case 154: case 153: case 155: case 156: case 233: case 191: case 192: return !0; case 212: return parentNode && !ts.isFunctionLike(parentNode) }return !1 } function isDeclarationWithTypeParameters(node) { switch (node.kind) { case 157: case 158: case 152: case 159: case 162: case 163: case 283: case 234: case 204: case 235: case 236: case 295: case 233: case 153: case 154: case 155: case 156: case 191: case 192: case 291: case 296: case 287: return !0; default: return ts.assertTypeIsNever(node), !1 } } function isAnyImportSyntax(node) { switch (node.kind) { case 243: case 242: return !0; default: return !1 } } function isLateVisibilityPaintedStatement(node) { switch (node.kind) { case 243: case 242: case 213: case 234: case 233: case 238: case 236: case 235: case 237: return !0; default: return !1 } } function isAnyImportOrReExport(node) { return isAnyImportSyntax(node) || ts.isExportDeclaration(node) } function getEnclosingBlockScopeContainer(node) { return ts.findAncestor(node.parent, function (current) { return isBlockScope(current, current.parent) }) } function declarationNameToString(name) { return 0 === getFullWidth(name) ? "(Missing)" : getTextOfNode(name) } function getNameFromIndexInfo(info) { return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : void 0 } function getTextOfPropertyName(name) { switch (name.kind) { case 71: return name.escapedText; case 9: case 8: return escapeLeadingUnderscores(name.text); case 146: return isStringOrNumericLiteral(name.expression) ? escapeLeadingUnderscores(name.expression.text) : void 0; default: ts.Debug.assertNever(name) } } function entityNameToString(name) { switch (name.kind) { case 71: return 0 === getFullWidth(name) ? ts.idText(name) : getTextOfNode(name); case 145: return entityNameToString(name.left) + "." + entityNameToString(name.right); case 184: return entityNameToString(name.expression) + "." + entityNameToString(name.name) } } function createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3) { var sourceFile = getSourceFileOfNode(node); return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) } function createDiagnosticForNodeArray(sourceFile, nodes, message, arg0, arg1, arg2, arg3) { var start = ts.skipTrivia(sourceFile.text, nodes.pos); return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2, arg3) } function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) { var span = getErrorSpanForNode(sourceFile, node); return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3) } function createDiagnosticForNodeFromMessageChain(node, messageChain) { var sourceFile = getSourceFileOfNode(node), span = getErrorSpanForNode(sourceFile, node); return { file: sourceFile, start: span.start, length: span.length, code: messageChain.code, category: messageChain.category, messageText: messageChain.next ? messageChain : messageChain.messageText } } function getSpanOfTokenAtPosition(sourceFile, pos) { var scanner = ts.createScanner(sourceFile.languageVersion, !0, sourceFile.languageVariant, sourceFile.text, void 0, pos); scanner.scan(); var start = scanner.getTokenPos(); return ts.createTextSpanFromBounds(start, scanner.getTextPos()) } function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); if (node.body && 212 === node.body.kind) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line, endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1) } return ts.createTextSpanFromBounds(pos, node.end) } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { case 273: var pos_1 = ts.skipTrivia(sourceFile.text, 0, !1); return pos_1 === sourceFile.text.length ? ts.createTextSpan(0, 0) : getSpanOfTokenAtPosition(sourceFile, pos_1); case 231: case 181: case 234: case 204: case 235: case 238: case 237: case 272: case 233: case 191: case 153: case 155: case 156: case 236: case 151: case 150: errorNode = node.name; break; case 192: return getErrorSpanForArrowFunction(sourceFile, node) }if (void 0 === errorNode) return getSpanOfTokenAtPosition(sourceFile, node.pos); var isMissing = nodeIsMissing(errorNode), pos = isMissing ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return isMissing ? (ts.Debug.assert(pos === errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"), ts.Debug.assert(pos === errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809")) : (ts.Debug.assert(pos >= errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"), ts.Debug.assert(pos <= errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809")), ts.createTextSpanFromBounds(pos, errorNode.end) } function isExternalOrCommonJsModule(file) { return void 0 !== (file.externalModuleIndicator || file.commonJsModuleIndicator) } function isJsonSourceFile(file) { return 6 === file.scriptKind } function isConstEnumDeclaration(node) { return 237 === node.kind && isConst(node) } function isConst(node) { return !!(2 & ts.getCombinedNodeFlags(node)) || !!(2048 & ts.getCombinedModifierFlags(node)) } function isLet(node) { return !!(1 & ts.getCombinedNodeFlags(node)) } function isSuperCall(n) { return 186 === n.kind && 97 === n.expression.kind } function isImportCall(n) { return 186 === n.kind && 91 === n.expression.kind } function isLiteralImportTypeNode(n) { return 178 === n.kind && 177 === n.argument.kind && ts.isStringLiteral(n.argument.literal) } function isPrologueDirective(node) { return 215 === node.kind && 9 === node.expression.kind } function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { return 10 !== node.kind ? ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : void 0 } function getJSDocCommentRanges(node, text) { var commentRanges = 148 === node.kind || 147 === node.kind || 191 === node.kind || 192 === node.kind || 190 === node.kind ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); return ts.filter(commentRanges, function (comment) { return 42 === text.charCodeAt(comment.pos + 1) && 42 === text.charCodeAt(comment.pos + 2) && 47 !== text.charCodeAt(comment.pos + 3) }) } function isPartOfTypeNode(node) { if (160 <= node.kind && node.kind <= 178) return !0; switch (node.kind) { case 119: case 134: case 137: case 122: case 138: case 140: case 131: return !0; case 105: return 195 !== node.parent.kind; case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 147: return 176 === node.parent.kind || 171 === node.parent.kind; case 71: 145 === node.parent.kind && node.parent.right === node ? node = node.parent : 184 === node.parent.kind && node.parent.name === node && (node = node.parent), ts.Debug.assert(71 === node.kind || 145 === node.kind || 184 === node.kind, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); case 145: case 184: case 99: var parent = node.parent; if (164 === parent.kind) return !1; if (178 === parent.kind) return !parent.isTypeOf; if (160 <= parent.kind && parent.kind <= 178) return !0; switch (parent.kind) { case 206: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 147: return node === parent.constraint; case 151: case 150: case 148: case 231: return node === parent.type; case 233: case 191: case 192: case 154: case 153: case 152: case 155: case 156: return node === parent.type; case 157: case 158: case 159: return node === parent.type; case 189: return node === parent.type; case 186: case 187: return ts.contains(parent.typeArguments, node); case 188: return !1 } }return !1 } function isChildOfNodeWithKind(node, kind) { for (; node;) { if (node.kind === kind) return !0; node = node.parent } return !1 } function forEachReturnStatement(body, visitor) { function traverse(node) { switch (node.kind) { case 224: return visitor(node); case 240: case 212: case 216: case 217: case 218: case 219: case 220: case 221: case 225: case 226: case 265: case 266: case 227: case 229: case 268: return ts.forEachChild(node, traverse) } } return traverse(body) } function forEachYieldExpression(body, visitor) { function traverse(node) { switch (node.kind) { case 202: visitor(node); var operand = node.expression; return void (operand && traverse(operand)); case 237: case 235: case 238: case 236: case 234: case 204: return; default: if (ts.isFunctionLike(node)) { if (node.name && 146 === node.name.kind) return void traverse(node.name.expression) } else isPartOfTypeNode(node) || ts.forEachChild(node, traverse) } } return traverse(body) } function getRestParameterElementType(node) { return node && 166 === node.kind ? node.elementType : node && 161 === node.kind ? ts.singleOrUndefined(node.typeArguments) : void 0 } function getMembersOfDeclaration(node) { switch (node.kind) { case 235: case 234: case 204: case 165: return node.members; case 183: return node.properties } } function isVariableLike(node) { if (node) switch (node.kind) { case 181: case 272: case 148: case 269: case 151: case 150: case 270: case 231: return !0 }return !1 } function isVariableLikeOrAccessor(node) { return isVariableLike(node) || ts.isAccessor(node) } function isVariableDeclarationInVariableStatement(node) { return 232 === node.parent.kind && 213 === node.parent.parent.kind } function isValidESSymbolDeclaration(node) { return ts.isVariableDeclaration(node) ? isConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) : ts.isPropertyDeclaration(node) ? hasReadonlyModifier(node) && hasStaticModifier(node) : ts.isPropertySignature(node) && hasReadonlyModifier(node) } function introducesArgumentsExoticObject(node) { switch (node.kind) { case 153: case 152: case 154: case 155: case 156: case 233: case 191: return !0 }return !1 } function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) { for (; ;) { if (beforeUnwrapLabelCallback && beforeUnwrapLabelCallback(node), 227 !== node.statement.kind) return node.statement; node = node.statement } } function isFunctionBlock(node) { return node && 212 === node.kind && ts.isFunctionLike(node.parent) } function isObjectLiteralMethod(node) { return node && 153 === node.kind && 183 === node.parent.kind } function isObjectLiteralOrClassExpressionMethod(node) { return 153 === node.kind && (183 === node.parent.kind || 204 === node.parent.kind) } function isIdentifierTypePredicate(predicate) { return predicate && 1 === predicate.kind } function isThisTypePredicate(predicate) { return predicate && 0 === predicate.kind } function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { if (269 === property.kind) { var propName = getTextOfPropertyName(property.name); return key === propName || key2 && key2 === propName } }) } function getTsConfigObjectLiteralExpression(tsConfigSourceFile) { if (tsConfigSourceFile && tsConfigSourceFile.statements.length) { var expression = tsConfigSourceFile.statements[0].expression; return ts.isObjectLiteralExpression(expression) && expression } } function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) { return ts.firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? ts.find(property.initializer.elements, function (element) { return ts.isStringLiteral(element) && element.text === elementValue }) : void 0 }) } function getTsConfigPropArray(tsConfigSourceFile, propKey) { var jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile); return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : ts.emptyArray } function getContainingFunction(node) { return ts.findAncestor(node.parent, ts.isFunctionLike) } function getContainingClass(node) { return ts.findAncestor(node.parent, ts.isClassLike) } function getThisContainer(node, includeArrowFunctions) { for (; ;) { if (node = node.parent, !node) return; switch (node.kind) { case 146: if (ts.isClassLike(node.parent.parent)) return node; node = node.parent; break; case 149: 148 === node.parent.kind && ts.isClassElement(node.parent.parent) ? node = node.parent.parent : ts.isClassElement(node.parent) && (node = node.parent); break; case 192: if (!includeArrowFunctions) continue; case 233: case 191: case 238: case 151: case 150: case 153: case 152: case 154: case 155: case 156: case 157: case 158: case 159: case 237: case 273: return node } } } function getNewTargetContainer(node) { var container = getThisContainer(node, !1); if (container) switch (container.kind) { case 154: case 233: case 191: return container } } function getSuperContainer(node, stopOnFunctions) { for (; ;) { if (node = node.parent, !node) return node; switch (node.kind) { case 146: node = node.parent; break; case 233: case 191: case 192: if (!stopOnFunctions) continue; case 151: case 150: case 153: case 152: case 154: case 155: case 156: return node; case 149: 148 === node.parent.kind && ts.isClassElement(node.parent.parent) ? node = node.parent.parent : ts.isClassElement(node.parent) && (node = node.parent) } } } function getImmediatelyInvokedFunctionExpression(func) { if (191 === func.kind || 192 === func.kind) { for (var prev = func, parent = func.parent; 190 === parent.kind;)prev = parent, parent = parent.parent; if (186 === parent.kind && parent.expression === prev) return parent } } function isSuperProperty(node) { var kind = node.kind; return (184 === kind || 185 === kind) && 97 === node.expression.kind } function isThisProperty(node) { var kind = node.kind; return (184 === kind || 185 === kind) && 99 === node.expression.kind } function getEntityNameFromTypeNode(node) { switch (node.kind) { case 161: return node.typeName; case 206: return isEntityNameExpression(node.expression) ? node.expression : void 0; case 71: case 145: return node } } function getInvokedExpression(node) { switch (node.kind) { case 188: return node.tag; case 256: case 255: return node.tagName; default: return node.expression } } function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { case 234: return !0; case 151: return 234 === parent.kind; case 155: case 156: case 153: return void 0 !== node.body && 234 === parent.kind; case 148: return void 0 !== parent.body && (154 === parent.kind || 153 === parent.kind || 156 === parent.kind) && 234 === grandparent.kind }return !1 } function nodeIsDecorated(node, parent, grandparent) { return void 0 !== node.decorators && nodeCanBeDecorated(node, parent, grandparent) } function nodeOrChildIsDecorated(node, parent, grandparent) { return nodeIsDecorated(node, parent, grandparent) || childIsDecorated(node, parent) } function childIsDecorated(node, parent) { switch (node.kind) { case 234: return ts.forEach(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent) }); case 153: case 156: return ts.forEach(node.parameters, function (p) { return nodeIsDecorated(p, node, parent) }) } } function isJSXTagName(node) { var parent = node.parent; return (256 === parent.kind || 255 === parent.kind || 257 === parent.kind) && parent.tagName === node } function isExpressionNode(node) { switch (node.kind) { case 97: case 95: case 101: case 86: case 12: case 182: case 183: case 184: case 185: case 186: case 187: case 188: case 207: case 189: case 208: case 190: case 191: case 204: case 192: case 195: case 193: case 194: case 197: case 198: case 199: case 200: case 203: case 201: case 13: case 205: case 254: case 255: case 258: case 202: case 196: case 209: return !0; case 145: for (; 145 === node.parent.kind;)node = node.parent; return 164 === node.parent.kind || isJSXTagName(node); case 71: if (164 === node.parent.kind || isJSXTagName(node)) return !0; case 8: case 9: case 99: return isInExpressionContext(node); default: return !1 } } function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { case 231: case 148: case 151: case 150: case 272: case 269: case 181: return parent.initializer === node; case 215: case 216: case 217: case 218: case 224: case 225: case 226: case 265: case 228: return parent.expression === node; case 219: var forStatement = parent; return forStatement.initializer === node && 232 !== forStatement.initializer.kind || forStatement.condition === node || forStatement.incrementor === node; case 220: case 221: var forInStatement = parent; return forInStatement.initializer === node && 232 !== forInStatement.initializer.kind || forInStatement.expression === node; case 189: case 207: return node === parent.expression; case 210: return node === parent.expression; case 146: return node === parent.expression; case 149: case 264: case 263: case 271: return !0; case 206: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: return isExpressionNode(parent) } } function isExternalModuleImportEqualsDeclaration(node) { return 242 === node.kind && 253 === node.moduleReference.kind } function getExternalModuleImportEqualsDeclarationExpression(node) { return ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node)), node.moduleReference.expression } function isInternalModuleImportEqualsDeclaration(node) { return 242 === node.kind && 253 !== node.moduleReference.kind } function isSourceFileJavaScript(file) { return isInJavaScriptFile(file) } function isSourceFileNotJavaScript(file) { return !isInJavaScriptFile(file) } function isInJavaScriptFile(node) { return node && !!(65536 & node.flags) } function isInJsonFile(node) { return node && !!(16777216 & node.flags) } function isInJSDoc(node) { return node && !!(2097152 & node.flags) } function isJSDocIndexSignature(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && "Object" === node.typeName.escapedText && node.typeArguments && 2 === node.typeArguments.length && (137 === node.typeArguments[0].kind || 134 === node.typeArguments[0].kind) } function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { if (186 !== callExpression.kind) return !1; var _a = callExpression, expression = _a.expression, args = _a.arguments; if (71 !== expression.kind || "require" !== expression.escapedText) return !1; if (1 !== args.length) return !1; var arg = args[0]; return !checkArgumentIsStringLiteralLike || ts.isStringLiteralLike(arg) } function isSingleOrDoubleQuote(charCode) { return 39 === charCode || 34 === charCode } function isStringDoubleQuoted(str, sourceFile) { return 34 === getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) } function getJSInitializerSymbol(symbol) { if (!symbol || !symbol.valueDeclaration) return symbol; var declaration = symbol.valueDeclaration, e = getDeclaredJavascriptInitializer(declaration) || getAssignedJavascriptInitializer(declaration); return e && e.symbol ? e.symbol : symbol } function getDeclaredJavascriptInitializer(node) { if (node && ts.isVariableDeclaration(node) && node.initializer) return getJavascriptInitializer(node.initializer, !1) || ts.isIdentifier(node.name) && getDefaultedJavascriptInitializer(node.name, node.initializer, !1) } function getAssignedJavascriptInitializer(node) { if (node && node.parent && ts.isBinaryExpression(node.parent) && 58 === node.parent.operatorToken.kind) { var isPrototypeAssignment = isPrototypeAccess(node.parent.left); return getJavascriptInitializer(node.parent.right, isPrototypeAssignment) || getDefaultedJavascriptInitializer(node.parent.left, node.parent.right, isPrototypeAssignment) } } function getJavascriptInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); return 191 === e.kind || 192 === e.kind ? initializer : void 0 } return 191 === initializer.kind || 204 === initializer.kind || 192 === initializer.kind ? initializer : ts.isObjectLiteralExpression(initializer) && (0 === initializer.properties.length || isPrototypeAssignment) ? initializer : void 0 } function getDefaultedJavascriptInitializer(name, initializer, isPrototypeAssignment) { var e = ts.isBinaryExpression(initializer) && 54 === initializer.operatorToken.kind && getJavascriptInitializer(initializer.right, isPrototypeAssignment); if (e && isSameEntityName(name, initializer.left)) return e } function getOuterNameOfJsInitializer(node) { if (ts.isBinaryExpression(node.parent)) { var parent = 54 === node.parent.operatorToken.kind && ts.isBinaryExpression(node.parent.parent) ? node.parent.parent : node.parent; if (58 === parent.operatorToken.kind && ts.isIdentifier(parent.left)) return parent.left } else if (ts.isVariableDeclaration(node.parent)) return node.parent.name } function isSameEntityName(name, initializer) { return ts.isIdentifier(name) && ts.isIdentifier(initializer) ? name.escapedText === initializer.escapedText : ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer) ? (99 === initializer.expression.kind || ts.isIdentifier(initializer.expression) && ("window" === initializer.expression.escapedText || "self" === initializer.expression.escapedText || "global" === initializer.expression.escapedText)) && isSameEntityName(name, initializer.name) : !(!ts.isPropertyAccessExpression(name) || !ts.isPropertyAccessExpression(initializer)) && (name.name.escapedText === initializer.name.escapedText && isSameEntityName(name.expression, initializer.expression)) } function getRightMostAssignedExpression(node) { for (; isAssignmentExpression(node, !0);)node = node.right; return node } function isExportsIdentifier(node) { return ts.isIdentifier(node) && "exports" === node.escapedText } function isModuleExportsPropertyAccessExpression(node) { return ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && "module" === node.expression.escapedText && "exports" === node.name.escapedText } function getSpecialPropertyAssignmentKind(expr) { if (!isInJavaScriptFile(expr) || 58 !== expr.operatorToken.kind || !ts.isPropertyAccessExpression(expr.left)) return 0; var lhs = expr.left; if (99 === lhs.expression.kind) return 4; if (ts.isIdentifier(lhs.expression) && "module" === lhs.expression.escapedText && "exports" === lhs.name.escapedText) return 2; if (isEntityNameExpression(lhs.expression)) { if ("prototype" === lhs.name.escapedText && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) return 6; if (isPrototypeAccess(lhs.expression)) return 3; for (var nextToLast = lhs; ts.isPropertyAccessExpression(nextToLast.expression);)nextToLast = nextToLast.expression; ts.Debug.assert(ts.isIdentifier(nextToLast.expression)); var id = nextToLast.expression; return "exports" === id.escapedText || "module" === id.escapedText && "exports" === nextToLast.name.escapedText ? 1 : 5 } return 0 } function getInitializerOfBinaryExpression(expr) { for (; ts.isBinaryExpression(expr.right);)expr = expr.right; return expr.right } function isPrototypePropertyAssignment(node) { return ts.isBinaryExpression(node) && 3 === getSpecialPropertyAssignmentKind(node) } function isSpecialPropertyDeclaration(expr) { return isInJavaScriptFile(expr) && expr.parent && 215 === expr.parent.kind && !!ts.getJSDocTypeTag(expr.parent) } function importFromModuleSpecifier(node) { return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent)) } function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { case 243: case 249: return node.parent; case 253: return node.parent.parent; case 186: return node.parent; case 177: return ts.Debug.assert(ts.isStringLiteral(node)), ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: return } } function getExternalModuleName(node) { switch (node.kind) { case 243: case 249: return node.moduleSpecifier; case 242: return 253 === node.moduleReference.kind ? node.moduleReference.expression : void 0; case 178: return isLiteralImportTypeNode(node) ? node.argument.literal : void 0; default: return ts.Debug.assertNever(node) } } function getNamespaceDeclarationNode(node) { switch (node.kind) { case 243: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); case 242: return node; case 249: return; default: return ts.Debug.assertNever(node) } } function isDefaultImport(node) { return 243 === node.kind && node.importClause && !!node.importClause.name } function hasQuestionToken(node) { if (node) switch (node.kind) { case 148: case 153: case 152: case 270: case 269: case 151: case 150: return void 0 !== node.questionToken }return !1 } function isJSDocConstructSignature(node) { return 283 === node.kind && node.parameters.length > 0 && node.parameters[0].name && "new" === node.parameters[0].name.escapedText } function isJSDocTypeAlias(node) { return 296 === node.kind || 291 === node.kind } function isTypeAlias(node) { return isJSDocTypeAlias(node) || ts.isTypeAliasDeclaration(node) } function getSourceOfAssignment(node) { return ts.isExpressionStatement(node) && node.expression && ts.isBinaryExpression(node.expression) && 58 === node.expression.operatorToken.kind && node.expression.right } function getSourceOfDefaultedAssignment(node) { return ts.isExpressionStatement(node) && ts.isBinaryExpression(node.expression) && 0 !== getSpecialPropertyAssignmentKind(node.expression) && ts.isBinaryExpression(node.expression.right) && 54 === node.expression.right.operatorToken.kind && node.expression.right.right } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { case 213: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; case 151: return node.initializer; case 269: return node.initializer } } function getSingleVariableOfVariableStatement(node) { return ts.isVariableStatement(node) && node.declarationList.declarations.length > 0 && node.declarationList.declarations[0] } function getNestedModuleDeclaration(node) { return 238 === node.kind && node.body && 238 === node.body.kind && node.body } function getJSDocCommentsAndTags(hostNode) { function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; parent && ((269 === parent.kind || 151 === parent.kind || getNestedModuleDeclaration(parent)) && getJSDocCommentsAndTagsWorker(parent), parent.parent && getSingleVariableOfVariableStatement(parent.parent) === node && getJSDocCommentsAndTagsWorker(parent.parent), parent.parent && parent.parent.parent && (getSingleVariableOfVariableStatement(parent.parent.parent) || getSingleInitializerOfVariableStatementOrPropertyDeclaration(parent.parent.parent) === node || getSourceOfDefaultedAssignment(parent.parent.parent)) && getJSDocCommentsAndTagsWorker(parent.parent.parent), (ts.isBinaryExpression(node) && 58 === node.operatorToken.kind || ts.isBinaryExpression(parent) && 58 === parent.operatorToken.kind || 184 === node.kind && node.parent && 215 === node.parent.kind) && getJSDocCommentsAndTagsWorker(parent), 148 === node.kind && (result = ts.addRange(result, ts.getJSDocParameterTags(node))), isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer) && (result = ts.addRange(result, node.initializer.jsDoc)), ts.hasJSDocNodes(node) && (result = ts.addRange(result, node.jsDoc))) } var result; return getJSDocCommentsAndTagsWorker(hostNode), result || ts.emptyArray } function getParameterSymbolFromJSDoc(node) { if (node.symbol) return node.symbol; if (ts.isIdentifier(node.name)) { var name = node.name.escapedText, decl = getHostSignatureFromJSDoc(node); if (decl) { var parameter = ts.find(decl.parameters, function (p) { return 71 === p.name.kind && p.name.escapedText === name }); return parameter && parameter.symbol } } } function getHostSignatureFromJSDoc(node) { return getHostSignatureFromJSDocHost(getJSDocHost(node)) } function getHostSignatureFromJSDocHost(host) { var decl = getSourceOfDefaultedAssignment(host) || getSourceOfAssignment(host) || getSingleInitializerOfVariableStatementOrPropertyDeclaration(host) || getSingleVariableOfVariableStatement(host) || getNestedModuleDeclaration(host) || host; return decl && ts.isFunctionLike(decl) ? decl : void 0 } function getJSDocHost(node) { return ts.Debug.assertDefined(ts.findAncestor(node.parent, ts.isJSDoc)).parent } function getTypeParameterFromJsDoc(node) { var name = node.name.escapedText, typeParameters = node.parent.parent.parent.typeParameters; return ts.find(typeParameters, function (p) { return p.name.escapedText === name }) } function hasRestParameter(s) { var last = ts.lastOrUndefined(s.parameters); return last && isRestParameter(last) } function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? node.typeExpression && node.typeExpression.type : node.type; return void 0 !== node.dotDotDotToken || type && 284 === type.kind } function getAssignmentTargetKind(node) { for (var parent = node.parent; ;) { switch (parent.kind) { case 199: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? 58 === binaryOperator ? 1 : 2 : 0; case 197: case 198: var unaryOperator = parent.operator; return 43 === unaryOperator || 44 === unaryOperator ? 2 : 0; case 220: case 221: return parent.initializer === node ? 1 : 0; case 190: case 182: case 203: case 208: node = parent; break; case 270: if (parent.name !== node) return 0; node = parent.parent; break; case 269: if (parent.name === node) return 0; node = parent.parent; break; default: return 0 }parent = node.parent } } function isAssignmentTarget(node) { return 0 !== getAssignmentTargetKind(node) } function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { case 212: case 213: case 225: case 216: case 226: case 240: case 265: case 266: case 227: case 219: case 220: case 221: case 217: case 218: case 229: case 268: return !0 }return !1 } function isValueSignatureDeclaration(node) { return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isMethodOrAccessor(node) || ts.isFunctionDeclaration(node) || ts.isConstructorDeclaration(node) } function walkUp(node, kind) { for (; node && node.kind === kind;)node = node.parent; return node } function walkUpParenthesizedTypes(node) { return walkUp(node, 172) } function walkUpParenthesizedExpressions(node) { return walkUp(node, 190) } function skipParentheses(node) { for (; 190 === node.kind;)node = node.expression; return node } function isDeleteTarget(node) { return (184 === node.kind || 185 === node.kind) && (node = walkUpParenthesizedExpressions(node.parent), node && 193 === node.kind) } function isNodeDescendantOf(node, ancestor) { for (; node;) { if (node === ancestor) return !0; node = node.parent } return !1 } function isDeclarationName(name) { return !ts.isSourceFile(name) && !ts.isBindingPattern(name) && ts.isDeclaration(name.parent) && name.parent.name === name } function isAnyDeclarationName(name) { switch (name.kind) { case 71: case 9: case 8: if (ts.isDeclaration(name.parent)) return name.parent.name === name; if (ts.isQualifiedName(name.parent)) { var tag = name.parent.parent; return ts.isJSDocParameterTag(tag) && tag.name === name.parent } var binExp = name.parent.parent; return ts.isBinaryExpression(binExp) && 0 !== getSpecialPropertyAssignmentKind(binExp) && ts.getNameOfDeclaration(binExp) === name; default: return !1 } } function isLiteralComputedPropertyDeclarationName(node) { return (9 === node.kind || 8 === node.kind) && 146 === node.parent.kind && ts.isDeclaration(node.parent.parent) } function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { case 151: case 150: case 153: case 152: case 155: case 156: case 272: case 269: case 184: return parent.name === node; case 145: if (parent.right === node) { for (; 145 === parent.kind;)parent = parent.parent; return 164 === parent.kind || 161 === parent.kind } return !1; case 181: case 247: return parent.propertyName === node; case 251: case 261: return !0 }return !1 } function isAliasSymbolDeclaration(node) { return 242 === node.kind || 241 === node.kind || 244 === node.kind && !!node.name || 245 === node.kind || 247 === node.kind || 251 === node.kind || 248 === node.kind && exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && 2 === getSpecialPropertyAssignmentKind(node) } function exportAssignmentIsAlias(node) { var e = ts.isExportAssignment(node) ? node.expression : node.right; return isEntityNameExpression(e) || ts.isClassExpression(e) } function getClassExtendsHeritageClauseElement(node) { var heritageClause = getHeritageClause(node.heritageClauses, 85); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : void 0 } function getClassImplementsHeritageClauseElements(node) { var heritageClause = getHeritageClause(node.heritageClauses, 108); return heritageClause ? heritageClause.types : void 0 } function getAllSuperTypeNodes(node) { return ts.isInterfaceDeclaration(node) ? getInterfaceBaseTypeNodes(node) || ts.emptyArray : ts.isClassLike(node) ? ts.concatenate(ts.singleElementArray(getClassExtendsHeritageClauseElement(node)), getClassImplementsHeritageClauseElements(node)) || ts.emptyArray : ts.emptyArray } function getInterfaceBaseTypeNodes(node) { var heritageClause = getHeritageClause(node.heritageClauses, 85); return heritageClause ? heritageClause.types : void 0 } function getHeritageClause(clauses, kind) { if (clauses) for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { var clause = clauses_1[_i]; if (clause.token === kind) return clause } } function tryResolveScriptReference(host, sourceFile, reference) { if (!host.getCompilerOptions().noResolve) { var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); return host.getSourceFile(referenceFileName) } } function getAncestor(node, kind) { for (; node;) { if (node.kind === kind) return node; node = node.parent } } function isKeyword(token) { return 72 <= token && token <= 144 } function isContextualKeyword(token) { return 117 <= token && token <= 144 } function isNonContextualKeyword(token) { return isKeyword(token) && !isContextualKeyword(token) } function isStringANonContextualKeyword(name) { var token = ts.stringToToken(name); return void 0 !== token && isNonContextualKeyword(token) } function isTrivia(token) { return 2 <= token && token <= 7 } function getFunctionFlags(node) { if (!node) return 4; var flags = 0; switch (node.kind) { case 233: case 191: case 153: node.asteriskToken && (flags |= 1); case 192: hasModifier(node, 256) && (flags |= 2) }return node.body || (flags |= 4), flags } function isAsyncFunction(node) { switch (node.kind) { case 233: case 191: case 192: case 153: return void 0 !== node.body && void 0 === node.asteriskToken && hasModifier(node, 256) }return !1 } function isStringOrNumericLiteral(node) { var kind = node.kind; return 9 === kind || 8 === kind } function hasDynamicName(declaration) { var name = ts.getNameOfDeclaration(declaration); return name && isDynamicName(name) } function isDynamicName(name) { return 146 === name.kind && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression) } function isWellKnownSymbolSyntactically(node) { return ts.isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression) } function getPropertyNameForPropertyNameNode(name) { if (71 === name.kind) return name.escapedText; if (9 === name.kind || 8 === name.kind) return escapeLeadingUnderscores(name.text); if (146 === name.kind) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name)); if (9 === nameExpression.kind || 8 === nameExpression.kind) return escapeLeadingUnderscores(nameExpression.text) } } function isPropertyNameLiteral(node) { switch (node.kind) { case 71: case 9: case 13: case 8: return !0; default: return !1 } } function getTextOfIdentifierOrLiteral(node) { return 71 === node.kind ? ts.idText(node) : node.text } function getEscapedTextOfIdentifierOrLiteral(node) { return 71 === node.kind ? node.escapedText : escapeLeadingUnderscores(node.text) } function getPropertyNameForKnownSymbolName(symbolName) { return "__@" + symbolName } function isKnownSymbol(symbol) { return ts.startsWith(symbol.escapedName, "__@") } function isESSymbolIdentifier(node) { return 71 === node.kind && "Symbol" === node.escapedText } function isPushOrUnshiftIdentifier(node) { return "push" === node.escapedText || "unshift" === node.escapedText } function isParameterDeclaration(node) { var root = getRootDeclaration(node); return 148 === root.kind } function getRootDeclaration(node) { for (; 181 === node.kind;)node = node.parent.parent; return node } function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; return 154 === kind || 191 === kind || 233 === kind || 192 === kind || 153 === kind || 155 === kind || 156 === kind || 238 === kind || 273 === kind } function nodeIsSynthesized(range) { return ts.positionIsSynthesized(range.pos) || ts.positionIsSynthesized(range.end) } function getOriginalSourceFile(sourceFile) { return ts.getParseTreeNode(sourceFile, ts.isSourceFile) || sourceFile } function getExpressionAssociativity(expression) { var operator = getOperator(expression), hasArguments = 187 === expression.kind && void 0 !== expression.arguments; return getOperatorAssociativity(expression.kind, operator, hasArguments) } function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { case 187: return hasArguments ? 0 : 1; case 197: case 194: case 195: case 193: case 196: case 200: case 202: return 1; case 199: switch (operator) { case 40: case 58: case 59: case 60: case 62: case 61: case 63: case 64: case 65: case 66: case 67: case 68: case 70: case 69: return 1 } }return 0 } function getExpressionPrecedence(expression) { var operator = getOperator(expression), hasArguments = 187 === expression.kind && void 0 !== expression.arguments; return getOperatorPrecedence(expression.kind, operator, hasArguments) } function getOperator(expression) { return 199 === expression.kind ? expression.operatorToken.kind : 197 === expression.kind || 198 === expression.kind ? expression.operator : expression.kind } function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { case 301: return 0; case 203: return 1; case 202: return 2; case 200: return 4; case 199: switch (operatorKind) { case 26: return 0; case 58: case 59: case 60: case 62: case 61: case 63: case 64: case 65: case 66: case 67: case 68: case 70: case 69: return 3; default: return getBinaryOperatorPrecedence(operatorKind) }case 197: case 194: case 195: case 193: case 196: return 16; case 198: return 17; case 186: return 18; case 187: return hasArguments ? 19 : 18; case 188: case 184: case 185: return 19; case 99: case 97: case 71: case 95: case 101: case 86: case 8: case 9: case 182: case 183: case 191: case 192: case 204: case 254: case 255: case 258: case 12: case 13: case 201: case 190: case 205: return 20; default: return -1 } } function getBinaryOperatorPrecedence(kind) { switch (kind) { case 54: return 5; case 53: return 6; case 49: return 7; case 50: return 8; case 48: return 9; case 32: case 33: case 34: case 35: return 10; case 27: case 29: case 30: case 31: case 93: case 92: case 118: return 11; case 45: case 46: case 47: return 12; case 37: case 38: return 13; case 39: case 41: case 42: return 14; case 40: return 15 }return -1 } function createDiagnosticCollection() { function reattachFileDiagnostics(newFile) { ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile }) } function add(diagnostic) { var diagnostics; diagnostic.file ? (diagnostics = fileDiagnostics.get(diagnostic.file.fileName), diagnostics || (diagnostics = [], fileDiagnostics.set(diagnostic.file.fileName, diagnostics), ts.insertSorted(filesWithDiagnostics, diagnostic.file.fileName, ts.compareStringsCaseSensitive))) : (hasReadNonFileDiagnostics && (hasReadNonFileDiagnostics = !1, nonFileDiagnostics = nonFileDiagnostics.slice()), diagnostics = nonFileDiagnostics), ts.insertSorted(diagnostics, diagnostic, ts.compareDiagnostics) } function getGlobalDiagnostics() { return hasReadNonFileDiagnostics = !0, nonFileDiagnostics } function getDiagnostics(fileName) { if (fileName) return fileDiagnostics.get(fileName) || []; var fileDiags = ts.flatMap(filesWithDiagnostics, function (f) { return fileDiagnostics.get(f) }); return nonFileDiagnostics.length ? (fileDiags.unshift.apply(fileDiags, nonFileDiagnostics), fileDiags) : fileDiags } var nonFileDiagnostics = [], filesWithDiagnostics = [], fileDiagnostics = ts.createMap(), hasReadNonFileDiagnostics = !1; return { add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, reattachFileDiagnostics: reattachFileDiagnostics } } function escapeString(s, quoteChar) { var escapedCharsRegExp = 96 === quoteChar ? backtickQuoteEscapedCharsRegExp : 39 === quoteChar ? singleQuoteEscapedCharsRegExp : doubleQuoteEscapedCharsRegExp; return s.replace(escapedCharsRegExp, getReplacement) } function getReplacement(c, offset, input) { if (0 === c.charCodeAt(0)) { var lookAhead = input.charCodeAt(offset + c.length); return lookAhead >= 48 && lookAhead <= 57 ? "\\x00" : "\\0" } return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)) } function isIntrinsicJsxName(name) { var ch = name.charCodeAt(0); return ch >= 97 && ch <= 122 || name.indexOf("-") > -1 } function get16BitUnicodeEscapeSequence(charCode) { var hexCharCode = charCode.toString(16).toUpperCase(), paddedHexCode = ("0000" + hexCharCode).slice(-4); return "\\u" + paddedHexCode } function escapeNonAsciiString(s, quoteChar) { return s = escapeString(s, quoteChar), nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)) }) : s } function getIndentString(level) { return void 0 === indentStrings[level] && (indentStrings[level] = getIndentString(level - 1) + indentStrings[1]), indentStrings[level] } function getIndentSize() { return indentStrings[1].length } function createTextWriter(newLine) { function write(s) { s && s.length && (lineStart && (output += getIndentString(indent), lineStart = !1), output += s) } function reset() { output = "", indent = 0, lineStart = !0, lineCount = 0, linePos = 0 } function rawWrite(s) { void 0 !== s && (lineStart && (lineStart = !1), output += s) } function writeLiteral(s) { if (s && s.length) { write(s); var lineStartsOfS = ts.computeLineStarts(s); lineStartsOfS.length > 1 && (lineCount = lineCount + lineStartsOfS.length - 1, linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS)) } } function writeLine() { lineStart || (output += newLine, lineCount++ , linePos = output.length, lineStart = !0) } function writeTextOfNode(text, node) { write(getTextOfNodeFromSourceText(text, node)) } var output, indent, lineStart, lineCount, linePos; return reset(), { write: write, rawWrite: rawWrite, writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, increaseIndent: function () { indent++ }, decreaseIndent: function () { indent-- }, getIndent: function () { return indent }, getTextPos: function () { return output.length }, getLine: function () { return lineCount + 1 }, getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1 }, getText: function () { return output }, isAtStartOfLine: function () { return lineStart }, clear: reset, reportInaccessibleThisError: ts.noop, reportPrivateInBaseOfClassExpression: ts.noop, reportInaccessibleUniqueSymbolError: ts.noop, trackSymbol: ts.noop, writeKeyword: write, writeOperator: write, writeParameter: write, writeProperty: write, writePunctuation: write, writeSpace: write, writeStringLiteral: write, writeSymbol: write } } function getResolvedExternalModuleName(host, file, referenceFile) { return file.moduleName || getExternalModuleNameFromPath(host, file.fileName, referenceFile && referenceFile.fileName) } function getExternalModuleNameFromDeclaration(host, resolver, declaration) { var file = resolver.getExternalModuleFileFromDeclaration(declaration); if (file && !file.isDeclarationFile) return getResolvedExternalModuleName(host, file) } function getExternalModuleNameFromPath(host, fileName, referencePath) { var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f) }, dir = ts.toPath(referencePath ? ts.getDirectoryPath(referencePath) : host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName), filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()), relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, !1), extensionless = ts.removeFileExtension(relativePath); return referencePath ? ts.ensurePathIsNonModuleName(extensionless) : extensionless } function getOwnEmitOutputFilePath(sourceFile, host, extension) { var emitOutputFilePathWithoutExtension, compilerOptions = host.getCompilerOptions(); return emitOutputFilePathWithoutExtension = compilerOptions.outDir ? ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)) : ts.removeFileExtension(sourceFile.fileName), emitOutputFilePathWithoutExtension + extension } function getDeclarationEmitOutputFilePath(sourceFile, host) { var options = host.getCompilerOptions(), outputDir = options.declarationDir || options.outDir, path = outputDir ? getSourceFilePathInNewDir(sourceFile, host, outputDir) : sourceFile.fileName; return ts.removeFileExtension(path) + ".d.ts" } function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(), isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file) }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options), moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; return ts.filter(host.getSourceFiles(), function (sourceFile) { return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) }) } var sourceFiles = void 0 === targetSourceFile ? host.getSourceFiles() : [targetSourceFile]; return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) }) } function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile) || sourceFile.isDeclarationFile || isSourceFileFromExternalLibrary(sourceFile)) } function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()), commonSourceDirectory = host.getCommonSourceDirectory(), isSourceFileInCommonSourceDirectory = 0 === host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)); return sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath, ts.combinePaths(newDirPath, sourceFilePath) } function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)) }, sourceFiles) } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line } function getLineOfLocalPositionFromLineMap(lineMap, pos) { return ts.computeLineAndCharacterOfPosition(lineMap, pos).line } function getFirstConstructorWithBody(node) { return ts.find(node.members, function (member) { return ts.isConstructorDeclaration(member) && nodeIsPresent(member.body) }) } function getSetAccessorValueParameter(accessor) { if (accessor && accessor.parameters.length > 0) { var hasThis = 2 === accessor.parameters.length && parameterIsThisKeyword(accessor.parameters[0]); return accessor.parameters[hasThis ? 1 : 0] } } function getSetAccessorTypeAnnotationNode(accessor) { var parameter = getSetAccessorValueParameter(accessor); return parameter && parameter.type } function getThisParameter(signature) { if (signature.parameters.length && !ts.isJSDocSignature(signature)) { var thisParameter = signature.parameters[0]; if (parameterIsThisKeyword(thisParameter)) return thisParameter } } function parameterIsThisKeyword(parameter) { return isThisIdentifier(parameter.name) } function isThisIdentifier(node) { return node && 71 === node.kind && identifierIsThisKeyword(node) } function identifierIsThisKeyword(id) { return 99 === id.originalKeywordKind } function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor, secondAccessor, getAccessor, setAccessor; return hasDynamicName(accessor) ? (firstAccessor = accessor, 155 === accessor.kind ? getAccessor = accessor : 156 === accessor.kind ? setAccessor = accessor : ts.Debug.fail("Accessor has wrong kind")) : ts.forEach(declarations, function (member) { if ((155 === member.kind || 156 === member.kind) && hasModifier(member, 32) === hasModifier(accessor, 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name), accessorName = getPropertyNameForPropertyNameNode(accessor.name); memberName === accessorName && (firstAccessor ? secondAccessor || (secondAccessor = member) : firstAccessor = member, 155 !== member.kind || getAccessor || (getAccessor = member), 156 !== member.kind || setAccessor || (setAccessor = member)) } }), { firstAccessor: firstAccessor, secondAccessor: secondAccessor, getAccessor: getAccessor, setAccessor: setAccessor } } function getEffectiveTypeAnnotationNode(node) { return node.type || (isInJavaScriptFile(node) ? ts.getJSDocType(node) : void 0) } function getTypeAnnotationNode(node) { return node.type } function getEffectiveReturnTypeNode(node) { return ts.isJSDocSignature(node) ? node.type && node.type.typeExpression && node.type.typeExpression.type : node.type || (isInJavaScriptFile(node) ? ts.getJSDocReturnType(node) : void 0) } function getEffectiveTypeParameterDeclarations(node) { if (ts.isJSDocSignature(node)) return ts.emptyArray; if (isJSDocTypeAlias(node)) { ts.Debug.assert(285 === node.parent.kind); var templateTags = ts.flatMap(ts.filter(node.parent.tags, ts.isJSDocTemplateTag), function (tag) { return tag.typeParameters }), templateTagNodes = templateTags; return templateTagNodes.pos = templateTagNodes.length > 0 ? ts.first(templateTagNodes).pos : node.pos, templateTagNodes.end = templateTagNodes.length > 0 ? ts.last(templateTagNodes).end : node.end, templateTagNodes.hasTrailingComma = !1, templateTagNodes } return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : ts.emptyArray) } function getJSDocTypeParameterDeclarations(node) { var tag = ts.find(ts.getJSDocTags(node), function (tag) { return ts.isJSDocTemplateTag(tag) && !(285 === tag.parent.kind && tag.parent.tags.some(isJSDocTypeAlias)) }); return tag && tag.typeParameters || ts.emptyArray } function getEffectiveSetAccessorTypeAnnotationNode(node) { var parameter = getSetAccessorValueParameter(node); return parameter && getEffectiveTypeAnnotationNode(parameter) } function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments) } function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) { leadingComments && leadingComments.length && pos !== leadingComments[0].pos && getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos) && writer.writeLine() } function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) { pos !== commentPos && getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos) && writer.writeLine() } function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) { if (comments && comments.length > 0) { leadingSeparator && writer.write(" "); for (var emitInterveningSeparator = !1, _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { var comment = comments_1[_i]; emitInterveningSeparator && (writer.write(" "), emitInterveningSeparator = !1), writeComment(text, lineMap, writer, comment.pos, comment.end, newLine), comment.hasTrailingNewLine ? writer.writeLine() : emitInterveningSeparator = !0 } emitInterveningSeparator && trailingSeparator && writer.write(" ") } } function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { function isPinnedCommentLocal(comment) { return isPinnedComment(text, comment.pos) } var leadingComments, currentDetachedCommentInfo; if (removeComments ? 0 === node.pos && (leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedCommentLocal)) : leadingComments = ts.getLeadingCommentRanges(text, node.pos), leadingComments) { for (var detachedComments = [], lastComment = void 0, _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end), commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); if (commentLine >= lastCommentLine + 2) break } detachedComments.push(comment), lastComment = comment } if (detachedComments.length) { var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end), nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); nodeLine >= lastCommentLine + 2 && (emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments), emitComments(text, lineMap, writer, detachedComments, !1, !0, newLine, writeComment), currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }) } } return currentDetachedCommentInfo } function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) { if (42 === text.charCodeAt(commentPos + 1)) for (var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos), lineCount = lineMap.length, firstCommentLineIndent = void 0, pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) { var nextLineStart = currentLine + 1 === lineCount ? text.length + 1 : lineMap[currentLine + 1]; if (pos !== commentPos) { void 0 === firstCommentLineIndent && (firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos)); var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(), spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); if (spacesToEmit > 0) { var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(), indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); for (writer.rawWrite(indentSizeSpaceString); numberOfSingleSpacesToEmit;)writer.rawWrite(" "), numberOfSingleSpacesToEmit-- } else writer.rawWrite("") } writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart), pos = nextLineStart } else writer.write(text.substring(commentPos, commentEnd)) } function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) { var end = Math.min(commentEnd, nextLineStart - 1), currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); currentLineText ? (writer.write(currentLineText), end !== commentEnd && writer.writeLine()) : writer.writeLiteral(newLine) } function calculateIndent(text, pos, end) { for (var currentLineIndent = 0; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++)9 === text.charCodeAt(pos) ? currentLineIndent += getIndentSize() - currentLineIndent % getIndentSize() : currentLineIndent++; return currentLineIndent } function hasModifiers(node) { return 0 !== getModifierFlags(node) } function hasModifier(node, flags) { return !!getSelectedModifierFlags(node, flags) } function hasStaticModifier(node) { return hasModifier(node, 32) } function hasReadonlyModifier(node) { return hasModifier(node, 64) } function getSelectedModifierFlags(node, flags) { return getModifierFlags(node) & flags } function getModifierFlags(node) { if (536870912 & node.modifierFlagsCache) return node.modifierFlagsCache & -536870913; var flags = getModifierFlagsNoCache(node); return node.modifierFlagsCache = 536870912 | flags, flags } function getModifierFlagsNoCache(node) { var flags = 0; if (node.modifiers) for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; flags |= modifierToFlag(modifier.kind) } return (4 & node.flags || 71 === node.kind && node.isInJSDocNamespace) && (flags |= 1), flags } function modifierToFlag(token) { switch (token) { case 115: return 32; case 114: return 4; case 113: return 16; case 112: return 8; case 117: return 128; case 84: return 1; case 124: return 2; case 76: return 2048; case 79: return 512; case 120: return 256; case 132: return 64 }return 0 } function isLogicalOperator(token) { return 54 === token || 53 === token || 51 === token } function isAssignmentOperator(token) { return token >= 58 && token <= 70 } function tryGetClassExtendingExpressionWithTypeArguments(node) { if (206 === node.kind && 85 === node.parent.token && ts.isClassLike(node.parent.parent)) return node.parent.parent } function isAssignmentExpression(node, excludeCompoundAssignment) { return ts.isBinaryExpression(node) && (excludeCompoundAssignment ? 58 === node.operatorToken.kind : isAssignmentOperator(node.operatorToken.kind)) && ts.isLeftHandSideExpression(node.left) } function isDestructuringAssignment(node) { if (isAssignmentExpression(node, !0)) { var kind = node.left.kind; return 183 === kind || 182 === kind } return !1 } function isExpressionWithTypeArgumentsInClassExtendsClause(node) { return void 0 !== tryGetClassExtendingExpressionWithTypeArguments(node) } function isExpressionWithTypeArgumentsInClassImplementsClause(node) { return 206 === node.kind && isEntityNameExpression(node.expression) && node.parent && 108 === node.parent.token && node.parent.parent && ts.isClassLike(node.parent.parent) } function isEntityNameExpression(node) { return 71 === node.kind || isPropertyAccessEntityNameExpression(node) } function isPropertyAccessEntityNameExpression(node) { return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression) } function isPrototypeAccess(node) { return ts.isPropertyAccessExpression(node) && "prototype" === node.name.escapedText } function isRightSideOfQualifiedNameOrPropertyAccess(node) { return 145 === node.parent.kind && node.parent.right === node || 184 === node.parent.kind && node.parent.name === node } function isEmptyObjectLiteral(expression) { return 183 === expression.kind && 0 === expression.properties.length } function isEmptyArrayLiteral(expression) { return 182 === expression.kind && 0 === expression.elements.length } function getLocalSymbolForExportDefault(symbol) { return isExportDefaultSymbol(symbol) ? symbol.declarations[0].localSymbol : void 0 } function isExportDefaultSymbol(symbol) { return symbol && ts.length(symbol.declarations) > 0 && hasModifier(symbol.declarations[0], 512) } function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension) }) } function getExpandedCharCodes(input) { for (var output = [], length = input.length, i = 0; i < length; i++) { var charCode = input.charCodeAt(i); charCode < 128 ? output.push(charCode) : charCode < 2048 ? (output.push(charCode >> 6 | 192), output.push(63 & charCode | 128)) : charCode < 65536 ? (output.push(charCode >> 12 | 224), output.push(charCode >> 6 & 63 | 128), output.push(63 & charCode | 128)) : charCode < 131072 ? (output.push(charCode >> 18 | 240), output.push(charCode >> 12 & 63 | 128), output.push(charCode >> 6 & 63 | 128), output.push(63 & charCode | 128)) : ts.Debug.assert(!1, "Unexpected code point") } return output } function convertToBase64(input) { for (var byte1, byte2, byte3, byte4, result = "", charCodes = getExpandedCharCodes(input), i = 0, length = charCodes.length; i < length;)byte1 = charCodes[i] >> 2, byte2 = (3 & charCodes[i]) << 4 | charCodes[i + 1] >> 4, byte3 = (15 & charCodes[i + 1]) << 2 | charCodes[i + 2] >> 6, byte4 = 63 & charCodes[i + 2], i + 1 >= length ? byte3 = byte4 = 64 : i + 2 >= length && (byte4 = 64), result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4), i += 3; return result } function getStringFromExpandedCharCodes(codes) { for (var output = "", i = 0, length = codes.length; i < length;) { var charCode = codes[i]; if (charCode < 128) output += String.fromCharCode(charCode), i++; else if (192 === (192 & charCode)) { var value = 63 & charCode; i++; for (var nextCode = codes[i]; 128 === (192 & nextCode);)value = value << 6 | 63 & nextCode, i++ , nextCode = codes[i]; output += String.fromCharCode(value) } else output += String.fromCharCode(charCode), i++ } return output } function base64encode(host, input) { return host.base64encode ? host.base64encode(input) : convertToBase64(input) } function base64decode(host, input) { if (host.base64decode) return host.base64decode(input); for (var length = input.length, expandedCharCodes = [], i = 0; i < length && input.charCodeAt(i) !== base64Digits.charCodeAt(64);) { var ch1 = base64Digits.indexOf(input[i]), ch2 = base64Digits.indexOf(input[i + 1]), ch3 = base64Digits.indexOf(input[i + 2]), ch4 = base64Digits.indexOf(input[i + 3]), code1 = (63 & ch1) << 2 | ch2 >> 4 & 3, code2 = (15 & ch2) << 4 | ch3 >> 2 & 15, code3 = (3 & ch3) << 6 | 63 & ch4; 0 === code2 && 0 !== ch3 ? expandedCharCodes.push(code1) : 0 === code3 && 0 !== ch4 ? expandedCharCodes.push(code1, code2) : expandedCharCodes.push(code1, code2, code3), i += 4 } return getStringFromExpandedCharCodes(expandedCharCodes) } function getNewLineCharacter(options, getNewLine) { switch (options.newLine) { case 0: return carriageReturnLineFeed; case 1: return lineFeed }return getNewLine ? getNewLine() : ts.sys ? ts.sys.newLine : carriageReturnLineFeed } function formatEnum(value, enumObject, isFlags) { void 0 === value && (value = 0); var members = getEnumMembers(enumObject); if (0 === value) return members.length > 0 && 0 === members[0][0] ? members[0][1] : "0"; if (isFlags) { for (var result = "", remainingFlags = value, i = members.length - 1; i >= 0 && 0 !== remainingFlags; i--) { var _a = members[i], enumValue = _a[0], enumName = _a[1]; 0 !== enumValue && (remainingFlags & enumValue) === enumValue && (remainingFlags &= ~enumValue, result = "" + enumName + (result ? ", " : "") + result) } if (0 === remainingFlags) return result } else for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var _b = members_1[_i], enumValue = _b[0], enumName = _b[1]; if (enumValue === value) return enumName } return value.toString() } function getEnumMembers(enumObject) { var result = []; for (var name in enumObject) { var value = enumObject[name]; "number" == typeof value && result.push([value, name]) } return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]) }) } function formatSyntaxKind(kind) { return formatEnum(kind, ts.SyntaxKind, !1) } function formatModifierFlags(flags) { return formatEnum(flags, ts.ModifierFlags, !0) } function formatTransformFlags(flags) { return formatEnum(flags, ts.TransformFlags, !0) } function formatEmitFlags(flags) { return formatEnum(flags, ts.EmitFlags, !0) } function formatSymbolFlags(flags) { return formatEnum(flags, ts.SymbolFlags, !0) } function formatTypeFlags(flags) { return formatEnum(flags, ts.TypeFlags, !0) } function formatObjectFlags(flags) { return formatEnum(flags, ts.ObjectFlags, !0) } function createRange(pos, end) { return { pos: pos, end: end } } function moveRangeEnd(range, end) { return createRange(range.pos, end) } function moveRangePos(range, pos) { return createRange(pos, range.end) } function moveRangePastDecorators(node) { return node.decorators && node.decorators.length > 0 ? moveRangePos(node, node.decorators.end) : node } function moveRangePastModifiers(node) { return node.modifiers && node.modifiers.length > 0 ? moveRangePos(node, node.modifiers.end) : moveRangePastDecorators(node) } function isCollapsedRange(range) { return range.pos === range.end } function createTokenRange(pos, token) { return createRange(pos, pos + ts.tokenToString(token).length) } function rangeIsOnSingleLine(range, sourceFile) { return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile) } function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) { return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile) } function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) { return positionsAreOnSameLine(range1.end, range2.end, sourceFile) } function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) { return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile) } function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) { return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile) } function positionsAreOnSameLine(pos1, pos2, sourceFile) { return pos1 === pos2 || getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2) } function getStartPositionOfRange(range, sourceFile) { return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos) } function isDeclarationNameOfEnumOrNamespace(node) { var parseNode = ts.getParseTreeNode(node); if (parseNode) switch (parseNode.parent.kind) { case 237: case 238: return parseNode === parseNode.parent.name }return !1 } function getInitializedVariables(node) { return ts.filter(node.declarations, isInitializedVariable) } function isInitializedVariable(node) { return void 0 !== node.initializer } function isWatchSet(options) { return options.watch && options.hasOwnProperty("watch") } function getCheckFlags(symbol) { return 33554432 & symbol.flags ? symbol.checkFlags : 0 } function getDeclarationModifierFlagsFromSymbol(s) { if (s.valueDeclaration) { var flags = ts.getCombinedModifierFlags(s.valueDeclaration); return s.parent && 32 & s.parent.flags ? flags : flags & -29 } if (6 & getCheckFlags(s)) { var checkFlags = s.checkFlags, accessModifier = 256 & checkFlags ? 8 : 64 & checkFlags ? 4 : 16, staticModifier = 512 & checkFlags ? 32 : 0; return accessModifier | staticModifier } return 4194304 & s.flags ? 36 : 0 } function skipAlias(symbol, checker) { return 2097152 & symbol.flags ? checker.getAliasedSymbol(symbol) : symbol } function getCombinedLocalAndExportSymbolFlags(symbol) { return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags } function isWriteOnlyAccess(node) { return 1 === accessKind(node) } function isWriteAccess(node) { return 0 !== accessKind(node) } function accessKind(node) { function writeOrReadWrite() { return parent.parent && 215 === parent.parent.kind ? 1 : 2 } var parent = node.parent; if (!parent) return 0; switch (parent.kind) { case 198: case 197: var operator = parent.operator; return 43 === operator || 44 === operator ? writeOrReadWrite() : 0; case 199: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0; case 184: return parent.name !== node ? 0 : accessKind(parent); default: return 0 } } function compareDataObjects(dst, src) { if (!dst || !src || Object.keys(dst).length !== Object.keys(src).length) return !1; for (var e in dst) if ("object" == typeof dst[e]) { if (!compareDataObjects(dst[e], src[e])) return !1 } else if ("function" != typeof dst[e] && dst[e] !== src[e]) return !1; return !0 } function clearMap(map, onDeleteValue) { map.forEach(onDeleteValue), map.clear() } function mutateMap(map, newMap, options) { var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue; map.forEach(function (existingValue, key) { var valueInNewMap = newMap.get(key); void 0 === valueInNewMap ? (map.delete(key), onDeleteValue(existingValue, key)) : onExistingValue && onExistingValue(existingValue, valueInNewMap, key) }), newMap.forEach(function (valueInNewMap, key) { map.has(key) || map.set(key, createNewValue(key, valueInNewMap)) }) } function forEachAncestorDirectory(directory, callback) { for (; ;) { var result = callback(directory); if (void 0 !== result) return result; var parentPath = ts.getDirectoryPath(directory); if (parentPath === directory) return; directory = parentPath } } function isAbstractConstructorType(type) { return !!(16 & getObjectFlags(type)) && !!type.symbol && isAbstractConstructorSymbol(type.symbol) } function isAbstractConstructorSymbol(symbol) { if (32 & symbol.flags) { var declaration = getClassLikeDeclarationOfSymbol(symbol); return !!declaration && hasModifier(declaration, 128) } return !1 } function getClassLikeDeclarationOfSymbol(symbol) { return ts.find(symbol.declarations, ts.isClassLike) } function getObjectFlags(type) { return 65536 & type.flags ? type.objectFlags : 0 } function typeHasCallOrConstructSignatures(type, checker) { return 0 !== checker.getSignaturesOfType(type, 0).length || 0 !== checker.getSignaturesOfType(type, 1).length } function forSomeAncestorDirectory(directory, callback) { return !!forEachAncestorDirectory(directory, function (d) { return !!callback(d) || void 0 }) } function isUMDExportSymbol(symbol) { return symbol && symbol.declarations && symbol.declarations[0] && ts.isNamespaceExportDeclaration(symbol.declarations[0]) } function showModuleSpecifier(_a) { var moduleSpecifier = _a.moduleSpecifier; return ts.isStringLiteral(moduleSpecifier) ? moduleSpecifier.text : getTextOfNode(moduleSpecifier) } function getLastChild(node) { var lastChild; return ts.forEachChild(node, function (child) { nodeIsPresent(child) && (lastChild = child) }, function (children) { for (var i = children.length - 1; i >= 0; i--)if (nodeIsPresent(children[i])) { lastChild = children[i]; break } }), lastChild } function addToSeen(seen, key, value) { return void 0 === value && (value = !0), key = String(key), !seen.has(key) && (seen.set(key, value), !0) } function isObjectTypeDeclaration(node) { return ts.isClassLike(node) || ts.isInterfaceDeclaration(node) || ts.isTypeLiteralNode(node) } ts.resolvingEmptyArray = [], ts.emptyMap = ts.createMap(), ts.emptyUnderscoreEscapedMap = ts.emptyMap, ts.externalHelpersModuleNameText = "tslib", ts.getDeclarationOfKind = getDeclarationOfKind; var stringWriter = createSingleLineStringWriter(); ts.usingSingleLineStringWriter = usingSingleLineStringWriter, ts.getFullWidth = getFullWidth, ts.getResolvedModule = getResolvedModule, ts.setResolvedModule = setResolvedModule, ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective, ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo, ts.packageIdToString = packageIdToString, ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo, ts.hasChangesInResolutions = hasChangesInResolutions, ts.containsParseError = containsParseError, ts.getSourceFileOfNode = getSourceFileOfNode, ts.isStatementWithLocals = isStatementWithLocals, ts.getStartPositionOfLine = getStartPositionOfLine, ts.nodePosToString = nodePosToString, ts.getEndLinePosition = getEndLinePosition, ts.isFileLevelUniqueName = isFileLevelUniqueName, ts.nodeIsMissing = nodeIsMissing, ts.nodeIsPresent = nodeIsPresent, ts.prependStatements = prependStatements, ts.isRecognizedTripleSlashComment = isRecognizedTripleSlashComment, ts.isPinnedComment = isPinnedComment, ts.getTokenPosOfNode = getTokenPosOfNode, ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode, ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile, ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText, ts.getTextOfNode = getTextOfNode, ts.indexOfNode = indexOfNode, ts.getEmitFlags = getEmitFlags, ts.getLiteralText = getLiteralText, ts.getTextOfConstantValue = getTextOfConstantValue, ts.escapeLeadingUnderscores = escapeLeadingUnderscores, ts.escapeIdentifier = escapeIdentifier, ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName, ts.isBlockOrCatchScoped = isBlockOrCatchScoped, ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement, ts.isAmbientModule = isAmbientModule, ts.isModuleWithStringLiteralName = isModuleWithStringLiteralName, ts.isNonGlobalAmbientModule = isNonGlobalAmbientModule, ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol, ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel, ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation, ts.isExternalModuleAugmentation = isExternalModuleAugmentation, ts.isModuleAugmentationExternal = isModuleAugmentationExternal, ts.isEffectiveExternalModule = isEffectiveExternalModule, ts.isBlockScope = isBlockScope, ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters, ts.isAnyImportSyntax = isAnyImportSyntax, ts.isLateVisibilityPaintedStatement = isLateVisibilityPaintedStatement, ts.isAnyImportOrReExport = isAnyImportOrReExport, ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer, ts.declarationNameToString = declarationNameToString, ts.getNameFromIndexInfo = getNameFromIndexInfo, ts.getTextOfPropertyName = getTextOfPropertyName, ts.entityNameToString = entityNameToString, ts.createDiagnosticForNode = createDiagnosticForNode, ts.createDiagnosticForNodeArray = createDiagnosticForNodeArray, ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile, ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain, ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition, ts.getErrorSpanForNode = getErrorSpanForNode, ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule, ts.isJsonSourceFile = isJsonSourceFile, ts.isConstEnumDeclaration = isConstEnumDeclaration, ts.isConst = isConst, ts.isLet = isLet, ts.isSuperCall = isSuperCall, ts.isImportCall = isImportCall, ts.isLiteralImportTypeNode = isLiteralImportTypeNode, ts.isPrologueDirective = isPrologueDirective, ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode, ts.getJSDocCommentRanges = getJSDocCommentRanges, ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; ts.isPartOfTypeNode = isPartOfTypeNode, ts.isChildOfNodeWithKind = isChildOfNodeWithKind, ts.forEachReturnStatement = forEachReturnStatement, ts.forEachYieldExpression = forEachYieldExpression, ts.getRestParameterElementType = getRestParameterElementType, ts.getMembersOfDeclaration = getMembersOfDeclaration, ts.isVariableLike = isVariableLike, ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor, ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement, ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration, ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject, ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel, ts.isFunctionBlock = isFunctionBlock, ts.isObjectLiteralMethod = isObjectLiteralMethod, ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod, ts.isIdentifierTypePredicate = isIdentifierTypePredicate, ts.isThisTypePredicate = isThisTypePredicate, ts.getPropertyAssignment = getPropertyAssignment, ts.getTsConfigObjectLiteralExpression = getTsConfigObjectLiteralExpression, ts.getTsConfigPropArrayElementValue = getTsConfigPropArrayElementValue, ts.getTsConfigPropArray = getTsConfigPropArray, ts.getContainingFunction = getContainingFunction, ts.getContainingClass = getContainingClass, ts.getThisContainer = getThisContainer, ts.getNewTargetContainer = getNewTargetContainer, ts.getSuperContainer = getSuperContainer, ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression, ts.isSuperProperty = isSuperProperty, ts.isThisProperty = isThisProperty, ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode, ts.getInvokedExpression = getInvokedExpression, ts.nodeCanBeDecorated = nodeCanBeDecorated, ts.nodeIsDecorated = nodeIsDecorated, ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated, ts.childIsDecorated = childIsDecorated, ts.isJSXTagName = isJSXTagName, ts.isExpressionNode = isExpressionNode, ts.isInExpressionContext = isInExpressionContext, ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration, ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression, ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration, ts.isSourceFileJavaScript = isSourceFileJavaScript, ts.isSourceFileNotJavaScript = isSourceFileNotJavaScript, ts.isInJavaScriptFile = isInJavaScriptFile, ts.isInJsonFile = isInJsonFile, ts.isInJSDoc = isInJSDoc, ts.isJSDocIndexSignature = isJSDocIndexSignature, ts.isRequireCall = isRequireCall, ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote, ts.isStringDoubleQuoted = isStringDoubleQuoted, ts.getJSInitializerSymbol = getJSInitializerSymbol, ts.getDeclaredJavascriptInitializer = getDeclaredJavascriptInitializer, ts.getAssignedJavascriptInitializer = getAssignedJavascriptInitializer, ts.getJavascriptInitializer = getJavascriptInitializer, ts.getOuterNameOfJsInitializer = getOuterNameOfJsInitializer, ts.getRightMostAssignedExpression = getRightMostAssignedExpression, ts.isExportsIdentifier = isExportsIdentifier, ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression, ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind, ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression, ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment, ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration, ts.importFromModuleSpecifier = importFromModuleSpecifier, ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier, ts.getExternalModuleName = getExternalModuleName, ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode, ts.isDefaultImport = isDefaultImport, ts.hasQuestionToken = hasQuestionToken, ts.isJSDocConstructSignature = isJSDocConstructSignature, ts.isJSDocTypeAlias = isJSDocTypeAlias, ts.isTypeAlias = isTypeAlias, ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags, ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc, ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc, ts.getHostSignatureFromJSDocHost = getHostSignatureFromJSDocHost, ts.getJSDocHost = getJSDocHost, ts.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc, ts.hasRestParameter = hasRestParameter, ts.isRestParameter = isRestParameter; var AssignmentKind; !function (AssignmentKind) { AssignmentKind[AssignmentKind.None = 0] = "None", AssignmentKind[AssignmentKind.Definite = 1] = "Definite", AssignmentKind[AssignmentKind.Compound = 2] = "Compound" }(AssignmentKind = ts.AssignmentKind || (ts.AssignmentKind = {})), ts.getAssignmentTargetKind = getAssignmentTargetKind, ts.isAssignmentTarget = isAssignmentTarget, ts.isNodeWithPossibleHoistedDeclaration = isNodeWithPossibleHoistedDeclaration, ts.isValueSignatureDeclaration = isValueSignatureDeclaration, ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes, ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions, ts.skipParentheses = skipParentheses, ts.isDeleteTarget = isDeleteTarget, ts.isNodeDescendantOf = isNodeDescendantOf, ts.isDeclarationName = isDeclarationName, ts.isAnyDeclarationName = isAnyDeclarationName, ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName, ts.isIdentifierName = isIdentifierName, ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration, ts.exportAssignmentIsAlias = exportAssignmentIsAlias, ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement, ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements, ts.getAllSuperTypeNodes = getAllSuperTypeNodes, ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes, ts.getHeritageClause = getHeritageClause, ts.tryResolveScriptReference = tryResolveScriptReference, ts.getAncestor = getAncestor, ts.isKeyword = isKeyword, ts.isContextualKeyword = isContextualKeyword, ts.isNonContextualKeyword = isNonContextualKeyword, ts.isStringANonContextualKeyword = isStringANonContextualKeyword, ts.isTrivia = isTrivia; var FunctionFlags; !function (FunctionFlags) { FunctionFlags[FunctionFlags.Normal = 0] = "Normal", FunctionFlags[FunctionFlags.Generator = 1] = "Generator", FunctionFlags[FunctionFlags.Async = 2] = "Async", FunctionFlags[FunctionFlags.Invalid = 4] = "Invalid", FunctionFlags[FunctionFlags.AsyncGenerator = 3] = "AsyncGenerator" }(FunctionFlags = ts.FunctionFlags || (ts.FunctionFlags = {})), ts.getFunctionFlags = getFunctionFlags, ts.isAsyncFunction = isAsyncFunction, ts.isStringOrNumericLiteral = isStringOrNumericLiteral, ts.hasDynamicName = hasDynamicName, ts.isDynamicName = isDynamicName, ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically, ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode, ts.isPropertyNameLiteral = isPropertyNameLiteral, ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral, ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral, ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName, ts.isKnownSymbol = isKnownSymbol, ts.isESSymbolIdentifier = isESSymbolIdentifier, ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier, ts.isParameterDeclaration = isParameterDeclaration, ts.getRootDeclaration = getRootDeclaration, ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment, ts.nodeIsSynthesized = nodeIsSynthesized, ts.getOriginalSourceFile = getOriginalSourceFile; var Associativity; !function (Associativity) { Associativity[Associativity.Left = 0] = "Left", Associativity[Associativity.Right = 1] = "Right" }(Associativity = ts.Associativity || (ts.Associativity = {})), ts.getExpressionAssociativity = getExpressionAssociativity, ts.getOperatorAssociativity = getOperatorAssociativity, ts.getExpressionPrecedence = getExpressionPrecedence, ts.getOperator = getOperator, ts.getOperatorPrecedence = getOperatorPrecedence, ts.getBinaryOperatorPrecedence = getBinaryOperatorPrecedence, ts.createDiagnosticCollection = createDiagnosticCollection; var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g, singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g, backtickQuoteEscapedCharsRegExp = /[\\\`\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g, escapedCharsMap = ts.createMapFromTemplate({ "\t": "\\t", "\v": "\\v", "\f": "\\f", "\b": "\\b", "\r": "\\r", "\n": "\\n", "\\": "\\\\", '"': '\\"', "'": "\\'", "`": "\\`", "\u2028": "\\u2028", "\u2029": "\\u2029", "Â…": "\\u0085" }); ts.escapeString = escapeString, ts.isIntrinsicJsxName = isIntrinsicJsxName; var nonAsciiCharacters = /[^\u0000-\u007F]/g; ts.escapeNonAsciiString = escapeNonAsciiString; var indentStrings = ["", " "]; ts.getIndentString = getIndentString, ts.getIndentSize = getIndentSize, ts.createTextWriter = createTextWriter, ts.getResolvedExternalModuleName = getResolvedExternalModuleName, ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration, ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath, ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath, ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath, ts.getSourceFilesToEmit = getSourceFilesToEmit, ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted, ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir, ts.writeFile = writeFile, ts.getLineOfLocalPosition = getLineOfLocalPosition, ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap, ts.getFirstConstructorWithBody = getFirstConstructorWithBody, ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode, ts.getThisParameter = getThisParameter, ts.parameterIsThisKeyword = parameterIsThisKeyword, ts.isThisIdentifier = isThisIdentifier, ts.identifierIsThisKeyword = identifierIsThisKeyword, ts.getAllAccessorDeclarations = getAllAccessorDeclarations, ts.getEffectiveTypeAnnotationNode = getEffectiveTypeAnnotationNode, ts.getTypeAnnotationNode = getTypeAnnotationNode, ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode, ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations, ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations, ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode, ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments, ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition, ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition, ts.emitComments = emitComments, ts.emitDetachedComments = emitDetachedComments, ts.writeCommentRange = writeCommentRange, ts.hasModifiers = hasModifiers, ts.hasModifier = hasModifier, ts.hasStaticModifier = hasStaticModifier, ts.hasReadonlyModifier = hasReadonlyModifier, ts.getSelectedModifierFlags = getSelectedModifierFlags, ts.getModifierFlags = getModifierFlags, ts.getModifierFlagsNoCache = getModifierFlagsNoCache, ts.modifierToFlag = modifierToFlag, ts.isLogicalOperator = isLogicalOperator, ts.isAssignmentOperator = isAssignmentOperator, ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments, ts.isAssignmentExpression = isAssignmentExpression, ts.isDestructuringAssignment = isDestructuringAssignment, ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause, ts.isExpressionWithTypeArgumentsInClassImplementsClause = isExpressionWithTypeArgumentsInClassImplementsClause, ts.isEntityNameExpression = isEntityNameExpression, ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression, ts.isPrototypeAccess = isPrototypeAccess, ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess, ts.isEmptyObjectLiteral = isEmptyObjectLiteral, ts.isEmptyArrayLiteral = isEmptyArrayLiteral, ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault, ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension; var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; ts.convertToBase64 = convertToBase64, ts.base64encode = base64encode, ts.base64decode = base64decode; var carriageReturnLineFeed = "\r\n", lineFeed = "\n"; ts.getNewLineCharacter = getNewLineCharacter, ts.formatSyntaxKind = formatSyntaxKind, ts.formatModifierFlags = formatModifierFlags, ts.formatTransformFlags = formatTransformFlags, ts.formatEmitFlags = formatEmitFlags, ts.formatSymbolFlags = formatSymbolFlags, ts.formatTypeFlags = formatTypeFlags, ts.formatObjectFlags = formatObjectFlags, ts.createRange = createRange, ts.moveRangeEnd = moveRangeEnd, ts.moveRangePos = moveRangePos, ts.moveRangePastDecorators = moveRangePastDecorators, ts.moveRangePastModifiers = moveRangePastModifiers, ts.isCollapsedRange = isCollapsedRange, ts.createTokenRange = createTokenRange, ts.rangeIsOnSingleLine = rangeIsOnSingleLine, ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine, ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine, ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd, ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart, ts.positionsAreOnSameLine = positionsAreOnSameLine, ts.getStartPositionOfRange = getStartPositionOfRange, ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace, ts.getInitializedVariables = getInitializedVariables, ts.isWatchSet = isWatchSet, ts.getCheckFlags = getCheckFlags, ts.getDeclarationModifierFlagsFromSymbol = getDeclarationModifierFlagsFromSymbol, ts.skipAlias = skipAlias, ts.getCombinedLocalAndExportSymbolFlags = getCombinedLocalAndExportSymbolFlags, ts.isWriteOnlyAccess = isWriteOnlyAccess, ts.isWriteAccess = isWriteAccess; var AccessKind; !function (AccessKind) { AccessKind[AccessKind.Read = 0] = "Read", AccessKind[AccessKind.Write = 1] = "Write", AccessKind[AccessKind.ReadWrite = 2] = "ReadWrite" }(AccessKind || (AccessKind = {})), ts.compareDataObjects = compareDataObjects, ts.clearMap = clearMap, ts.mutateMap = mutateMap, ts.forEachAncestorDirectory = forEachAncestorDirectory, ts.isAbstractConstructorType = isAbstractConstructorType, ts.isAbstractConstructorSymbol = isAbstractConstructorSymbol, ts.getClassLikeDeclarationOfSymbol = getClassLikeDeclarationOfSymbol, ts.getObjectFlags = getObjectFlags, ts.typeHasCallOrConstructSignatures = typeHasCallOrConstructSignatures, ts.forSomeAncestorDirectory = forSomeAncestorDirectory, ts.isUMDExportSymbol = isUMDExportSymbol, ts.showModuleSpecifier = showModuleSpecifier, ts.getLastChild = getLastChild, ts.addToSeen = addToSeen, ts.isObjectTypeDeclaration = isObjectTypeDeclaration }(ts || (ts = {})), function (ts) { function getDefaultLibFileName(options) { switch (options.target) { case 6: return "lib.esnext.full.d.ts"; case 4: return "lib.es2017.full.d.ts"; case 3: return "lib.es2016.full.d.ts"; case 2: return "lib.es6.d.ts"; default: return "lib.d.ts" } } function textSpanEnd(span) { return span.start + span.length } function textSpanIsEmpty(span) { return 0 === span.length } function textSpanContainsPosition(span, position) { return position >= span.start && position < textSpanEnd(span) } function textSpanContainsTextSpan(span, other) { return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span) } function textSpanOverlapsWith(span, other) { return void 0 !== textSpanOverlap(span, other) } function textSpanOverlap(span1, span2) { var overlap = textSpanIntersection(span1, span2); return overlap && 0 === overlap.length ? void 0 : overlap } function textSpanIntersectsWithTextSpan(span, other) { return decodedTextSpanIntersectsWith(span.start, span.length, other.start, other.length) } function textSpanIntersectsWith(span, start, length) { return decodedTextSpanIntersectsWith(span.start, span.length, start, length) } function decodedTextSpanIntersectsWith(start1, length1, start2, length2) { var end1 = start1 + length1, end2 = start2 + length2; return start2 <= end1 && end2 >= start1 } function textSpanIntersectsWithPosition(span, position) { return position <= textSpanEnd(span) && position >= span.start } function textSpanIntersection(span1, span2) { var start = Math.max(span1.start, span2.start), end = Math.min(textSpanEnd(span1), textSpanEnd(span2)); return start <= end ? createTextSpanFromBounds(start, end) : void 0 } function createTextSpan(start, length) { if (start < 0) throw new Error("start < 0"); if (length < 0) throw new Error("length < 0"); return { start: start, length: length } } function createTextRange(pos, end) { return void 0 === end && (end = pos), ts.Debug.assert(end >= pos), { pos: pos, end: end } } function createTextSpanFromBounds(start, end) { return createTextSpan(start, end - start) } function textChangeRangeNewSpan(range) { return createTextSpan(range.span.start, range.newLength) } function textChangeRangeIsUnchanged(range) { return textSpanIsEmpty(range.span) && 0 === range.newLength } function createTextChangeRange(span, newLength) { if (newLength < 0) throw new Error("newLength < 0"); return { span: span, newLength: newLength } } function collapseTextChangeRangesAcrossMultipleVersions(changes) { if (0 === changes.length) return ts.unchangedTextChangeRange; if (1 === changes.length) return changes[0]; for (var change0 = changes[0], oldStartN = change0.span.start, oldEndN = textSpanEnd(change0.span), newEndN = oldStartN + change0.newLength, i = 1; i < changes.length; i++) { var nextChange = changes[i], oldStart1 = oldStartN, oldEnd1 = oldEndN, newEnd1 = newEndN, oldStart2 = nextChange.span.start, oldEnd2 = textSpanEnd(nextChange.span), newEnd2 = oldStart2 + nextChange.newLength; oldStartN = Math.min(oldStart1, oldStart2), oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)), newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)) } return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN) } function getTypeParameterOwner(d) { if (d && 147 === d.kind) for (var current = d; current; current = current.parent)if (ts.isFunctionLike(current) || ts.isClassLike(current) || 235 === current.kind) return current } function isParameterPropertyDeclaration(node) { return ts.hasModifier(node, 92) && 154 === node.parent.kind } function isEmptyBindingPattern(node) { return !!ts.isBindingPattern(node) && ts.every(node.elements, isEmptyBindingElement) } function isEmptyBindingElement(node) { return !!ts.isOmittedExpression(node) || isEmptyBindingPattern(node.name) } function walkUpBindingElementsAndPatterns(node) { for (; node && (181 === node.kind || ts.isBindingPattern(node));)node = node.parent; return node } function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); return 231 === node.kind && (node = node.parent), node && 232 === node.kind && (flags |= ts.getModifierFlags(node), node = node.parent), node && 213 === node.kind && (flags |= ts.getModifierFlags(node)), flags } function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; return 231 === node.kind && (node = node.parent), node && 232 === node.kind && (flags |= node.flags, node = node.parent), node && 213 === node.kind && (flags |= node.flags), flags } function validateLocaleAndSetLanguage(locale, sys, errors) { function trySetLanguageAndTerritory(language, territory, errors) { var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()), containingDirectoryPath = ts.getDirectoryPath(compilerFilePath), filePath = ts.combinePaths(containingDirectoryPath, language); if (territory && (filePath = filePath + "-" + territory), filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")), !sys.fileExists(filePath)) return !1; var fileContents = ""; try { fileContents = sys.readFile(filePath) } catch (e) { return errors && errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)), !1 } try { ts.localizedDiagnosticMessages = JSON.parse(fileContents) } catch (e) { return errors && errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)), !1 } return !0 } var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) return void (errors && errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"))); var language = matchResult[1], territory = matchResult[3]; trySetLanguageAndTerritory(language, territory, errors) || trySetLanguageAndTerritory(language, void 0, errors), ts.setUILocale(locale) } function getOriginalNode(node, nodeTest) { if (node) for (; void 0 !== node.original;)node = node.original; return !nodeTest || nodeTest(node) ? node : void 0 } function isParseTreeNode(node) { return 0 === (8 & node.flags) } function getParseTreeNode(node, nodeTest) { return void 0 === node || isParseTreeNode(node) ? node : (node = getOriginalNode(node), !isParseTreeNode(node) || nodeTest && !nodeTest(node) ? void 0 : node) } function unescapeLeadingUnderscores(identifier) { var id = identifier; return id.length >= 3 && 95 === id.charCodeAt(0) && 95 === id.charCodeAt(1) && 95 === id.charCodeAt(2) ? id.substr(1) : id } function idText(identifier) { return unescapeLeadingUnderscores(identifier.escapedText) } function symbolName(symbol) { return unescapeLeadingUnderscores(symbol.escapedName) } function unescapeIdentifier(id) { return id } function nameForNamelessJSDocTypedef(declaration) { var hostNode = declaration.parent.parent; if (hostNode) { if (ts.isDeclaration(hostNode)) return getDeclarationIdentifier(hostNode); switch (hostNode.kind) { case 213: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); return; case 215: var expr = hostNode.expression; switch (expr.kind) { case 184: return expr.name; case 185: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) return arg }return; case 1: return; case 190: return getDeclarationIdentifier(hostNode.expression); case 227: if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) return getDeclarationIdentifier(hostNode.statement); return; default: ts.Debug.assertNever(hostNode, "Found typedef tag attached to node which it should not be!") } } } function getDeclarationIdentifier(node) { var name = getNameOfDeclaration(node); return ts.isIdentifier(name) ? name : void 0 } function getNameOfJSDocTypedef(declaration) { return declaration.name || nameForNamelessJSDocTypedef(declaration) } function isNamedDeclaration(node) { return !!node.name } function getNameOfDeclaration(declaration) { if (declaration) { switch (declaration.kind) { case 204: case 191: if (!declaration.name) return getAssignedName(declaration); break; case 71: return declaration; case 297: case 292: var name = declaration.name; if (145 === name.kind) return name.right; break; case 199: var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { case 1: case 4: case 5: case 3: return expr.left.name; default: return }case 291: return declaration.name; case 296: return getNameOfJSDocTypedef(declaration); case 248: var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : void 0 }return declaration.name } } function getAssignedName(node) { if (node.parent) { if (ts.isPropertyAssignment(node.parent) || ts.isBindingElement(node.parent)) return node.parent.name; if (ts.isBinaryExpression(node.parent) && node === node.parent.right) { if (ts.isIdentifier(node.parent.left)) return node.parent.left; if (ts.isPropertyAccessExpression(node.parent.left)) return node.parent.left.name } } } function getJSDocParameterTags(param) { if (param.name) { if (ts.isIdentifier(param.name)) { var name_1 = param.name.escapedText; return getJSDocTags(param.parent).filter(function (tag) { return ts.isJSDocParameterTag(tag) && ts.isIdentifier(tag.name) && tag.name.escapedText === name_1 }) } var i = param.parent.parameters.indexOf(param); ts.Debug.assert(i > -1, "Parameters should always be in their parents' parameter list"); var paramTags = getJSDocTags(param.parent).filter(ts.isJSDocParameterTag); if (i < paramTags.length) return [paramTags[i]] } return ts.emptyArray } function hasJSDocParameterTags(node) { return !!getFirstJSDocTag(node, ts.isJSDocParameterTag) } function getJSDocAugmentsTag(node) { return getFirstJSDocTag(node, ts.isJSDocAugmentsTag) } function getJSDocClassTag(node) { return getFirstJSDocTag(node, ts.isJSDocClassTag) } function getJSDocReturnTag(node) { return getFirstJSDocTag(node, ts.isJSDocReturnTag) } function getJSDocTemplateTag(node) { return getFirstJSDocTag(node, ts.isJSDocTemplateTag) } function getJSDocTypeTag(node) { var tag = getFirstJSDocTag(node, ts.isJSDocTypeTag); if (tag && tag.typeExpression && tag.typeExpression.type) return tag } function getJSDocType(node) { var tag = getFirstJSDocTag(node, ts.isJSDocTypeTag); return !tag && ts.isParameter(node) && (tag = ts.find(getJSDocParameterTags(node), function (tag) { return !!tag.typeExpression })), tag && tag.typeExpression && tag.typeExpression.type } function getJSDocReturnType(node) { var returnTag = getJSDocReturnTag(node); return returnTag && returnTag.typeExpression && returnTag.typeExpression.type } function getJSDocTags(node) { var tags = node.jsDocCache; if (void 0 === tags) { var comments = ts.getJSDocCommentsAndTags(node); ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]), node.jsDocCache = tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j }) } return tags } function getFirstJSDocTag(node, predicate) { return ts.find(getJSDocTags(node), predicate) } function getAllJSDocTagsOfKind(node, kind) { return getJSDocTags(node).filter(function (doc) { return doc.kind === kind }) } ts.getDefaultLibFileName = getDefaultLibFileName, ts.textSpanEnd = textSpanEnd, ts.textSpanIsEmpty = textSpanIsEmpty, ts.textSpanContainsPosition = textSpanContainsPosition, ts.textSpanContainsTextSpan = textSpanContainsTextSpan, ts.textSpanOverlapsWith = textSpanOverlapsWith, ts.textSpanOverlap = textSpanOverlap, ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan, ts.textSpanIntersectsWith = textSpanIntersectsWith, ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith, ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition, ts.textSpanIntersection = textSpanIntersection, ts.createTextSpan = createTextSpan, ts.createTextRange = createTextRange, ts.createTextSpanFromBounds = createTextSpanFromBounds, ts.textChangeRangeNewSpan = textChangeRangeNewSpan, ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged, ts.createTextChangeRange = createTextChangeRange, ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0), ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions, ts.getTypeParameterOwner = getTypeParameterOwner, ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration, ts.isEmptyBindingPattern = isEmptyBindingPattern, ts.isEmptyBindingElement = isEmptyBindingElement, ts.getCombinedModifierFlags = getCombinedModifierFlags, ts.getCombinedNodeFlags = getCombinedNodeFlags, ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage, ts.getOriginalNode = getOriginalNode, ts.isParseTreeNode = isParseTreeNode, ts.getParseTreeNode = getParseTreeNode, ts.unescapeLeadingUnderscores = unescapeLeadingUnderscores, ts.idText = idText, ts.symbolName = symbolName, ts.unescapeIdentifier = unescapeIdentifier, ts.getNameOfJSDocTypedef = getNameOfJSDocTypedef, ts.isNamedDeclaration = isNamedDeclaration, ts.getNameOfDeclaration = getNameOfDeclaration, ts.getJSDocParameterTags = getJSDocParameterTags, ts.hasJSDocParameterTags = hasJSDocParameterTags, ts.getJSDocAugmentsTag = getJSDocAugmentsTag, ts.getJSDocClassTag = getJSDocClassTag, ts.getJSDocReturnTag = getJSDocReturnTag, ts.getJSDocTemplateTag = getJSDocTemplateTag, ts.getJSDocTypeTag = getJSDocTypeTag, ts.getJSDocType = getJSDocType, ts.getJSDocReturnType = getJSDocReturnType, ts.getJSDocTags = getJSDocTags, ts.getAllJSDocTagsOfKind = getAllJSDocTagsOfKind }(ts || (ts = {})), function (ts) { function isNumericLiteral(node) { return 8 === node.kind } function isStringLiteral(node) { return 9 === node.kind } function isJsxText(node) { return 10 === node.kind } function isRegularExpressionLiteral(node) { return 12 === node.kind } function isNoSubstitutionTemplateLiteral(node) { return 13 === node.kind } function isTemplateHead(node) { return 14 === node.kind } function isTemplateMiddle(node) { return 15 === node.kind } function isTemplateTail(node) { return 16 === node.kind } function isIdentifier(node) { return 71 === node.kind } function isQualifiedName(node) { return 145 === node.kind } function isComputedPropertyName(node) { return 146 === node.kind } function isTypeParameterDeclaration(node) { return 147 === node.kind } function isParameter(node) { return 148 === node.kind } function isDecorator(node) { return 149 === node.kind } function isPropertySignature(node) { return 150 === node.kind } function isPropertyDeclaration(node) { return 151 === node.kind } function isMethodSignature(node) { return 152 === node.kind } function isMethodDeclaration(node) { return 153 === node.kind } function isConstructorDeclaration(node) { return 154 === node.kind } function isGetAccessorDeclaration(node) { return 155 === node.kind } function isSetAccessorDeclaration(node) { return 156 === node.kind } function isCallSignatureDeclaration(node) { return 157 === node.kind } function isConstructSignatureDeclaration(node) { return 158 === node.kind } function isIndexSignatureDeclaration(node) { return 159 === node.kind } function isGetOrSetAccessorDeclaration(node) { return 156 === node.kind || 155 === node.kind } function isTypePredicateNode(node) { return 160 === node.kind } function isTypeReferenceNode(node) { return 161 === node.kind } function isFunctionTypeNode(node) { return 162 === node.kind } function isConstructorTypeNode(node) { return 163 === node.kind } function isTypeQueryNode(node) { return 164 === node.kind } function isTypeLiteralNode(node) { return 165 === node.kind } function isArrayTypeNode(node) { return 166 === node.kind } function isTupleTypeNode(node) { return 167 === node.kind } function isUnionTypeNode(node) { return 168 === node.kind } function isIntersectionTypeNode(node) { return 169 === node.kind } function isConditionalTypeNode(node) { return 170 === node.kind } function isInferTypeNode(node) { return 171 === node.kind } function isParenthesizedTypeNode(node) { return 172 === node.kind } function isThisTypeNode(node) { return 173 === node.kind } function isTypeOperatorNode(node) { return 174 === node.kind } function isIndexedAccessTypeNode(node) { return 175 === node.kind } function isMappedTypeNode(node) { return 176 === node.kind } function isLiteralTypeNode(node) { return 177 === node.kind } function isImportTypeNode(node) { return 178 === node.kind } function isObjectBindingPattern(node) { return 179 === node.kind } function isArrayBindingPattern(node) { return 180 === node.kind } function isBindingElement(node) { return 181 === node.kind } function isArrayLiteralExpression(node) { return 182 === node.kind } function isObjectLiteralExpression(node) { return 183 === node.kind } function isPropertyAccessExpression(node) { return 184 === node.kind } function isElementAccessExpression(node) { return 185 === node.kind } function isCallExpression(node) { return 186 === node.kind } function isNewExpression(node) { return 187 === node.kind } function isTaggedTemplateExpression(node) { return 188 === node.kind } function isTypeAssertion(node) { return 189 === node.kind } function isParenthesizedExpression(node) { return 190 === node.kind } function skipPartiallyEmittedExpressions(node) { for (; 300 === node.kind;)node = node.expression; return node } function isFunctionExpression(node) { return 191 === node.kind } function isArrowFunction(node) { return 192 === node.kind } function isDeleteExpression(node) { return 193 === node.kind } function isTypeOfExpression(node) { return 194 === node.kind } function isVoidExpression(node) { return 195 === node.kind } function isAwaitExpression(node) { return 196 === node.kind } function isPrefixUnaryExpression(node) { return 197 === node.kind } function isPostfixUnaryExpression(node) { return 198 === node.kind } function isBinaryExpression(node) { return 199 === node.kind } function isConditionalExpression(node) { return 200 === node.kind } function isTemplateExpression(node) { return 201 === node.kind } function isYieldExpression(node) { return 202 === node.kind } function isSpreadElement(node) { return 203 === node.kind } function isClassExpression(node) { return 204 === node.kind } function isOmittedExpression(node) { return 205 === node.kind } function isExpressionWithTypeArguments(node) { return 206 === node.kind } function isAsExpression(node) { return 207 === node.kind } function isNonNullExpression(node) { return 208 === node.kind } function isMetaProperty(node) { return 209 === node.kind } function isTemplateSpan(node) { return 210 === node.kind } function isSemicolonClassElement(node) { return 211 === node.kind } function isBlock(node) { return 212 === node.kind } function isVariableStatement(node) { return 213 === node.kind } function isEmptyStatement(node) { return 214 === node.kind } function isExpressionStatement(node) { return 215 === node.kind } function isIfStatement(node) { return 216 === node.kind } function isDoStatement(node) { return 217 === node.kind } function isWhileStatement(node) { return 218 === node.kind } function isForStatement(node) { return 219 === node.kind } function isForInStatement(node) { return 220 === node.kind } function isForOfStatement(node) { return 221 === node.kind } function isContinueStatement(node) { return 222 === node.kind } function isBreakStatement(node) { return 223 === node.kind } function isBreakOrContinueStatement(node) { return 223 === node.kind || 222 === node.kind } function isReturnStatement(node) { return 224 === node.kind } function isWithStatement(node) { return 225 === node.kind } function isSwitchStatement(node) { return 226 === node.kind } function isLabeledStatement(node) { return 227 === node.kind } function isThrowStatement(node) { return 228 === node.kind } function isTryStatement(node) { return 229 === node.kind } function isDebuggerStatement(node) { return 230 === node.kind } function isVariableDeclaration(node) { return 231 === node.kind } function isVariableDeclarationList(node) { return 232 === node.kind } function isFunctionDeclaration(node) { return 233 === node.kind } function isClassDeclaration(node) { return 234 === node.kind } function isInterfaceDeclaration(node) { return 235 === node.kind } function isTypeAliasDeclaration(node) { return 236 === node.kind } function isEnumDeclaration(node) { return 237 === node.kind } function isModuleDeclaration(node) { return 238 === node.kind } function isModuleBlock(node) { return 239 === node.kind } function isCaseBlock(node) { return 240 === node.kind } function isNamespaceExportDeclaration(node) { return 241 === node.kind } function isImportEqualsDeclaration(node) { return 242 === node.kind } function isImportDeclaration(node) { return 243 === node.kind } function isImportClause(node) { return 244 === node.kind } function isNamespaceImport(node) { return 245 === node.kind } function isNamedImports(node) { return 246 === node.kind } function isImportSpecifier(node) { return 247 === node.kind } function isExportAssignment(node) { return 248 === node.kind } function isExportDeclaration(node) { return 249 === node.kind } function isNamedExports(node) { return 250 === node.kind } function isExportSpecifier(node) { return 251 === node.kind } function isMissingDeclaration(node) { return 252 === node.kind } function isExternalModuleReference(node) { return 253 === node.kind } function isJsxElement(node) { return 254 === node.kind } function isJsxSelfClosingElement(node) { return 255 === node.kind } function isJsxOpeningElement(node) { return 256 === node.kind } function isJsxClosingElement(node) { return 257 === node.kind } function isJsxFragment(node) { return 258 === node.kind } function isJsxOpeningFragment(node) { return 259 === node.kind } function isJsxClosingFragment(node) { return 260 === node.kind } function isJsxAttribute(node) { return 261 === node.kind } function isJsxAttributes(node) { return 262 === node.kind } function isJsxSpreadAttribute(node) { return 263 === node.kind } function isJsxExpression(node) { return 264 === node.kind } function isCaseClause(node) { return 265 === node.kind } function isDefaultClause(node) { return 266 === node.kind } function isHeritageClause(node) { return 267 === node.kind } function isCatchClause(node) { return 268 === node.kind } function isPropertyAssignment(node) { return 269 === node.kind } function isShorthandPropertyAssignment(node) { return 270 === node.kind } function isSpreadAssignment(node) { return 271 === node.kind } function isEnumMember(node) { return 272 === node.kind } function isSourceFile(node) { return 273 === node.kind } function isBundle(node) { return 274 === node.kind } function isJSDocTypeExpression(node) { return 277 === node.kind } function isJSDocAllType(node) { return 278 === node.kind } function isJSDocUnknownType(node) { return 279 === node.kind } function isJSDocNullableType(node) { return 280 === node.kind } function isJSDocNonNullableType(node) { return 281 === node.kind } function isJSDocOptionalType(node) { return 282 === node.kind } function isJSDocFunctionType(node) { return 283 === node.kind } function isJSDocVariadicType(node) { return 284 === node.kind } function isJSDoc(node) { return 285 === node.kind } function isJSDocAugmentsTag(node) { return 289 === node.kind } function isJSDocClassTag(node) { return 290 === node.kind } function isJSDocParameterTag(node) { return 292 === node.kind } function isJSDocReturnTag(node) { return 293 === node.kind } function isJSDocTypeTag(node) { return 294 === node.kind } function isJSDocTemplateTag(node) { return 295 === node.kind } function isJSDocTypedefTag(node) { return 296 === node.kind } function isJSDocPropertyTag(node) { return 297 === node.kind } function isJSDocPropertyLikeTag(node) { return 297 === node.kind || 292 === node.kind } function isJSDocTypeLiteral(node) { return 286 === node.kind } function isJSDocCallbackTag(node) { return 291 === node.kind } function isJSDocSignature(node) { return 287 === node.kind } ts.isNumericLiteral = isNumericLiteral, ts.isStringLiteral = isStringLiteral, ts.isJsxText = isJsxText, ts.isRegularExpressionLiteral = isRegularExpressionLiteral, ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral, ts.isTemplateHead = isTemplateHead, ts.isTemplateMiddle = isTemplateMiddle, ts.isTemplateTail = isTemplateTail, ts.isIdentifier = isIdentifier, ts.isQualifiedName = isQualifiedName, ts.isComputedPropertyName = isComputedPropertyName, ts.isTypeParameterDeclaration = isTypeParameterDeclaration, ts.isParameter = isParameter, ts.isDecorator = isDecorator, ts.isPropertySignature = isPropertySignature, ts.isPropertyDeclaration = isPropertyDeclaration, ts.isMethodSignature = isMethodSignature, ts.isMethodDeclaration = isMethodDeclaration, ts.isConstructorDeclaration = isConstructorDeclaration, ts.isGetAccessorDeclaration = isGetAccessorDeclaration, ts.isSetAccessorDeclaration = isSetAccessorDeclaration, ts.isCallSignatureDeclaration = isCallSignatureDeclaration, ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration, ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration, ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration, ts.isTypePredicateNode = isTypePredicateNode, ts.isTypeReferenceNode = isTypeReferenceNode, ts.isFunctionTypeNode = isFunctionTypeNode, ts.isConstructorTypeNode = isConstructorTypeNode, ts.isTypeQueryNode = isTypeQueryNode, ts.isTypeLiteralNode = isTypeLiteralNode, ts.isArrayTypeNode = isArrayTypeNode, ts.isTupleTypeNode = isTupleTypeNode, ts.isUnionTypeNode = isUnionTypeNode, ts.isIntersectionTypeNode = isIntersectionTypeNode, ts.isConditionalTypeNode = isConditionalTypeNode, ts.isInferTypeNode = isInferTypeNode, ts.isParenthesizedTypeNode = isParenthesizedTypeNode, ts.isThisTypeNode = isThisTypeNode, ts.isTypeOperatorNode = isTypeOperatorNode, ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode, ts.isMappedTypeNode = isMappedTypeNode, ts.isLiteralTypeNode = isLiteralTypeNode, ts.isImportTypeNode = isImportTypeNode, ts.isObjectBindingPattern = isObjectBindingPattern, ts.isArrayBindingPattern = isArrayBindingPattern, ts.isBindingElement = isBindingElement, ts.isArrayLiteralExpression = isArrayLiteralExpression, ts.isObjectLiteralExpression = isObjectLiteralExpression, ts.isPropertyAccessExpression = isPropertyAccessExpression, ts.isElementAccessExpression = isElementAccessExpression, ts.isCallExpression = isCallExpression, ts.isNewExpression = isNewExpression, ts.isTaggedTemplateExpression = isTaggedTemplateExpression, ts.isTypeAssertion = isTypeAssertion, ts.isParenthesizedExpression = isParenthesizedExpression, ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions, ts.isFunctionExpression = isFunctionExpression, ts.isArrowFunction = isArrowFunction, ts.isDeleteExpression = isDeleteExpression, ts.isTypeOfExpression = isTypeOfExpression, ts.isVoidExpression = isVoidExpression, ts.isAwaitExpression = isAwaitExpression, ts.isPrefixUnaryExpression = isPrefixUnaryExpression, ts.isPostfixUnaryExpression = isPostfixUnaryExpression, ts.isBinaryExpression = isBinaryExpression, ts.isConditionalExpression = isConditionalExpression, ts.isTemplateExpression = isTemplateExpression, ts.isYieldExpression = isYieldExpression, ts.isSpreadElement = isSpreadElement, ts.isClassExpression = isClassExpression, ts.isOmittedExpression = isOmittedExpression, ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments, ts.isAsExpression = isAsExpression, ts.isNonNullExpression = isNonNullExpression, ts.isMetaProperty = isMetaProperty, ts.isTemplateSpan = isTemplateSpan, ts.isSemicolonClassElement = isSemicolonClassElement, ts.isBlock = isBlock, ts.isVariableStatement = isVariableStatement, ts.isEmptyStatement = isEmptyStatement, ts.isExpressionStatement = isExpressionStatement, ts.isIfStatement = isIfStatement, ts.isDoStatement = isDoStatement, ts.isWhileStatement = isWhileStatement, ts.isForStatement = isForStatement, ts.isForInStatement = isForInStatement, ts.isForOfStatement = isForOfStatement, ts.isContinueStatement = isContinueStatement, ts.isBreakStatement = isBreakStatement, ts.isBreakOrContinueStatement = isBreakOrContinueStatement, ts.isReturnStatement = isReturnStatement, ts.isWithStatement = isWithStatement, ts.isSwitchStatement = isSwitchStatement, ts.isLabeledStatement = isLabeledStatement, ts.isThrowStatement = isThrowStatement, ts.isTryStatement = isTryStatement, ts.isDebuggerStatement = isDebuggerStatement, ts.isVariableDeclaration = isVariableDeclaration, ts.isVariableDeclarationList = isVariableDeclarationList, ts.isFunctionDeclaration = isFunctionDeclaration, ts.isClassDeclaration = isClassDeclaration, ts.isInterfaceDeclaration = isInterfaceDeclaration, ts.isTypeAliasDeclaration = isTypeAliasDeclaration, ts.isEnumDeclaration = isEnumDeclaration, ts.isModuleDeclaration = isModuleDeclaration, ts.isModuleBlock = isModuleBlock, ts.isCaseBlock = isCaseBlock, ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration, ts.isImportEqualsDeclaration = isImportEqualsDeclaration, ts.isImportDeclaration = isImportDeclaration, ts.isImportClause = isImportClause, ts.isNamespaceImport = isNamespaceImport, ts.isNamedImports = isNamedImports, ts.isImportSpecifier = isImportSpecifier, ts.isExportAssignment = isExportAssignment, ts.isExportDeclaration = isExportDeclaration, ts.isNamedExports = isNamedExports, ts.isExportSpecifier = isExportSpecifier, ts.isMissingDeclaration = isMissingDeclaration, ts.isExternalModuleReference = isExternalModuleReference, ts.isJsxElement = isJsxElement, ts.isJsxSelfClosingElement = isJsxSelfClosingElement, ts.isJsxOpeningElement = isJsxOpeningElement, ts.isJsxClosingElement = isJsxClosingElement, ts.isJsxFragment = isJsxFragment, ts.isJsxOpeningFragment = isJsxOpeningFragment, ts.isJsxClosingFragment = isJsxClosingFragment, ts.isJsxAttribute = isJsxAttribute, ts.isJsxAttributes = isJsxAttributes, ts.isJsxSpreadAttribute = isJsxSpreadAttribute, ts.isJsxExpression = isJsxExpression, ts.isCaseClause = isCaseClause, ts.isDefaultClause = isDefaultClause, ts.isHeritageClause = isHeritageClause, ts.isCatchClause = isCatchClause, ts.isPropertyAssignment = isPropertyAssignment, ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment, ts.isSpreadAssignment = isSpreadAssignment, ts.isEnumMember = isEnumMember, ts.isSourceFile = isSourceFile, ts.isBundle = isBundle, ts.isJSDocTypeExpression = isJSDocTypeExpression, ts.isJSDocAllType = isJSDocAllType, ts.isJSDocUnknownType = isJSDocUnknownType, ts.isJSDocNullableType = isJSDocNullableType, ts.isJSDocNonNullableType = isJSDocNonNullableType, ts.isJSDocOptionalType = isJSDocOptionalType, ts.isJSDocFunctionType = isJSDocFunctionType, ts.isJSDocVariadicType = isJSDocVariadicType, ts.isJSDoc = isJSDoc, ts.isJSDocAugmentsTag = isJSDocAugmentsTag, ts.isJSDocClassTag = isJSDocClassTag, ts.isJSDocParameterTag = isJSDocParameterTag, ts.isJSDocReturnTag = isJSDocReturnTag, ts.isJSDocTypeTag = isJSDocTypeTag, ts.isJSDocTemplateTag = isJSDocTemplateTag, ts.isJSDocTypedefTag = isJSDocTypedefTag, ts.isJSDocPropertyTag = isJSDocPropertyTag, ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag, ts.isJSDocTypeLiteral = isJSDocTypeLiteral, ts.isJSDocCallbackTag = isJSDocCallbackTag, ts.isJSDocSignature = isJSDocSignature }(ts || (ts = {})), function (ts) { function isSyntaxList(n) { return 298 === n.kind } function isNode(node) { return isNodeKind(node.kind) } function isNodeKind(kind) { return kind >= 145 } function isToken(n) { return n.kind >= 0 && n.kind <= 144 } function isNodeArray(array) { return array.hasOwnProperty("pos") && array.hasOwnProperty("end") } function isLiteralKind(kind) { return 8 <= kind && kind <= 13 } function isLiteralExpression(node) { return isLiteralKind(node.kind) } function isTemplateLiteralKind(kind) { return 13 <= kind && kind <= 16 } function isTemplateMiddleOrTemplateTail(node) { var kind = node.kind; return 15 === kind || 16 === kind } function isStringTextContainingNode(node) { return 9 === node.kind || isTemplateLiteralKind(node.kind) } function isGeneratedIdentifier(node) { return ts.isIdentifier(node) && (7 & node.autoGenerateFlags) > 0 } function isModifierKind(token) { switch (token) { case 117: case 120: case 76: case 124: case 79: case 84: case 114: case 112: case 113: case 132: case 115: return !0 }return !1 } function isParameterPropertyModifier(kind) { return !!(92 & ts.modifierToFlag(kind)) } function isClassMemberModifier(idToken) { return isParameterPropertyModifier(idToken) || 115 === idToken } function isModifier(node) { return isModifierKind(node.kind) } function isEntityName(node) { var kind = node.kind; return 145 === kind || 71 === kind } function isPropertyName(node) { var kind = node.kind; return 71 === kind || 9 === kind || 8 === kind || 146 === kind } function isBindingName(node) { var kind = node.kind; return 71 === kind || 179 === kind || 180 === kind } function isFunctionLike(node) { return node && isFunctionLikeKind(node.kind) } function isFunctionLikeDeclaration(node) { return node && isFunctionLikeDeclarationKind(node.kind) } function isFunctionLikeDeclarationKind(kind) { switch (kind) { case 233: case 153: case 154: case 155: case 156: case 191: case 192: return !0; default: return !1 } } function isFunctionLikeKind(kind) { switch (kind) { case 152: case 157: case 287: case 158: case 159: case 162: case 283: case 163: return !0; default: return isFunctionLikeDeclarationKind(kind) } } function isFunctionOrModuleBlock(node) { return ts.isSourceFile(node) || ts.isModuleBlock(node) || ts.isBlock(node) && isFunctionLike(node.parent) } function isClassElement(node) { var kind = node.kind; return 154 === kind || 151 === kind || 153 === kind || 155 === kind || 156 === kind || 159 === kind || 211 === kind } function isClassLike(node) { return node && (234 === node.kind || 204 === node.kind) } function isAccessor(node) { return node && (155 === node.kind || 156 === node.kind) } function isMethodOrAccessor(node) { switch (node.kind) { case 153: case 155: case 156: return !0; default: return !1 } } function isTypeElement(node) { var kind = node.kind; return 158 === kind || 157 === kind || 150 === kind || 152 === kind || 159 === kind } function isClassOrTypeElement(node) { return isTypeElement(node) || isClassElement(node) } function isObjectLiteralElementLike(node) { var kind = node.kind; return 269 === kind || 270 === kind || 271 === kind || 153 === kind || 155 === kind || 156 === kind } function isTypeNodeKind(kind) { return kind >= 160 && kind <= 178 || 119 === kind || 134 === kind || 135 === kind || 122 === kind || 137 === kind || 138 === kind || 99 === kind || 105 === kind || 140 === kind || 95 === kind || 131 === kind || 206 === kind || 278 === kind || 279 === kind || 280 === kind || 281 === kind || 282 === kind || 283 === kind || 284 === kind } function isTypeNode(node) { return isTypeNodeKind(node.kind) } function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { case 162: case 163: return !0 }return !1 } function isBindingPattern(node) { if (node) { var kind = node.kind; return 180 === kind || 179 === kind } return !1 } function isAssignmentPattern(node) { var kind = node.kind; return 182 === kind || 183 === kind } function isArrayBindingElement(node) { var kind = node.kind; return 181 === kind || 205 === kind } function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { case 231: case 148: case 181: return !0 }return !1 } function isBindingOrAssignmentPattern(node) { return isObjectBindingOrAssignmentPattern(node) || isArrayBindingOrAssignmentPattern(node) } function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { case 179: case 183: return !0 }return !1 } function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { case 180: case 182: return !0 }return !1 } function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; return 184 === kind || 145 === kind || 178 === kind } function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; return 184 === kind || 145 === kind } function isCallLikeExpression(node) { switch (node.kind) { case 256: case 255: case 186: case 187: case 188: case 149: return !0; default: return !1 } } function isCallOrNewExpression(node) { return 186 === node.kind || 187 === node.kind } function isTemplateLiteral(node) { var kind = node.kind; return 201 === kind || 13 === kind } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind) } function isLeftHandSideExpressionKind(kind) { switch (kind) { case 184: case 185: case 187: case 186: case 254: case 255: case 258: case 188: case 182: case 190: case 183: case 204: case 191: case 71: case 12: case 8: case 9: case 13: case 201: case 86: case 95: case 99: case 101: case 97: case 208: case 209: case 91: return !0; default: return !1 } } function isUnaryExpression(node) { return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind) } function isUnaryExpressionKind(kind) { switch (kind) { case 197: case 198: case 193: case 194: case 195: case 196: case 189: return !0; default: return isLeftHandSideExpressionKind(kind) } } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { case 198: return !0; case 197: return 43 === expr.operator || 44 === expr.operator; default: return !1 } } function isExpression(node) { return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind) } function isExpressionKind(kind) { switch (kind) { case 200: case 202: case 192: case 199: case 203: case 207: case 205: case 301: case 300: return !0; default: return isUnaryExpressionKind(kind) } } function isAssertionExpression(node) { var kind = node.kind; return 189 === kind || 207 === kind } function isPartiallyEmittedExpression(node) { return 300 === node.kind } function isNotEmittedStatement(node) { return 299 === node.kind } function isNotEmittedOrPartiallyEmittedNode(node) { return isNotEmittedStatement(node) || isPartiallyEmittedExpression(node) } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { case 219: case 220: case 221: case 217: case 218: return !0; case 227: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements) }return !1 } function isForInOrOfStatement(node) { return 220 === node.kind || 221 === node.kind } function isConciseBody(node) { return ts.isBlock(node) || isExpression(node) } function isFunctionBody(node) { return ts.isBlock(node) } function isForInitializer(node) { return ts.isVariableDeclarationList(node) || isExpression(node) } function isModuleBody(node) { var kind = node.kind; return 239 === kind || 238 === kind || 71 === kind } function isNamespaceBody(node) { var kind = node.kind; return 239 === kind || 238 === kind } function isJSDocNamespaceBody(node) { var kind = node.kind; return 71 === kind || 238 === kind } function isNamedImportBindings(node) { var kind = node.kind; return 246 === kind || 245 === kind } function isModuleOrEnumDeclaration(node) { return 238 === node.kind || 237 === node.kind } function isDeclarationKind(kind) { return 192 === kind || 181 === kind || 234 === kind || 204 === kind || 154 === kind || 237 === kind || 272 === kind || 251 === kind || 233 === kind || 191 === kind || 155 === kind || 244 === kind || 242 === kind || 247 === kind || 235 === kind || 261 === kind || 153 === kind || 152 === kind || 238 === kind || 241 === kind || 245 === kind || 148 === kind || 269 === kind || 151 === kind || 150 === kind || 156 === kind || 270 === kind || 236 === kind || 147 === kind || 231 === kind || 296 === kind || 291 === kind || 297 === kind } function isDeclarationStatementKind(kind) { return 233 === kind || 252 === kind || 234 === kind || 235 === kind || 236 === kind || 237 === kind || 238 === kind || 243 === kind || 242 === kind || 249 === kind || 248 === kind || 241 === kind } function isStatementKindButNotDeclarationKind(kind) { return 223 === kind || 222 === kind || 230 === kind || 217 === kind || 215 === kind || 214 === kind || 220 === kind || 221 === kind || 219 === kind || 216 === kind || 227 === kind || 224 === kind || 226 === kind || 228 === kind || 229 === kind || 213 === kind || 218 === kind || 225 === kind || 299 === kind || 303 === kind || 302 === kind } function isDeclaration(node) { return 147 === node.kind ? 295 !== node.parent.kind || ts.isInJavaScriptFile(node) : isDeclarationKind(node.kind) } function isDeclarationStatement(node) { return isDeclarationStatementKind(node.kind) } function isStatementButNotDeclaration(node) { return isStatementKindButNotDeclarationKind(node.kind) } function isStatement(node) { var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || isBlockStatement(node) } function isBlockStatement(node) { return 212 === node.kind && ((void 0 === node.parent || 229 !== node.parent.kind && 268 !== node.parent.kind) && !ts.isFunctionBlock(node)) } function isModuleReference(node) { var kind = node.kind; return 253 === kind || 145 === kind || 71 === kind } function isJsxTagNameExpression(node) { var kind = node.kind; return 99 === kind || 71 === kind || 184 === kind } function isJsxChild(node) { var kind = node.kind; return 254 === kind || 264 === kind || 255 === kind || 10 === kind || 258 === kind } function isJsxAttributeLike(node) { var kind = node.kind; return 261 === kind || 263 === kind } function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return 9 === kind || 264 === kind } function isJsxOpeningLikeElement(node) { var kind = node.kind; return 256 === kind || 255 === kind } function isCaseOrDefaultClause(node) { var kind = node.kind; return 265 === kind || 266 === kind } function isJSDocNode(node) { return node.kind >= 277 && node.kind <= 297 } function isJSDocCommentContainingNode(node) { return 285 === node.kind || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node) } function isJSDocTag(node) { return node.kind >= 288 && node.kind <= 297 } function isSetAccessor(node) { return 156 === node.kind } function isGetAccessor(node) { return 155 === node.kind } function hasJSDocNodes(node) { return !!node.jsDoc && node.jsDoc.length > 0 } function hasType(node) { return !!node.type } function couldHaveType(node) { switch (node.kind) { case 148: case 150: case 151: case 152: case 153: case 154: case 155: case 156: case 157: case 158: case 159: case 160: case 162: case 163: case 172: case 174: case 176: case 189: case 191: case 192: case 207: case 231: case 233: case 236: case 277: case 280: case 281: case 282: case 283: case 284: return !0 }return !1 } function hasInitializer(node) { return !!node.initializer } function hasOnlyExpressionInitializer(node) { return hasInitializer(node) && !ts.isForStatement(node) && !ts.isForInStatement(node) && !ts.isForOfStatement(node) && !ts.isJsxAttribute(node) } function isObjectLiteralElement(node) { switch (node.kind) { case 261: case 263: case 269: case 270: case 153: case 155: case 156: return !0; default: return !1 } } function isTypeReferenceType(node) { return 161 === node.kind || 206 === node.kind } function guessIndentation(lines) { for (var indentation = MAX_SMI_X86, _i = 0, lines_1 = lines; _i < lines_1.length; _i++) { var line = lines_1[_i]; if (line.length) { for (var i = 0; i < line.length && i < indentation && ts.isWhiteSpaceLike(line.charCodeAt(i)); i++); if (i < indentation && (indentation = i), 0 === indentation) return 0 } } return indentation === MAX_SMI_X86 ? void 0 : indentation } function isStringLiteralLike(node) { return 9 === node.kind || 13 === node.kind } function isNamedImportsOrExports(node) { return 246 === node.kind || 250 === node.kind } ts.isSyntaxList = isSyntaxList, ts.isNode = isNode, ts.isNodeKind = isNodeKind, ts.isToken = isToken, ts.isNodeArray = isNodeArray, ts.isLiteralKind = isLiteralKind, ts.isLiteralExpression = isLiteralExpression, ts.isTemplateLiteralKind = isTemplateLiteralKind, ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail, ts.isStringTextContainingNode = isStringTextContainingNode, ts.isGeneratedIdentifier = isGeneratedIdentifier, ts.isModifierKind = isModifierKind, ts.isParameterPropertyModifier = isParameterPropertyModifier, ts.isClassMemberModifier = isClassMemberModifier, ts.isModifier = isModifier, ts.isEntityName = isEntityName, ts.isPropertyName = isPropertyName, ts.isBindingName = isBindingName, ts.isFunctionLike = isFunctionLike, ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration, ts.isFunctionLikeKind = isFunctionLikeKind, ts.isFunctionOrModuleBlock = isFunctionOrModuleBlock, ts.isClassElement = isClassElement, ts.isClassLike = isClassLike, ts.isAccessor = isAccessor, ts.isMethodOrAccessor = isMethodOrAccessor, ts.isTypeElement = isTypeElement, ts.isClassOrTypeElement = isClassOrTypeElement, ts.isObjectLiteralElementLike = isObjectLiteralElementLike, ts.isTypeNode = isTypeNode, ts.isFunctionOrConstructorTypeNode = isFunctionOrConstructorTypeNode, ts.isBindingPattern = isBindingPattern, ts.isAssignmentPattern = isAssignmentPattern, ts.isArrayBindingElement = isArrayBindingElement, ts.isDeclarationBindingElement = isDeclarationBindingElement, ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern, ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern, ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode, ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName, ts.isCallLikeExpression = isCallLikeExpression, ts.isCallOrNewExpression = isCallOrNewExpression, ts.isTemplateLiteral = isTemplateLiteral, ts.isLeftHandSideExpression = isLeftHandSideExpression, ts.isUnaryExpression = isUnaryExpression, ts.isUnaryExpressionWithWrite = isUnaryExpressionWithWrite, ts.isExpression = isExpression, ts.isAssertionExpression = isAssertionExpression, ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression, ts.isNotEmittedStatement = isNotEmittedStatement, ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode, ts.isIterationStatement = isIterationStatement, ts.isForInOrOfStatement = isForInOrOfStatement, ts.isConciseBody = isConciseBody, ts.isFunctionBody = isFunctionBody, ts.isForInitializer = isForInitializer, ts.isModuleBody = isModuleBody, ts.isNamespaceBody = isNamespaceBody, ts.isJSDocNamespaceBody = isJSDocNamespaceBody, ts.isNamedImportBindings = isNamedImportBindings, ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration, ts.isDeclaration = isDeclaration, ts.isDeclarationStatement = isDeclarationStatement, ts.isStatementButNotDeclaration = isStatementButNotDeclaration, ts.isStatement = isStatement, ts.isModuleReference = isModuleReference, ts.isJsxTagNameExpression = isJsxTagNameExpression, ts.isJsxChild = isJsxChild, ts.isJsxAttributeLike = isJsxAttributeLike, ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression, ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement, ts.isCaseOrDefaultClause = isCaseOrDefaultClause, ts.isJSDocNode = isJSDocNode, ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode, ts.isJSDocTag = isJSDocTag, ts.isSetAccessor = isSetAccessor, ts.isGetAccessor = isGetAccessor, ts.hasJSDocNodes = hasJSDocNodes, ts.hasType = hasType, ts.couldHaveType = couldHaveType, ts.hasInitializer = hasInitializer, ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer, ts.isObjectLiteralElement = isObjectLiteralElement, ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; ts.guessIndentation = guessIndentation, ts.isStringLiteralLike = isStringLiteralLike, ts.isNamedImportsOrExports = isNamedImportsOrExports }(ts || (ts = {})); var ts; !function (ts) { function createNode(kind, pos, end) { return 273 === kind ? new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end) : 71 === kind ? new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end) : ts.isNodeKind(kind) ? new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, pos, end) : new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end) } function visitNode(cbNode, node) { return node && cbNode(node) } function visitNodes(cbNode, cbNodes, nodes) { if (nodes) { if (cbNodes) return cbNodes(nodes); for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { var node = nodes_1[_i], result = cbNode(node); if (result) return result } } } function isJSDocLikeText(text, start) { return 42 === text.charCodeAt(start + 1) && 42 === text.charCodeAt(start + 2) && 47 !== text.charCodeAt(start + 3) } function forEachChild(node, cbNode, cbNodes) { if (node && !(node.kind <= 144)) switch (node.kind) { case 145: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 147: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 270: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); case 271: return visitNode(cbNode, node.expression); case 148: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 151: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 150: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 269: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); case 231: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 181: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 162: case 163: case 157: case 158: case 159: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 153: case 152: case 154: case 155: case 156: case 191: case 233: case 192: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 161: return visitNode(cbNode, node.typeName) || visitNodes(cbNode, cbNodes, node.typeArguments); case 160: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); case 164: return visitNode(cbNode, node.exprName); case 165: return visitNodes(cbNode, cbNodes, node.members); case 166: return visitNode(cbNode, node.elementType); case 167: return visitNodes(cbNode, cbNodes, node.elementTypes); case 168: case 169: return visitNodes(cbNode, cbNodes, node.types); case 170: return visitNode(cbNode, node.checkType) || visitNode(cbNode, node.extendsType) || visitNode(cbNode, node.trueType) || visitNode(cbNode, node.falseType); case 171: return visitNode(cbNode, node.typeParameter); case 178: return visitNode(cbNode, node.argument) || visitNode(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); case 172: case 174: return visitNode(cbNode, node.type); case 175: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); case 176: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); case 177: return visitNode(cbNode, node.literal); case 179: case 180: return visitNodes(cbNode, cbNodes, node.elements); case 182: return visitNodes(cbNode, cbNodes, node.elements); case 183: return visitNodes(cbNode, cbNodes, node.properties); case 184: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); case 185: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); case 186: case 187: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); case 188: return visitNode(cbNode, node.tag) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.template); case 189: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 190: return visitNode(cbNode, node.expression); case 193: return visitNode(cbNode, node.expression); case 194: return visitNode(cbNode, node.expression); case 195: return visitNode(cbNode, node.expression); case 197: return visitNode(cbNode, node.operand); case 202: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); case 196: return visitNode(cbNode, node.expression); case 198: return visitNode(cbNode, node.operand); case 199: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); case 207: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); case 208: return visitNode(cbNode, node.expression); case 209: return visitNode(cbNode, node.name); case 200: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); case 203: return visitNode(cbNode, node.expression); case 212: case 239: return visitNodes(cbNode, cbNodes, node.statements); case 273: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 213: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 232: return visitNodes(cbNode, cbNodes, node.declarations); case 215: return visitNode(cbNode, node.expression); case 216: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); case 217: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); case 218: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 219: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); case 220: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 221: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 222: case 223: return visitNode(cbNode, node.label); case 224: return visitNode(cbNode, node.expression); case 225: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 226: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); case 240: return visitNodes(cbNode, cbNodes, node.clauses); case 265: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); case 266: return visitNodes(cbNode, cbNodes, node.statements); case 227: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); case 228: return visitNode(cbNode, node.expression); case 229: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); case 268: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 149: return visitNode(cbNode, node.expression); case 234: case 204: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 235: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 236: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 237: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); case 272: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 238: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 242: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 243: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 244: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); case 241: return visitNode(cbNode, node.name); case 245: return visitNode(cbNode, node.name); case 246: case 250: return visitNodes(cbNode, cbNodes, node.elements); case 249: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); case 247: case 251: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 248: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 201: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 146: return visitNode(cbNode, node.expression); case 267: return visitNodes(cbNode, cbNodes, node.types); case 206: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); case 253: return visitNode(cbNode, node.expression); case 252: return visitNodes(cbNode, cbNodes, node.decorators); case 301: return visitNodes(cbNode, cbNodes, node.elements); case 254: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); case 258: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); case 255: case 256: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); case 262: return visitNodes(cbNode, cbNodes, node.properties); case 261: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 263: return visitNode(cbNode, node.expression); case 264: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); case 257: return visitNode(cbNode, node.tagName); case 277: return visitNode(cbNode, node.type); case 281: return visitNode(cbNode, node.type); case 280: return visitNode(cbNode, node.type); case 282: return visitNode(cbNode, node.type); case 283: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 284: return visitNode(cbNode, node.type); case 285: return visitNodes(cbNode, cbNodes, node.tags); case 292: case 297: return node.isNameFirst ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); case 293: return visitNode(cbNode, node.typeExpression); case 294: return visitNode(cbNode, node.typeExpression); case 289: return visitNode(cbNode, node.class); case 295: return visitNodes(cbNode, cbNodes, node.typeParameters); case 296: return node.typeExpression && 277 === node.typeExpression.kind ? visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) : visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); case 291: return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); case 287: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 286: if (node.jsDocPropertyTags) for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; visitNode(cbNode, tag) } return; case 300: return visitNode(cbNode, node.expression) } } function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { void 0 === setParentNodes && (setParentNodes = !1), ts.performance.mark("beforeParse"); var result; return result = 100 === languageVersion ? Parser.parseJsonText(fileName, sourceText, languageVersion, void 0, setParentNodes) : Parser.parseSourceFile(fileName, sourceText, languageVersion, void 0, setParentNodes, scriptKind), ts.performance.mark("afterParse"), ts.performance.measure("Parse", "beforeParse", "afterParse"), result } function parseIsolatedEntityName(text, languageVersion) { return Parser.parseIsolatedEntityName(text, languageVersion) } function parseJsonText(fileName, sourceText) { return Parser.parseJsonText(fileName, sourceText) } function isExternalModule(file) { return void 0 !== file.externalModuleIndicator } function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); return newSourceFile.flags |= 1572864 & sourceFile.flags, newSourceFile } function parseIsolatedJSDocComment(content, start, length) { var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length); return result && result.jsDoc && Parser.fixupParentReferences(result.jsDoc), result } function parseJSDocTypeExpressionForTests(content, start, length) { return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length) } function isDeclarationFileName(fileName) { return ts.fileExtensionIs(fileName, ".d.ts") } function processCommentPragmas(context, sourceText) { for (var triviaScanner = ts.createScanner(context.languageVersion, !1, 0, sourceText), pragmas = []; ;) { var kind = triviaScanner.scan(); if (!ts.isTrivia(kind)) break; var range = { kind: triviaScanner.getToken(), pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }, comment = sourceText.substring(range.pos, range.end); extractPragmas(pragmas, range, comment) } context.pragmas = ts.createMap(); for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) { var pragma = pragmas_1[_i]; if (context.pragmas.has(pragma.name)) { var currentValue = context.pragmas.get(pragma.name); currentValue instanceof Array ? currentValue.push(pragma.args) : context.pragmas.set(pragma.name, [currentValue, pragma.args]) } else context.pragmas.set(pragma.name, pragma.args) } } function processPragmasIntoFields(context, reportDiagnostic) { context.checkJsDirective = void 0, context.referencedFiles = [], context.typeReferenceDirectives = [], context.amdDependencies = [], context.hasNoDefaultLib = !1, context.pragmas.forEach(function (entryOrList, key) { switch (key) { case "reference": var referencedFiles_1 = context.referencedFiles, typeReferenceDirectives_1 = context.typeReferenceDirectives; ts.forEach(ts.toArray(entryOrList), function (arg) { arg.arguments["no-default-lib"] ? context.hasNoDefaultLib = !0 : arg.arguments.types ? typeReferenceDirectives_1.push({ pos: arg.arguments.types.pos, end: arg.arguments.types.end, fileName: arg.arguments.types.value }) : arg.arguments.path ? referencedFiles_1.push({ pos: arg.arguments.path.pos, end: arg.arguments.path.end, fileName: arg.arguments.path.value }) : reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, ts.Diagnostics.Invalid_reference_directive_syntax) }); break; case "amd-dependency": context.amdDependencies = ts.map(ts.toArray(entryOrList), function (_a) { var _b = _a.arguments, name = _b.name, path = _b.path; return { name: name, path: path } }); break; case "amd-module": if (entryOrList instanceof Array) for (var _i = 0, entryOrList_1 = entryOrList; _i < entryOrList_1.length; _i++) { var entry = entryOrList_1[_i]; context.moduleName && reportDiagnostic(entry.range.pos, entry.range.end - entry.range.pos, ts.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments), context.moduleName = entry.arguments.name } else context.moduleName = entryOrList.arguments.name; break; case "ts-nocheck": case "ts-check": ts.forEach(ts.toArray(entryOrList), function (entry) { (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) && (context.checkJsDirective = { enabled: "ts-check" === key, end: entry.range.end, pos: entry.range.pos }) }); break; case "jsx": return; default: ts.Debug.fail("Unhandled pragma kind") } }) } function getNamedArgRegEx(name) { if (namedArgRegExCache.has(name)) return namedArgRegExCache.get(name); var result = new RegExp("(\\s" + name + "\\s*=\\s*)('|\")(.+?)\\2", "im"); return namedArgRegExCache.set(name, result), result } function extractPragmas(pragmas, range, text) { var tripleSlash = 2 === range.kind && tripleSlashXMLCommentStartRegEx.exec(text); if (tripleSlash) { var name = tripleSlash[1].toLowerCase(), pragma = ts.commentPragmas[name]; if (!(pragma && 1 & pragma.kind)) return; if (pragma.args) { for (var argument = {}, _i = 0, _a = pragma.args; _i < _a.length; _i++) { var arg = _a[_i], matcher = getNamedArgRegEx(arg.name), matchResult = matcher.exec(text); if (!matchResult && !arg.optional) return; if (matchResult) if (arg.captureSpan) { var startPos = range.pos + matchResult.index + matchResult[1].length + matchResult[2].length; argument[arg.name] = { value: matchResult[3], pos: startPos, end: startPos + matchResult[3].length } } else argument[arg.name] = matchResult[3] } pragmas.push({ name: name, args: { arguments: argument, range: range } }) } else pragmas.push({ name: name, args: { arguments: {}, range: range } }) } else { var singleLine = 2 === range.kind && singleLinePragmaRegEx.exec(text); if (singleLine) return addPragmaForMatch(pragmas, range, 2, singleLine); if (3 === range.kind) for (var multiLinePragmaRegEx = /\s*@(\S+)\s*(.*)\s*$/gim, multiLineMatch = void 0; multiLineMatch = multiLinePragmaRegEx.exec(text);)addPragmaForMatch(pragmas, range, 4, multiLineMatch) } } function addPragmaForMatch(pragmas, range, kind, match) { if (match) { var name = match[1].toLowerCase(), pragma = ts.commentPragmas[name]; if (pragma && pragma.kind & kind) { var args = match[2], argument = getNamedPragmaArguments(pragma, args); "fail" !== argument && pragmas.push({ name: name, args: { arguments: argument, range: range } }) } } } function getNamedPragmaArguments(pragma, text) { if (!text) return {}; if (!pragma.args) return {}; for (var args = text.split(/\s+/), argMap = {}, i = 0; i < pragma.args.length; i++) { var argument = pragma.args[i]; if (!args[i] && !argument.optional) return "fail"; if (argument.captureSpan) return ts.Debug.fail("Capture spans not yet implemented for non-xml pragmas"); argMap[argument.name] = args[i] } return argMap } var SignatureFlags; !function (SignatureFlags) { SignatureFlags[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.Yield = 1] = "Yield", SignatureFlags[SignatureFlags.Await = 2] = "Await", SignatureFlags[SignatureFlags.Type = 4] = "Type", SignatureFlags[SignatureFlags.IgnoreMissingOpenBrace = 16] = "IgnoreMissingOpenBrace", SignatureFlags[SignatureFlags.JSDoc = 32] = "JSDoc" }(SignatureFlags || (SignatureFlags = {})); var NodeConstructor, TokenConstructor, IdentifierConstructor, SourceFileConstructor; ts.createNode = createNode, ts.isJSDocLikeText = isJSDocLikeText, ts.forEachChild = forEachChild, ts.createSourceFile = createSourceFile, ts.parseIsolatedEntityName = parseIsolatedEntityName, ts.parseJsonText = parseJsonText, ts.isExternalModule = isExternalModule, ts.updateSourceFile = updateSourceFile, ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment, ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; var Parser; !function (Parser) { function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) { if (scriptKind = ts.ensureScriptKind(fileName, scriptKind), 6 === scriptKind) { var result_1 = parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes); return ts.convertToObjectWorker(result_1, result_1.parseDiagnostics, !1, void 0, void 0), result_1.typeReferenceDirectives = ts.emptyArray, result_1.amdDependencies = ts.emptyArray, result_1 } initializeState(sourceText, languageVersion, syntaxCursor, scriptKind); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); return clearState(), result } function parseIsolatedEntityName(content, languageVersion) { initializeState(content, languageVersion, void 0, 1), nextToken(); var entityName = parseEntityName(!0), isInvalid = 1 === token() && !parseDiagnostics.length; return clearState(), isInvalid ? entityName : void 0 } function parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes) { void 0 === languageVersion && (languageVersion = 2), initializeState(sourceText, languageVersion, syntaxCursor, 6), sourceFile = createSourceFile(fileName, 2, 6, !1), sourceFile.flags = contextFlags, nextToken(); var pos = getNodePos(); if (1 === token()) sourceFile.statements = createNodeArray([], pos, pos), sourceFile.endOfFileToken = parseTokenNode(); else { var statement = createNode(215); switch (token()) { case 21: statement.expression = parseArrayLiteralExpression(); break; case 101: case 86: case 95: statement.expression = parseTokenNode(); break; case 38: lookAhead(function () { return 8 === nextToken() && 56 !== nextToken() }) ? statement.expression = parsePrefixUnaryExpression() : statement.expression = parseObjectLiteralExpression(); break; case 8: case 9: if (lookAhead(function () { return 56 !== nextToken() })) { statement.expression = parseLiteralNode(); break } default: statement.expression = parseObjectLiteralExpression() }finishNode(statement), sourceFile.statements = createNodeArray([statement], pos), sourceFile.endOfFileToken = parseExpectedToken(1, ts.Diagnostics.Unexpected_token) } setParentNodes && fixupParentReferences(sourceFile), sourceFile.parseDiagnostics = parseDiagnostics; var result = sourceFile; return clearState(), result } function getLanguageVariant(scriptKind) { return 4 === scriptKind || 2 === scriptKind || 1 === scriptKind || 6 === scriptKind ? 1 : 0 } function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) { switch (NodeConstructor = ts.objectAllocator.getNodeConstructor(), TokenConstructor = ts.objectAllocator.getTokenConstructor(), IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor(), SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor(), sourceText = _sourceText, syntaxCursor = _syntaxCursor, parseDiagnostics = [], parsingContext = 0, identifiers = ts.createMap(), identifierCount = 0, nodeCount = 0, scriptKind) { case 1: case 2: contextFlags = 65536; break; case 6: contextFlags = 16842752; break; default: contextFlags = 0 }parseErrorBeforeNextFinishedNode = !1, scanner.setText(sourceText), scanner.setOnError(scanError), scanner.setScriptTarget(languageVersion), scanner.setLanguageVariant(getLanguageVariant(scriptKind)) } function clearState() { scanner.setText(""), scanner.setOnError(void 0), parseDiagnostics = void 0, sourceFile = void 0, identifiers = void 0, syntaxCursor = void 0, sourceText = void 0 } function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) { function reportPragmaDiagnostic(pos, end, diagnostic) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, pos, end, diagnostic)) } var isDeclarationFile = isDeclarationFileName(fileName); return isDeclarationFile && (contextFlags |= 4194304), sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile), sourceFile.flags = contextFlags, nextToken(), processCommentPragmas(sourceFile, sourceText), processPragmasIntoFields(sourceFile, reportPragmaDiagnostic), sourceFile.statements = parseList(0, parseStatement), ts.Debug.assert(1 === token()), sourceFile.endOfFileToken = addJSDocComment(parseTokenNode()), setExternalModuleIndicator(sourceFile), sourceFile.nodeCount = nodeCount, sourceFile.identifierCount = identifierCount, sourceFile.identifiers = identifiers, sourceFile.parseDiagnostics = parseDiagnostics, setParentNodes && fixupParentReferences(sourceFile), sourceFile } function addJSDocComment(node) { var comments = ts.getJSDocCommentRanges(node, sourceFile.text); if (comments) for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { var comment = comments_2[_i]; node.jsDoc = ts.append(node.jsDoc, JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos)) } return node } function fixupParentReferences(rootNode) { function visitNode(n) { if (n.parent !== parent) { n.parent = parent; var saveParent = parent; if (parent = n, forEachChild(n, visitNode), ts.hasJSDocNodes(n)) for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) { var jsDoc = _a[_i]; jsDoc.parent = n, parent = jsDoc, forEachChild(jsDoc, visitNode) } parent = saveParent } } var parent = rootNode; forEachChild(rootNode, visitNode) } function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { var sourceFile = new SourceFileConstructor(273, 0, sourceText.length); return nodeCount++ , sourceFile.text = sourceText, sourceFile.bindDiagnostics = [], sourceFile.bindSuggestionDiagnostics = void 0, sourceFile.languageVersion = languageVersion, sourceFile.fileName = ts.normalizePath(fileName), sourceFile.languageVariant = getLanguageVariant(scriptKind), sourceFile.isDeclarationFile = isDeclarationFile, sourceFile.scriptKind = scriptKind, sourceFile } function setContextFlag(val, flag) { val ? contextFlags |= flag : contextFlags &= ~flag } function setDisallowInContext(val) { setContextFlag(val, 2048) } function setYieldContext(val) { setContextFlag(val, 4096) } function setDecoratorContext(val) { setContextFlag(val, 8192) } function setAwaitContext(val) { setContextFlag(val, 16384) } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; if (contextFlagsToClear) { setContextFlag(!1, contextFlagsToClear); var result = func(); return setContextFlag(!0, contextFlagsToClear), result } return func() } function doInsideOfContext(context, func) { var contextFlagsToSet = context & ~contextFlags; if (contextFlagsToSet) { setContextFlag(!0, contextFlagsToSet); var result = func(); return setContextFlag(!1, contextFlagsToSet), result } return func() } function allowInAnd(func) { return doOutsideOfContext(2048, func) } function disallowInAnd(func) { return doInsideOfContext(2048, func) } function doInYieldContext(func) { return doInsideOfContext(4096, func) } function doInDecoratorContext(func) { return doInsideOfContext(8192, func) } function doInAwaitContext(func) { return doInsideOfContext(16384, func) } function doOutsideOfAwaitContext(func) { return doOutsideOfContext(16384, func) } function doInYieldAndAwaitContext(func) { return doInsideOfContext(20480, func) } function inContext(flags) { return 0 !== (contextFlags & flags) } function inYieldContext() { return inContext(4096) } function inDisallowInContext() { return inContext(2048) } function inDecoratorContext() { return inContext(8192) } function inAwaitContext() { return inContext(16384) } function parseErrorAtCurrentToken(message, arg0) { parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0) } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(parseDiagnostics); lastError && start === lastError.start || parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0)), parseErrorBeforeNextFinishedNode = !0 } function parseErrorAt(start, end, message, arg0) { parseErrorAtPosition(start, end - start, message, arg0) } function parseErrorAtRange(range, message, arg0) { parseErrorAt(range.pos, range.end, message, arg0) } function scanError(message, length) { parseErrorAtPosition(scanner.getTextPos(), length, message) } function getNodePos() { return scanner.getStartPos() } function token() { return currentToken } function nextToken() { return currentToken = scanner.scan() } function reScanGreaterToken() { return currentToken = scanner.reScanGreaterToken() } function reScanSlashToken() { return currentToken = scanner.reScanSlashToken() } function reScanTemplateToken() { return currentToken = scanner.reScanTemplateToken() } function scanJsxIdentifier() { return currentToken = scanner.scanJsxIdentifier() } function scanJsxText() { return currentToken = scanner.scanJsxToken() } function scanJsxAttributeValue() { return currentToken = scanner.scanJsxAttributeValue() } function speculationHelper(callback, isLookAhead) { var saveToken = currentToken, saveParseDiagnosticsLength = parseDiagnostics.length, saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode, saveContextFlags = contextFlags, result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); return ts.Debug.assert(saveContextFlags === contextFlags), result && !isLookAhead || (currentToken = saveToken, parseDiagnostics.length = saveParseDiagnosticsLength, parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode), result } function lookAhead(callback) { return speculationHelper(callback, !0) } function tryParse(callback) { return speculationHelper(callback, !1) } function isIdentifier() { return 71 === token() || (116 !== token() || !inYieldContext()) && ((121 !== token() || !inAwaitContext()) && token() > 107) } function parseExpected(kind, diagnosticMessage, shouldAdvance) { return void 0 === shouldAdvance && (shouldAdvance = !0), token() === kind ? (shouldAdvance && nextToken(), !0) : (diagnosticMessage ? parseErrorAtCurrentToken(diagnosticMessage) : parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)), !1) } function parseOptional(t) { return token() === t && (nextToken(), !0) } function parseOptionalToken(t) { if (token() === t) return parseTokenNode() } function parseExpectedToken(t, diagnosticMessage, arg0) { return parseOptionalToken(t) || createMissingNode(t, !1, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t)) } function parseTokenNode() { var node = createNode(token()); return nextToken(), finishNode(node) } function canParseSemicolon() { return 25 === token() || (18 === token() || 1 === token() || scanner.hasPrecedingLineBreak()) } function parseSemicolon() { return canParseSemicolon() ? (25 === token() && nextToken(), !0) : parseExpected(25) } function createNode(kind, pos) { nodeCount++; var p = pos >= 0 ? pos : scanner.getStartPos(); return ts.isNodeKind(kind) || 0 === kind ? new NodeConstructor(kind, p, p) : 71 === kind ? new IdentifierConstructor(kind, p, p) : new TokenConstructor(kind, p, p) } function createNodeWithJSDoc(kind, pos) { var node = createNode(kind, pos); return 2 & scanner.getTokenFlags() && addJSDocComment(node), node } function createNodeArray(elements, pos, end) { var length = elements.length, array = length >= 1 && length <= 4 ? elements.slice() : elements; return array.pos = pos, array.end = void 0 === end ? scanner.getStartPos() : end, array } function finishNode(node, end) { return node.end = void 0 === end ? scanner.getStartPos() : end, contextFlags && (node.flags |= contextFlags), parseErrorBeforeNextFinishedNode && (parseErrorBeforeNextFinishedNode = !1, node.flags |= 32768), node } function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { reportAtCurrentPosition ? parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0) : diagnosticMessage && parseErrorAtCurrentToken(diagnosticMessage, arg0); var result = createNode(kind); return 71 === kind ? result.escapedText = "" : (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) && (result.text = ""), finishNode(result) } function internIdentifier(text) { var identifier = identifiers.get(text); return void 0 === identifier && identifiers.set(text, identifier = text), identifier } function createIdentifier(isIdentifier, diagnosticMessage) { if (identifierCount++ , isIdentifier) { var node = createNode(71); return 71 !== token() && (node.originalKeywordKind = token()), node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue())), nextToken(), finishNode(node) } var reportAtCurrentPosition = 1 === token(); return createMissingNode(71, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected) } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage) } function parseIdentifierName(diagnosticMessage) { return createIdentifier(ts.tokenIsIdentifierOrKeyword(token()), diagnosticMessage) } function isLiteralPropertyName() { return ts.tokenIsIdentifierOrKeyword(token()) || 9 === token() || 8 === token() } function parsePropertyNameWorker(allowComputedPropertyNames) { if (9 === token() || 8 === token()) { var node = parseLiteralNode(); return node.text = internIdentifier(node.text), node } return allowComputedPropertyNames && 21 === token() ? parseComputedPropertyName() : parseIdentifierName() } function parsePropertyName() { return parsePropertyNameWorker(!0) } function parseComputedPropertyName() { var node = createNode(146); return parseExpected(21), node.expression = allowInAnd(parseExpression), parseExpected(22), finishNode(node) } function parseContextualModifier(t) { return token() === t && tryParse(nextTokenCanFollowModifier) } function nextTokenIsOnSameLineAndCanFollowModifier() { return nextToken(), !scanner.hasPrecedingLineBreak() && canFollowModifier() } function nextTokenCanFollowModifier() { switch (token()) { case 76: return 83 === nextToken(); case 84: return nextToken(), 79 === token() ? lookAhead(nextTokenCanFollowDefaultKeyword) : 39 !== token() && 118 !== token() && 17 !== token() && canFollowModifier(); case 79: return nextTokenCanFollowDefaultKeyword(); case 115: case 125: case 136: return nextToken(), canFollowModifier(); default: return nextTokenIsOnSameLineAndCanFollowModifier() } } function parseAnyContextualModifier() { return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier) } function canFollowModifier() { return 21 === token() || 17 === token() || 39 === token() || 24 === token() || isLiteralPropertyName() } function nextTokenCanFollowDefaultKeyword() { return nextToken(), 75 === token() || 89 === token() || 109 === token() || 117 === token() && lookAhead(nextTokenIsClassKeywordOnSameLine) || 120 === token() && lookAhead(nextTokenIsFunctionKeywordOnSameLine) } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); if (node) return !0; switch (parsingContext) { case 0: case 1: case 3: return !(25 === token() && inErrorRecovery) && isStartOfStatement(); case 2: return 73 === token() || 79 === token(); case 4: return lookAhead(isTypeMemberStart); case 5: return lookAhead(isClassMemberStart) || 25 === token() && !inErrorRecovery; case 6: return 21 === token() || isLiteralPropertyName(); case 12: return 21 === token() || 39 === token() || 24 === token() || isLiteralPropertyName(); case 17: return isLiteralPropertyName(); case 9: return 21 === token() || 24 === token() || isLiteralPropertyName(); case 7: return 17 === token() ? lookAhead(isValidHeritageClauseObjectLiteral) : inErrorRecovery ? isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword() : isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); case 8: return isIdentifierOrPattern(); case 10: return 26 === token() || 24 === token() || isIdentifierOrPattern(); case 18: return isIdentifier(); case 15: if (26 === token()) return !0; case 11: return 24 === token() || isStartOfExpression(); case 16: return isStartOfParameter(); case 19: case 20: return 26 === token() || isStartOfType(); case 21: return isHeritageClause(); case 22: return ts.tokenIsIdentifierOrKeyword(token()); case 13: return ts.tokenIsIdentifierOrKeyword(token()) || 17 === token(); case 14: return !0 }ts.Debug.fail("Non-exhaustive case in 'isListElement'.") } function isValidHeritageClauseObjectLiteral() { if (ts.Debug.assert(17 === token()), 18 === nextToken()) { var next = nextToken(); return 26 === next || 17 === next || 85 === next || 108 === next } return !0 } function nextTokenIsIdentifier() { return nextToken(), isIdentifier() } function nextTokenIsIdentifierOrKeyword() { return nextToken(), ts.tokenIsIdentifierOrKeyword(token()) } function nextTokenIsIdentifierOrKeywordOrGreaterThan() { return nextToken(), ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()) } function isHeritageClauseExtendsOrImplementsKeyword() { return (108 === token() || 85 === token()) && lookAhead(nextTokenIsStartOfExpression) } function nextTokenIsStartOfExpression() { return nextToken(), isStartOfExpression() } function nextTokenIsStartOfType() { return nextToken(), isStartOfType() } function isListTerminator(kind) { if (1 === token()) return !0; switch (kind) { case 1: case 2: case 4: case 5: case 6: case 12: case 9: case 22: return 18 === token(); case 3: return 18 === token() || 73 === token() || 79 === token(); case 7: return 17 === token() || 85 === token() || 108 === token(); case 8: return isVariableDeclaratorListTerminator(); case 18: return 29 === token() || 19 === token() || 17 === token() || 85 === token() || 108 === token(); case 11: return 20 === token() || 25 === token(); case 15: case 20: case 10: return 22 === token(); case 16: case 17: return 20 === token() || 22 === token(); case 19: return 26 !== token(); case 21: return 17 === token() || 18 === token(); case 13: return 29 === token() || 41 === token(); case 14: return 27 === token() && lookAhead(nextTokenIsSlash) } } function isVariableDeclaratorListTerminator() { return !!canParseSemicolon() || (!!isInOrOfKeyword(token()) || 36 === token()) } function isInSomeParsingContext() { for (var kind = 0; kind < 23; kind++)if (parsingContext & 1 << kind && (isListElement(kind, !0) || isListTerminator(kind))) return !0; return !1 } function parseList(kind, parseElement) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; for (var list = [], listPos = getNodePos(); !isListTerminator(kind);)if (isListElement(kind, !1)) { var element = parseListElement(kind, parseElement); list.push(element) } else if (abortParsingListOrMoveToNextToken(kind)) break; return parsingContext = saveParsingContext, createNodeArray(list, listPos) } function parseListElement(parsingContext, parseElement) { var node = currentNode(parsingContext); return node ? consumeNode(node) : parseElement() } function currentNode(parsingContext) { if (!parseErrorBeforeNextFinishedNode && syntaxCursor) { var node = syntaxCursor.currentNode(scanner.getStartPos()); if (!ts.nodeIsMissing(node) && !node.intersectsChange && !ts.containsParseError(node)) { var nodeContextFlags = 12679168 & node.flags; if (nodeContextFlags === contextFlags && canReuseNode(node, parsingContext)) return node.jsDocCache && (node.jsDocCache = void 0), node } } } function consumeNode(node) { return scanner.setTextPos(node.end), nextToken(), node } function canReuseNode(node, parsingContext) { switch (parsingContext) { case 5: return isReusableClassMember(node); case 2: return isReusableSwitchClause(node); case 0: case 1: case 3: return isReusableStatement(node); case 6: return isReusableEnumMember(node); case 4: return isReusableTypeMember(node); case 8: return isReusableVariableDeclaration(node); case 16: return isReusableParameter(node); case 17: return !1; case 21: case 18: case 20: case 19: case 11: case 12: case 7: case 13: case 14: }return !1 } function isReusableClassMember(node) { if (node) switch (node.kind) { case 154: case 159: case 155: case 156: case 151: case 211: return !0; case 153: var methodDeclaration = node, nameIsConstructor = 71 === methodDeclaration.name.kind && 123 === methodDeclaration.name.originalKeywordKind; return !nameIsConstructor }return !1 } function isReusableSwitchClause(node) { if (node) switch (node.kind) { case 265: case 266: return !0 }return !1 } function isReusableStatement(node) { if (node) switch (node.kind) { case 233: case 213: case 212: case 216: case 215: case 228: case 224: case 226: case 223: case 222: case 220: case 221: case 219: case 218: case 225: case 214: case 229: case 227: case 217: case 230: case 243: case 242: case 249: case 248: case 238: case 234: case 235: case 237: case 236: return !0 }return !1 } function isReusableEnumMember(node) { return 272 === node.kind } function isReusableTypeMember(node) { if (node) switch (node.kind) { case 158: case 152: case 159: case 150: case 157: return !0 }return !1 } function isReusableVariableDeclaration(node) { if (231 !== node.kind) return !1; var variableDeclarator = node; return void 0 === variableDeclarator.initializer } function isReusableParameter(node) { if (148 !== node.kind) return !1; var parameter = node; return void 0 === parameter.initializer } function abortParsingListOrMoveToNextToken(kind) { return parseErrorAtCurrentToken(parsingContextErrors(kind)), !!isInSomeParsingContext() || (nextToken(), !1) } function parsingContextErrors(context) { switch (context) { case 0: return ts.Diagnostics.Declaration_or_statement_expected; case 1: return ts.Diagnostics.Declaration_or_statement_expected; case 2: return ts.Diagnostics.case_or_default_expected; case 3: return ts.Diagnostics.Statement_expected; case 17: case 4: return ts.Diagnostics.Property_or_signature_expected; case 5: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 6: return ts.Diagnostics.Enum_member_expected; case 7: return ts.Diagnostics.Expression_expected; case 8: return ts.Diagnostics.Variable_declaration_expected; case 9: return ts.Diagnostics.Property_destructuring_pattern_expected; case 10: return ts.Diagnostics.Array_element_destructuring_pattern_expected; case 11: return ts.Diagnostics.Argument_expression_expected; case 12: return ts.Diagnostics.Property_assignment_expected; case 15: return ts.Diagnostics.Expression_or_comma_expected; case 16: return ts.Diagnostics.Parameter_declaration_expected; case 18: return ts.Diagnostics.Type_parameter_declaration_expected; case 19: return ts.Diagnostics.Type_argument_expected; case 20: return ts.Diagnostics.Type_expected; case 21: return ts.Diagnostics.Unexpected_token_expected; case 22: return ts.Diagnostics.Identifier_expected; case 13: return ts.Diagnostics.Identifier_expected; case 14: return ts.Diagnostics.Identifier_expected } } function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; for (var list = [], listPos = getNodePos(), commaStart = -1; ;)if (isListElement(kind, !1)) { var startPos = scanner.getStartPos(); if (list.push(parseListElement(kind, parseElement)), commaStart = scanner.getTokenPos(), parseOptional(26)) continue; if (commaStart = -1, isListTerminator(kind)) break; parseExpected(26), considerSemicolonAsDelimiter && 25 === token() && !scanner.hasPrecedingLineBreak() && nextToken(), startPos === scanner.getStartPos() && nextToken() } else { if (isListTerminator(kind)) break; if (abortParsingListOrMoveToNextToken(kind)) break } parsingContext = saveParsingContext; var result = createNodeArray(list, listPos); return commaStart >= 0 && (result.hasTrailingComma = !0), result } function createMissingList() { return createNodeArray([], getNodePos()) } function parseBracketedList(kind, parseElement, open, close) { if (parseExpected(open)) { var result = parseDelimitedList(kind, parseElement); return parseExpected(close), result } return createMissingList() } function parseEntityName(allowReservedWords, diagnosticMessage) { for (var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage), dotPos = scanner.getStartPos(); parseOptional(23);) { if (27 === token()) { entity.jsdocDotPos = dotPos; break } dotPos = scanner.getStartPos(), entity = createQualifiedName(entity, parseRightSideOfDot(allowReservedWords)) } return entity } function createQualifiedName(entity, name) { var node = createNode(145, entity.pos); return node.left = entity, node.right = name, finishNode(node) } function parseRightSideOfDot(allowIdentifierNames) { if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) return createMissingNode(71, !0, ts.Diagnostics.Identifier_expected) } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier() } function parseTemplateExpression() { var template = createNode(201); template.head = parseTemplateHead(), ts.Debug.assert(14 === template.head.kind, "Template head has wrong token kind"); var list = [], listPos = getNodePos(); do list.push(parseTemplateSpan()); while (15 === ts.lastOrUndefined(list).literal.kind); return template.templateSpans = createNodeArray(list, listPos), finishNode(template) } function parseTemplateSpan() { var span = createNode(210); span.expression = allowInAnd(parseExpression); var literal; return 18 === token() ? (reScanTemplateToken(), literal = parseTemplateMiddleOrTemplateTail()) : literal = parseExpectedToken(16, ts.Diagnostics._0_expected, ts.tokenToString(18)), span.literal = literal, finishNode(span) } function parseLiteralNode() { return parseLiteralLikeNode(token()) } function parseTemplateHead() { var fragment = parseLiteralLikeNode(token()); return ts.Debug.assert(14 === fragment.kind, "Template head has wrong token kind"), fragment } function parseTemplateMiddleOrTemplateTail() { var fragment = parseLiteralLikeNode(token()); return ts.Debug.assert(15 === fragment.kind || 16 === fragment.kind, "Template fragment has wrong token kind"), fragment } function parseLiteralLikeNode(kind) { var node = createNode(kind), text = scanner.getTokenValue(); return node.text = text, scanner.hasExtendedUnicodeEscape() && (node.hasExtendedUnicodeEscape = !0), scanner.isUnterminated() && (node.isUnterminated = !0), 8 === node.kind && (node.numericLiteralFlags = 1008 & scanner.getTokenFlags()), nextToken(), finishNode(node), node } function parseTypeReference() { var node = createNode(161); return node.typeName = parseEntityName(!0, ts.Diagnostics.Type_expected), scanner.hasPrecedingLineBreak() || 27 !== token() || (node.typeArguments = parseBracketedList(19, parseType, 27, 29)), finishNode(node) } function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { case 161: return ts.nodeIsMissing(node.typeName); case 162: case 163: var _a = node, parameters = _a.parameters, type = _a.type; return parameters.pos === parameters.end || typeHasArrowFunctionBlockingParseError(type); case 172: return typeHasArrowFunctionBlockingParseError(node.type); default: return !1 } } function parseThisTypePredicate(lhs) { nextToken(); var node = createNode(160, lhs.pos); return node.parameterName = lhs, node.type = parseType(), finishNode(node) } function parseThisTypeNode() { var node = createNode(173); return nextToken(), finishNode(node) } function parseJSDocAllType(postFixEquals) { var result = createNode(278); return postFixEquals ? createJSDocPostfixType(282, result) : (nextToken(), finishNode(result)) } function parseJSDocNonNullableType() { var result = createNode(281); return nextToken(), result.type = parseNonArrayType(), finishNode(result) } function parseJSDocUnknownOrNullableType() { var pos = scanner.getStartPos(); if (nextToken(), 26 === token() || 18 === token() || 20 === token() || 29 === token() || 58 === token() || 49 === token()) { var result = createNode(279, pos); return finishNode(result) } var result = createNode(280, pos); return result.type = parseType(), finishNode(result) } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { var result = createNodeWithJSDoc(283); return nextToken(), fillSignature(56, 36, result), finishNode(result) } var node = createNode(161); return node.typeName = parseIdentifierName(), finishNode(node) } function parseJSDocParameter() { var parameter = createNode(148); return 99 !== token() && 94 !== token() || (parameter.name = parseIdentifierName(), parseExpected(56)), parameter.type = parseJSDocType(), finishNode(parameter) } function parseJSDocType() { var dotdotdot = parseOptionalToken(24), type = parseType(); if (dotdotdot) { var variadic = createNode(284, dotdotdot.pos); variadic.type = type, type = finishNode(variadic) } return 58 === token() ? createJSDocPostfixType(282, type) : type } function parseTypeQuery() { var node = createNode(164); return parseExpected(103), node.exprName = parseEntityName(!0), finishNode(node) } function parseTypeParameter() { var node = createNode(147); return node.name = parseIdentifier(), parseOptional(85) && (isStartOfType() || !isStartOfExpression() ? node.constraint = parseType() : node.expression = parseUnaryExpressionOrHigher()), parseOptional(58) && (node.default = parseType()), finishNode(node) } function parseTypeParameters() { if (27 === token()) return parseBracketedList(18, parseTypeParameter, 27, 29) } function parseParameterType() { if (parseOptional(56)) return parseType() } function isStartOfParameter() { return 24 === token() || isIdentifierOrPattern() || ts.isModifierKind(token()) || 57 === token() || isStartOfType(!0) } function parseParameter() { var node = createNodeWithJSDoc(148); return 99 === token() ? (node.name = createIdentifier(!0), node.type = parseParameterType(), finishNode(node)) : (node.decorators = parseDecorators(), node.modifiers = parseModifiers(), node.dotDotDotToken = parseOptionalToken(24), node.name = parseIdentifierOrPattern(), 0 === ts.getFullWidth(node.name) && !ts.hasModifiers(node) && ts.isModifierKind(token()) && nextToken(), node.questionToken = parseOptionalToken(55), node.type = parseParameterType(), node.initializer = parseInitializer(), finishNode(node)) } function fillSignature(returnToken, flags, signature) { 32 & flags || (signature.typeParameters = parseTypeParameters()); var parametersParsedSuccessfully = parseParameterList(signature, flags); return (!shouldParseReturnType(returnToken, !!(4 & flags)) || (signature.type = parseTypeOrTypePredicate(), !typeHasArrowFunctionBlockingParseError(signature.type))) && parametersParsedSuccessfully } function shouldParseReturnType(returnToken, isType) { return 36 === returnToken ? (parseExpected(returnToken), !0) : !!parseOptional(56) || !(!isType || 36 !== token()) && (parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(56)), nextToken(), !0) } function parseParameterList(signature, flags) { if (!parseExpected(19)) return signature.parameters = createMissingList(), !1; var savedYieldContext = inYieldContext(), savedAwaitContext = inAwaitContext(); return setYieldContext(!!(1 & flags)), setAwaitContext(!!(2 & flags)), signature.parameters = parseDelimitedList(16, 32 & flags ? parseJSDocParameter : parseParameter), setYieldContext(savedYieldContext), setAwaitContext(savedAwaitContext), parseExpected(20) } function parseTypeMemberSemicolon() { parseOptional(26) || parseSemicolon() } function parseSignatureMember(kind) { var node = createNodeWithJSDoc(kind); return 158 === kind && parseExpected(94), fillSignature(56, 4, node), parseTypeMemberSemicolon(), finishNode(node) } function isIndexSignature() { return 21 === token() && lookAhead(isUnambiguouslyIndexSignature) } function isUnambiguouslyIndexSignature() { if (nextToken(), 24 === token() || 22 === token()) return !0; if (ts.isModifierKind(token())) { if (nextToken(), isIdentifier()) return !0 } else { if (!isIdentifier()) return !1; nextToken() } return 56 === token() || 26 === token() || 55 === token() && (nextToken(), 56 === token() || 26 === token() || 22 === token()) } function parseIndexSignatureDeclaration(node) { return node.kind = 159, node.parameters = parseBracketedList(16, parseParameter, 21, 22), node.type = parseTypeAnnotation(), parseTypeMemberSemicolon(), finishNode(node) } function parsePropertyOrMethodSignature(node) { return node.name = parsePropertyName(), node.questionToken = parseOptionalToken(55), 19 === token() || 27 === token() ? (node.kind = 152, fillSignature(56, 4, node)) : (node.kind = 150, node.type = parseTypeAnnotation(), 58 === token() && (node.initializer = parseInitializer())), parseTypeMemberSemicolon(), finishNode(node) } function isTypeMemberStart() { if (19 === token() || 27 === token()) return !0; for (var idToken; ts.isModifierKind(token());)idToken = !0, nextToken(); return 21 === token() || (isLiteralPropertyName() && (idToken = !0, nextToken()), !!idToken && (19 === token() || 27 === token() || 55 === token() || 56 === token() || 26 === token() || canParseSemicolon())) } function parseTypeMember() { if (19 === token() || 27 === token()) return parseSignatureMember(157); if (94 === token() && lookAhead(nextTokenIsOpenParenOrLessThan)) return parseSignatureMember(158); var node = createNodeWithJSDoc(0); return node.modifiers = parseModifiers(), isIndexSignature() ? parseIndexSignatureDeclaration(node) : parsePropertyOrMethodSignature(node) } function nextTokenIsOpenParenOrLessThan() { return nextToken(), 19 === token() || 27 === token() } function nextTokenIsDot() { return 23 === nextToken() } function nextTokenIsOpenParenOrLessThanOrDot() { switch (nextToken()) { case 19: case 27: case 23: return !0 }return !1 } function parseTypeLiteral() { var node = createNode(165); return node.members = parseObjectTypeMembers(), finishNode(node) } function parseObjectTypeMembers() { var members; return parseExpected(17) ? (members = parseList(4, parseTypeMember), parseExpected(18)) : members = createMissingList(), members } function isStartOfMappedType() { return nextToken(), 37 === token() || 38 === token() ? 132 === nextToken() : (132 === token() && nextToken(), 21 === token() && nextTokenIsIdentifier() && 92 === nextToken()) } function parseMappedTypeParameter() { var node = createNode(147); return node.name = parseIdentifier(), parseExpected(92), node.constraint = parseType(), finishNode(node) } function parseMappedType() { var node = createNode(176); return parseExpected(17), 132 !== token() && 37 !== token() && 38 !== token() || (node.readonlyToken = parseTokenNode(), 132 !== node.readonlyToken.kind && parseExpectedToken(132)), parseExpected(21), node.typeParameter = parseMappedTypeParameter(), parseExpected(22), 55 !== token() && 37 !== token() && 38 !== token() || (node.questionToken = parseTokenNode(), 55 !== node.questionToken.kind && parseExpectedToken(55)), node.type = parseTypeAnnotation(), parseSemicolon(), parseExpected(18), finishNode(node) } function parseTupleType() { var node = createNode(167); return node.elementTypes = parseBracketedList(20, parseType, 21, 22), finishNode(node) } function parseParenthesizedType() { var node = createNode(172); return parseExpected(19), node.type = parseType(), parseExpected(20), finishNode(node) } function parseFunctionOrConstructorType() { var pos = getNodePos(), kind = parseOptional(94) ? 163 : 162, node = createNodeWithJSDoc(kind, pos); return fillSignature(36, 4, node), finishNode(node) } function parseKeywordAndNoDot() { var node = parseTokenNode(); return 23 === token() ? void 0 : node } function parseLiteralTypeNode(negative) { var unaryMinusExpression, node = createNode(177); negative && (unaryMinusExpression = createNode(197), unaryMinusExpression.operator = 38, nextToken()); var expression = 101 === token() || 86 === token() ? parseTokenNode() : parseLiteralLikeNode(token()); return negative && (unaryMinusExpression.operand = expression, finishNode(unaryMinusExpression), expression = unaryMinusExpression), node.literal = expression, finishNode(node) } function isStartOfTypeOfImportType() { return nextToken(), 91 === token() } function parseImportType() { sourceFile.flags |= 524288; var node = createNode(178); return parseOptional(103) && (node.isTypeOf = !0), parseExpected(91), parseExpected(19), node.argument = parseType(), parseExpected(20), parseOptional(23) && (node.qualifier = parseEntityName(!0, ts.Diagnostics.Type_expected)), node.typeArguments = tryParseTypeArguments(), finishNode(node) } function nextTokenIsNumericLiteral() { return 8 === nextToken() } function parseNonArrayType() { switch (token()) { case 119: case 137: case 134: case 138: case 122: case 140: case 131: case 135: return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 39: return parseJSDocAllType(!1); case 61: return parseJSDocAllType(!0); case 55: return parseJSDocUnknownOrNullableType(); case 89: return parseJSDocFunctionType(); case 51: return parseJSDocNonNullableType(); case 13: case 9: case 8: case 101: case 86: return parseLiteralTypeNode(); case 38: return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode(!0) : parseTypeReference(); case 105: case 95: return parseTokenNode(); case 99: var thisKeyword = parseThisTypeNode(); return 127 !== token() || scanner.hasPrecedingLineBreak() ? thisKeyword : parseThisTypePredicate(thisKeyword); case 103: return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 17: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); case 21: return parseTupleType(); case 19: return parseParenthesizedType(); case 91: return parseImportType(); default: return parseTypeReference() } } function isStartOfType(inStartOfParameter) { switch (token()) { case 119: case 137: case 134: case 122: case 138: case 141: case 105: case 140: case 95: case 99: case 103: case 131: case 17: case 21: case 27: case 49: case 48: case 94: case 9: case 8: case 101: case 86: case 135: case 39: case 55: case 51: case 24: case 126: case 91: return !0; case 38: return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); case 19: return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); default: return isIdentifier() } } function isStartOfParenthesizedOrFunctionType() { return nextToken(), 20 === token() || isStartOfParameter() || isStartOfType() } function parsePostfixTypeOrHigher() { for (var type = parseNonArrayType(); !scanner.hasPrecedingLineBreak();)switch (token()) { case 51: type = createJSDocPostfixType(281, type); break; case 55: if (!(2097152 & contextFlags) && lookAhead(nextTokenIsStartOfType)) return type; type = createJSDocPostfixType(280, type); break; case 21: if (parseExpected(21), isStartOfType()) { var node = createNode(175, type.pos); node.objectType = type, node.indexType = parseType(), parseExpected(22), type = finishNode(node) } else { var node = createNode(166, type.pos); node.elementType = type, parseExpected(22), type = finishNode(node) } break; default: return type }return type } function createJSDocPostfixType(kind, type) { nextToken(); var postfix = createNode(kind, type.pos); return postfix.type = type, finishNode(postfix) } function parseTypeOperator(operator) { var node = createNode(174); return parseExpected(operator), node.operator = operator, node.type = parseTypeOperatorOrHigher(), finishNode(node) } function parseInferType() { var node = createNode(171); parseExpected(126); var typeParameter = createNode(147); return typeParameter.name = parseIdentifier(), node.typeParameter = finishNode(typeParameter), finishNode(node) } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { case 128: case 141: return parseTypeOperator(operator); case 126: return parseInferType() }return parsePostfixTypeOrHigher() } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { for (var types = [type]; parseOptional(operator);)types.push(parseConstituentType()); var node = createNode(kind, type.pos); node.types = createNodeArray(types, type.pos), type = finishNode(node) } return type } function parseIntersectionTypeOrHigher() { return parseUnionOrIntersectionType(169, parseTypeOperatorOrHigher, 48) } function parseUnionTypeOrHigher() { return parseUnionOrIntersectionType(168, parseIntersectionTypeOrHigher, 49) } function isStartOfFunctionType() { return 27 === token() || 19 === token() && lookAhead(isUnambiguouslyStartOfFunctionType) } function skipParameterStart() { if (ts.isModifierKind(token()) && parseModifiers(), isIdentifier() || 99 === token()) return nextToken(), !0; if (21 === token() || 17 === token()) { var previousErrorCount = parseDiagnostics.length; return parseIdentifierOrPattern(), previousErrorCount === parseDiagnostics.length } return !1 } function isUnambiguouslyStartOfFunctionType() { if (nextToken(), 20 === token() || 24 === token()) return !0; if (skipParameterStart()) { if (56 === token() || 26 === token() || 55 === token() || 58 === token()) return !0; if (20 === token() && (nextToken(), 36 === token())) return !0 } return !1 } function parseTypeOrTypePredicate() { var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix), type = parseType(); if (typePredicateVariable) { var node = createNode(160, typePredicateVariable.pos); return node.parameterName = typePredicateVariable, node.type = type, finishNode(node) } return type } function parseTypePredicatePrefix() { var id = parseIdentifier(); if (127 === token() && !scanner.hasPrecedingLineBreak()) return nextToken(), id } function parseType() { return doOutsideOfContext(20480, parseTypeWorker) } function parseTypeWorker(noConditionalTypes) { if (isStartOfFunctionType() || 94 === token()) return parseFunctionOrConstructorType(); var type = parseUnionTypeOrHigher(); if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(85)) { var node = createNode(170, type.pos); return node.checkType = type, node.extendsType = parseTypeWorker(!0), parseExpected(55), node.trueType = parseTypeWorker(), parseExpected(56), node.falseType = parseTypeWorker(), finishNode(node) } return type } function parseTypeAnnotation() { return parseOptional(56) ? parseType() : void 0 } function isStartOfLeftHandSideExpression() { switch (token()) { case 99: case 97: case 95: case 101: case 86: case 8: case 9: case 13: case 14: case 19: case 21: case 17: case 89: case 75: case 94: case 41: case 63: case 71: return !0; case 91: return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); default: return isIdentifier() } } function isStartOfExpression() { if (isStartOfLeftHandSideExpression()) return !0; switch (token()) { case 37: case 38: case 52: case 51: case 80: case 103: case 105: case 43: case 44: case 27: case 121: case 116: return !0; default: return !!isBinaryOperator() || isIdentifier() } } function isStartOfExpressionStatement() { return 17 !== token() && 89 !== token() && 75 !== token() && 57 !== token() && isStartOfExpression() } function parseExpression() { var saveDecoratorContext = inDecoratorContext(); saveDecoratorContext && setDecoratorContext(!1); for (var operatorToken, expr = parseAssignmentExpressionOrHigher(); operatorToken = parseOptionalToken(26);)expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); return saveDecoratorContext && setDecoratorContext(!0), expr } function parseInitializer() { return parseOptional(58) ? parseAssignmentExpressionOrHigher() : void 0 } function parseAssignmentExpressionOrHigher() { if (isYieldExpression()) return parseYieldExpression(); var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression(); if (arrowExpression) return arrowExpression; var expr = parseBinaryExpressionOrHigher(0); return 71 === expr.kind && 36 === token() ? parseSimpleArrowFunctionExpression(expr) : ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken()) ? makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()) : parseConditionalExpressionRest(expr) } function isYieldExpression() { return 116 === token() && (!!inYieldContext() || lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine)) } function nextTokenIsIdentifierOnSameLine() { return nextToken(), !scanner.hasPrecedingLineBreak() && isIdentifier() } function parseYieldExpression() { var node = createNode(202); return nextToken(), scanner.hasPrecedingLineBreak() || 39 !== token() && !isStartOfExpression() ? finishNode(node) : (node.asteriskToken = parseOptionalToken(39), node.expression = parseAssignmentExpressionOrHigher(), finishNode(node)) } function parseSimpleArrowFunctionExpression(identifier, asyncModifier) { ts.Debug.assert(36 === token(), "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; asyncModifier ? (node = createNode(192, asyncModifier.pos), node.modifiers = asyncModifier) : node = createNode(192, identifier.pos); var parameter = createNode(148, identifier.pos); return parameter.name = identifier, finishNode(parameter), node.parameters = createNodeArray([parameter], parameter.pos, parameter.end), node.equalsGreaterThanToken = parseExpectedToken(36), node.body = parseArrowFunctionExpressionBody(!!asyncModifier), addJSDocComment(finishNode(node)) } function tryParseParenthesizedArrowFunctionExpression() { var triState = isParenthesizedArrowFunctionExpression(); if (0 !== triState) { var arrowFunction = 1 === triState ? parseParenthesizedArrowFunctionExpressionHead(!0) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (arrowFunction) { var isAsync = ts.hasModifier(arrowFunction, 256), lastToken = token(); return arrowFunction.equalsGreaterThanToken = parseExpectedToken(36), arrowFunction.body = 36 === lastToken || 17 === lastToken ? parseArrowFunctionExpressionBody(isAsync) : parseIdentifier(), finishNode(arrowFunction) } } } function isParenthesizedArrowFunctionExpression() { return 19 === token() || 27 === token() || 120 === token() ? lookAhead(isParenthesizedArrowFunctionExpressionWorker) : 36 === token() ? 1 : 0 } function isParenthesizedArrowFunctionExpressionWorker() { if (120 === token()) { if (nextToken(), scanner.hasPrecedingLineBreak()) return 0; if (19 !== token() && 27 !== token()) return 0 } var first = token(), second = nextToken(); if (19 === first) { if (20 === second) { var third = nextToken(); switch (third) { case 36: case 56: case 17: return 1; default: return 0 } } if (21 === second || 17 === second) return 2; if (24 === second) return 1; if (ts.isModifierKind(second) && 120 !== second && lookAhead(nextTokenIsIdentifier)) return 1; if (!isIdentifier()) return 0; switch (nextToken()) { case 56: return 1; case 55: return nextToken(), 56 === token() || 26 === token() || 58 === token() || 20 === token() ? 1 : 0; case 26: case 58: case 20: return 2 }return 0 } if (ts.Debug.assert(27 === first), !isIdentifier()) return 0; if (1 === sourceFile.languageVariant) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); if (85 === third) { var fourth = nextToken(); switch (fourth) { case 58: case 29: return !1; default: return !0 } } else if (26 === third) return !0; return !1 }); return isArrowFunctionInJsx ? 1 : 0 } return 2 } function parsePossibleParenthesizedArrowFunctionExpressionHead() { return parseParenthesizedArrowFunctionExpressionHead(!1) } function tryParseAsyncSimpleArrowFunctionExpression() { if (120 === token() && 1 === lookAhead(isUnParenthesizedAsyncArrowFunctionWorker)) { var asyncModifier = parseModifiersForArrowFunction(), expr = parseBinaryExpressionOrHigher(0); return parseSimpleArrowFunctionExpression(expr, asyncModifier) } } function isUnParenthesizedAsyncArrowFunctionWorker() { if (120 === token()) { if (nextToken(), scanner.hasPrecedingLineBreak() || 36 === token()) return 0; var expr = parseBinaryExpressionOrHigher(0); if (!scanner.hasPrecedingLineBreak() && 71 === expr.kind && 36 === token()) return 1 } return 0 } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { var node = createNodeWithJSDoc(192); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256) ? 2 : 0; if ((fillSignature(56, isAsync, node) || allowAmbiguity) && (allowAmbiguity || 36 === token() || 17 === token())) return node } function parseArrowFunctionExpressionBody(isAsync) { return 17 === token() ? parseFunctionBlock(isAsync ? 2 : 0) : 25 !== token() && 89 !== token() && 75 !== token() && isStartOfStatement() && !isStartOfExpressionStatement() ? parseFunctionBlock(16 | (isAsync ? 2 : 0)) : isAsync ? doInAwaitContext(parseAssignmentExpressionOrHigher) : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher) } function parseConditionalExpressionRest(leftOperand) { var questionToken = parseOptionalToken(55); if (!questionToken) return leftOperand; var node = createNode(200, leftOperand.pos); return node.condition = leftOperand, node.questionToken = questionToken, node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), node.colonToken = parseExpectedToken(56), node.whenFalse = ts.nodeIsPresent(node.colonToken) ? parseAssignmentExpressionOrHigher() : createMissingNode(71, !1, ts.Diagnostics._0_expected, ts.tokenToString(56)), finishNode(node) } function parseBinaryExpressionOrHigher(precedence) { var leftOperand = parseUnaryExpressionOrHigher(); return parseBinaryExpressionRest(precedence, leftOperand) } function isInOrOfKeyword(t) { return 92 === t || 144 === t } function parseBinaryExpressionRest(precedence, leftOperand) { for (; ;) { reScanGreaterToken(); var newPrecedence = ts.getBinaryOperatorPrecedence(token()), consumeCurrentOperator = 40 === token() ? newPrecedence >= precedence : newPrecedence > precedence; if (!consumeCurrentOperator) break; if (92 === token() && inDisallowInContext()) break; if (118 === token()) { if (scanner.hasPrecedingLineBreak()) break; nextToken(), leftOperand = makeAsExpression(leftOperand, parseType()) } else leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)) } return leftOperand } function isBinaryOperator() { return (!inDisallowInContext() || 92 !== token()) && ts.getBinaryOperatorPrecedence(token()) > 0 } function makeBinaryExpression(left, operatorToken, right) { var node = createNode(199, left.pos); return node.left = left, node.operatorToken = operatorToken, node.right = right, finishNode(node) } function makeAsExpression(left, right) { var node = createNode(207, left.pos); return node.expression = left, node.type = right, finishNode(node) } function parsePrefixUnaryExpression() { var node = createNode(197); return node.operator = token(), nextToken(), node.operand = parseSimpleUnaryExpression(), finishNode(node) } function parseDeleteExpression() { var node = createNode(193); return nextToken(), node.expression = parseSimpleUnaryExpression(), finishNode(node) } function parseTypeOfExpression() { var node = createNode(194); return nextToken(), node.expression = parseSimpleUnaryExpression(), finishNode(node) } function parseVoidExpression() { var node = createNode(195); return nextToken(), node.expression = parseSimpleUnaryExpression(), finishNode(node) } function isAwaitExpression() { return 121 === token() && (!!inAwaitContext() || lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine)) } function parseAwaitExpression() { var node = createNode(196); return nextToken(), node.expression = parseSimpleUnaryExpression(), finishNode(node) } function parseUnaryExpressionOrHigher() { if (isUpdateExpression()) { var updateExpression = parseUpdateExpression(); return 40 === token() ? parseBinaryExpressionRest(ts.getBinaryOperatorPrecedence(token()), updateExpression) : updateExpression } var unaryOperator = token(), simpleUnaryExpression = parseSimpleUnaryExpression(); if (40 === token()) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos), end = simpleUnaryExpression.end; 189 === simpleUnaryExpression.kind ? parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses) : parseErrorAt(pos, end, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator)) } return simpleUnaryExpression } function parseSimpleUnaryExpression() { switch (token()) { case 37: case 38: case 52: case 51: return parsePrefixUnaryExpression(); case 80: return parseDeleteExpression(); case 103: return parseTypeOfExpression(); case 105: return parseVoidExpression(); case 27: return parseTypeAssertion(); case 121: if (isAwaitExpression()) return parseAwaitExpression(); default: return parseUpdateExpression() } } function isUpdateExpression() { switch (token()) { case 37: case 38: case 52: case 51: case 80: case 103: case 105: case 121: return !1; case 27: if (1 !== sourceFile.languageVariant) return !1; default: return !0 } } function parseUpdateExpression() { if (43 === token() || 44 === token()) { var node = createNode(197); return node.operator = token(), nextToken(), node.operand = parseLeftHandSideExpressionOrHigher(), finishNode(node) } if (1 === sourceFile.languageVariant && 27 === token() && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) return parseJsxElementOrSelfClosingElementOrFragment(!0); var expression = parseLeftHandSideExpressionOrHigher(); if (ts.Debug.assert(ts.isLeftHandSideExpression(expression)), (43 === token() || 44 === token()) && !scanner.hasPrecedingLineBreak()) { var node = createNode(198, expression.pos); return node.operand = expression, node.operator = token(), nextToken(), finishNode(node) } return expression } function parseLeftHandSideExpressionOrHigher() { var expression; if (91 === token()) if (lookAhead(nextTokenIsOpenParenOrLessThan)) sourceFile.flags |= 524288, expression = parseTokenNode(); else if (lookAhead(nextTokenIsDot)) { var fullStart = scanner.getStartPos(); nextToken(), nextToken(); var node = createNode(209, fullStart); node.keywordToken = 91, node.name = parseIdentifierName(), expression = finishNode(node), sourceFile.flags |= 1048576 } else expression = parseMemberExpressionOrHigher(); else expression = 97 === token() ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression) } function parseMemberExpressionOrHigher() { var expression = parsePrimaryExpression(); return parseMemberExpressionRest(expression) } function parseSuperExpression() { var expression = parseTokenNode(); if (19 === token() || 23 === token() || 21 === token()) return expression; var node = createNode(184, expression.pos); return node.expression = expression, parseExpectedToken(23, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access), node.name = parseRightSideOfDot(!0), finishNode(node) } function tagNamesAreEquivalent(lhs, rhs) { return lhs.kind === rhs.kind && (71 === lhs.kind ? lhs.escapedText === rhs.escapedText : 99 === lhs.kind || lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression)) } function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var result, opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); if (256 === opening.kind) { var node = createNode(254, opening.pos); node.openingElement = opening, node.children = parseJsxChildren(node.openingElement), node.closingElement = parseJsxClosingElement(inExpressionContext), tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName) || parseErrorAtRange(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)), result = finishNode(node) } else if (259 === opening.kind) { var node = createNode(258, opening.pos); node.openingFragment = opening, node.children = parseJsxChildren(node.openingFragment), node.closingFragment = parseJsxClosingFragment(inExpressionContext), result = finishNode(node) } else ts.Debug.assert(255 === opening.kind), result = opening; if (inExpressionContext && 27 === token()) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(!0) }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); var badNode = createNode(199, result.pos); return badNode.end = invalidElement.end, badNode.left = result, badNode.right = invalidElement, badNode.operatorToken = createMissingNode(26, !1, void 0), badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos, badNode } } return result } function parseJsxText() { var node = createNode(10); return node.containsOnlyWhiteSpaces = 11 === currentToken, currentToken = scanner.scanJsxToken(), finishNode(node) } function parseJsxChild(openingTag, token) { switch (token) { case 1: return void (ts.isJsxOpeningFragment(openingTag) ? parseErrorAtRange(openingTag, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag) : parseErrorAtRange(openingTag.tagName, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTag.tagName))); case 28: case 7: return; case 10: case 11: return parseJsxText(); case 17: return parseJsxExpression(!1); case 27: return parseJsxElementOrSelfClosingElementOrFragment(!1); default: return ts.Debug.assertNever(token) } } function parseJsxChildren(openingTag) { var list = [], listPos = getNodePos(), saveParsingContext = parsingContext; for (parsingContext |= 16384; ;) { var child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken()); if (!child) break; list.push(child) } return parsingContext = saveParsingContext, createNodeArray(list, listPos) } function parseJsxAttributes() { var jsxAttributes = createNode(262); return jsxAttributes.properties = parseList(13, parseJsxAttribute), finishNode(jsxAttributes) } function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { var fullStart = scanner.getStartPos(); if (parseExpected(27), 29 === token()) { var node_1 = createNode(259, fullStart); return scanJsxText(), finishNode(node_1) } var node, tagName = parseJsxElementName(), typeArguments = tryParseTypeArguments(), attributes = parseJsxAttributes(); return 29 === token() ? (node = createNode(256, fullStart), scanJsxText()) : (parseExpected(41), inExpressionContext ? parseExpected(29) : (parseExpected(29, void 0, !1), scanJsxText()), node = createNode(255, fullStart)), node.tagName = tagName, node.typeArguments = typeArguments, node.attributes = attributes, finishNode(node) } function parseJsxElementName() { scanJsxIdentifier(); for (var expression = 99 === token() ? parseTokenNode() : parseIdentifierName(); parseOptional(23);) { var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression, propertyAccess.name = parseRightSideOfDot(!0), expression = finishNode(propertyAccess) } return expression } function parseJsxExpression(inExpressionContext) { var node = createNode(264); if (parseExpected(17)) return 18 !== token() && (node.dotDotDotToken = parseOptionalToken(24), node.expression = parseAssignmentExpressionOrHigher()), inExpressionContext ? parseExpected(18) : (parseExpected(18, void 0, !1), scanJsxText()), finishNode(node) } function parseJsxAttribute() { if (17 === token()) return parseJsxSpreadAttribute(); scanJsxIdentifier(); var node = createNode(261); if (node.name = parseIdentifierName(), 58 === token()) switch (scanJsxAttributeValue()) { case 9: node.initializer = parseLiteralNode(); break; default: node.initializer = parseJsxExpression(!0) }return finishNode(node) } function parseJsxSpreadAttribute() { var node = createNode(263); return parseExpected(17), parseExpected(24), node.expression = parseExpression(), parseExpected(18), finishNode(node) } function parseJsxClosingElement(inExpressionContext) { var node = createNode(257); return parseExpected(28), node.tagName = parseJsxElementName(), inExpressionContext ? parseExpected(29) : (parseExpected(29, void 0, !1), scanJsxText()), finishNode(node) } function parseJsxClosingFragment(inExpressionContext) { var node = createNode(260); return parseExpected(28), ts.tokenIsIdentifierOrKeyword(token()) && parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment), inExpressionContext ? parseExpected(29) : (parseExpected(29, void 0, !1), scanJsxText()), finishNode(node) } function parseTypeAssertion() { var node = createNode(189); return parseExpected(27), node.type = parseType(), parseExpected(29), node.expression = parseSimpleUnaryExpression(), finishNode(node) } function parseMemberExpressionRest(expression) { for (; ;) { var dotToken = parseOptionalToken(23); if (dotToken) { var propertyAccess = createNode(184, expression.pos); propertyAccess.expression = expression, propertyAccess.name = parseRightSideOfDot(!0), expression = finishNode(propertyAccess) } else if (51 !== token() || scanner.hasPrecedingLineBreak()) if (inDecoratorContext() || !parseOptional(21)) { if (!isTemplateStartOfTaggedTemplate()) return expression; expression = parseTaggedTemplateRest(expression, void 0) } else { var indexedAccess = createNode(185, expression.pos); if (indexedAccess.expression = expression, 22 === token()) indexedAccess.argumentExpression = createMissingNode(71, !0, ts.Diagnostics.An_element_access_expression_should_take_an_argument); else { var argument = allowInAnd(parseExpression); ts.isStringOrNumericLiteral(argument) && (argument.text = internIdentifier(argument.text)), indexedAccess.argumentExpression = argument } parseExpected(22), expression = finishNode(indexedAccess) } else { nextToken(); var nonNullExpression = createNode(208, expression.pos); nonNullExpression.expression = expression, expression = finishNode(nonNullExpression) } } } function isTemplateStartOfTaggedTemplate() { return 13 === token() || 14 === token() } function parseTaggedTemplateRest(tag, typeArguments) { var tagExpression = createNode(188, tag.pos); return tagExpression.tag = tag, tagExpression.typeArguments = typeArguments, tagExpression.template = 13 === token() ? parseLiteralNode() : parseTemplateExpression(), finishNode(tagExpression) } function parseCallExpressionRest(expression) { for (; ;)if (expression = parseMemberExpressionRest(expression), 27 !== token()) { if (19 !== token()) return expression; var callExpr = createNode(186, expression.pos); callExpr.expression = expression, callExpr.arguments = parseArgumentList(), expression = finishNode(callExpr) } else { var typeArguments = tryParse(parseTypeArgumentsInExpression); if (!typeArguments) return expression; if (isTemplateStartOfTaggedTemplate()) { expression = parseTaggedTemplateRest(expression, typeArguments); continue } var callExpr = createNode(186, expression.pos); callExpr.expression = expression, callExpr.typeArguments = typeArguments, callExpr.arguments = parseArgumentList(), expression = finishNode(callExpr) } } function parseArgumentList() { parseExpected(19); var result = parseDelimitedList(11, parseArgumentExpression); return parseExpected(20), result } function parseTypeArgumentsInExpression() { if (parseOptional(27)) { var typeArguments = parseDelimitedList(19, parseType); if (parseExpected(29)) return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : void 0 } } function canFollowTypeArgumentsInExpression() { switch (token()) { case 19: case 13: case 14: case 23: case 20: case 22: case 56: case 25: case 55: case 32: case 34: case 33: case 35: case 53: case 54: case 50: case 48: case 49: case 18: case 1: return !0; case 26: case 17: default: return !1 } } function parsePrimaryExpression() { switch (token()) { case 8: case 9: case 13: return parseLiteralNode(); case 99: case 97: case 95: case 101: case 86: return parseTokenNode(); case 19: return parseParenthesizedExpression(); case 21: return parseArrayLiteralExpression(); case 17: return parseObjectLiteralExpression(); case 120: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) break; return parseFunctionExpression(); case 75: return parseClassExpression(); case 89: return parseFunctionExpression(); case 94: return parseNewExpressionOrNewDotTarget(); case 41: case 63: if (12 === reScanSlashToken()) return parseLiteralNode(); break; case 14: return parseTemplateExpression() }return parseIdentifier(ts.Diagnostics.Expression_expected) } function parseParenthesizedExpression() { var node = createNodeWithJSDoc(190); return parseExpected(19), node.expression = allowInAnd(parseExpression), parseExpected(20), finishNode(node) } function parseSpreadElement() { var node = createNode(203); return parseExpected(24), node.expression = parseAssignmentExpressionOrHigher(), finishNode(node) } function parseArgumentOrArrayLiteralElement() { return 24 === token() ? parseSpreadElement() : 26 === token() ? createNode(205) : parseAssignmentExpressionOrHigher() } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement) } function parseArrayLiteralExpression() { var node = createNode(182); return parseExpected(21), scanner.hasPrecedingLineBreak() && (node.multiLine = !0), node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement), parseExpected(22), finishNode(node) } function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0); if (parseOptionalToken(24)) return node.kind = 271, node.expression = parseAssignmentExpressionOrHigher(), finishNode(node); if (node.decorators = parseDecorators(), node.modifiers = parseModifiers(), parseContextualModifier(125)) return parseAccessorDeclaration(node, 155); if (parseContextualModifier(136)) return parseAccessorDeclaration(node, 156); var asteriskToken = parseOptionalToken(39), tokenIsIdentifier = isIdentifier(); if (node.name = parsePropertyName(), node.questionToken = parseOptionalToken(55), asteriskToken || 19 === token() || 27 === token()) return parseMethodDeclaration(node, asteriskToken); var isShorthandPropertyAssignment = tokenIsIdentifier && (26 === token() || 18 === token() || 58 === token()); if (isShorthandPropertyAssignment) { node.kind = 270; var equalsToken = parseOptionalToken(58); equalsToken && (node.equalsToken = equalsToken, node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher)) } else node.kind = 269, parseExpected(56), node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(node) } function parseObjectLiteralExpression() { var node = createNode(183); return parseExpected(17), scanner.hasPrecedingLineBreak() && (node.multiLine = !0), node.properties = parseDelimitedList(12, parseObjectLiteralElement, !0), parseExpected(18), finishNode(node) } function parseFunctionExpression() { var saveDecoratorContext = inDecoratorContext(); saveDecoratorContext && setDecoratorContext(!1); var node = createNodeWithJSDoc(191); node.modifiers = parseModifiers(), parseExpected(89), node.asteriskToken = parseOptionalToken(39); var isGenerator = node.asteriskToken ? 1 : 0, isAsync = ts.hasModifier(node, 256) ? 2 : 0; return node.name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(), fillSignature(56, isGenerator | isAsync, node), node.body = parseFunctionBlock(isGenerator | isAsync), saveDecoratorContext && setDecoratorContext(!0), finishNode(node) } function parseOptionalIdentifier() { return isIdentifier() ? parseIdentifier() : void 0 } function parseNewExpressionOrNewDotTarget() { var fullStart = scanner.getStartPos(); if (parseExpected(94), parseOptional(23)) { var node_2 = createNode(209, fullStart); return node_2.keywordToken = 94, node_2.name = parseIdentifierName(), finishNode(node_2) } for (var typeArguments, expression = parsePrimaryExpression(); ;) { expression = parseMemberExpressionRest(expression), typeArguments = tryParse(parseTypeArgumentsInExpression), isTemplateStartOfTaggedTemplate() && (ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'"), expression = parseTaggedTemplateRest(expression, typeArguments), typeArguments = void 0); break } var node = createNode(187, fullStart); return node.expression = expression, node.typeArguments = typeArguments, (node.typeArguments || 19 === token()) && (node.arguments = parseArgumentList()), finishNode(node) } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { var node = createNode(212); return parseExpected(17, diagnosticMessage) || ignoreMissingOpenBrace ? (scanner.hasPrecedingLineBreak() && (node.multiLine = !0), node.statements = parseList(1, parseStatement), parseExpected(18)) : node.statements = createMissingList(), finishNode(node) } function parseFunctionBlock(flags, diagnosticMessage) { var savedYieldContext = inYieldContext(); setYieldContext(!!(1 & flags)); var savedAwaitContext = inAwaitContext(); setAwaitContext(!!(2 & flags)); var saveDecoratorContext = inDecoratorContext(); saveDecoratorContext && setDecoratorContext(!1); var block = parseBlock(!!(16 & flags), diagnosticMessage); return saveDecoratorContext && setDecoratorContext(!0), setYieldContext(savedYieldContext), setAwaitContext(savedAwaitContext), block } function parseEmptyStatement() { var node = createNode(214); return parseExpected(25), finishNode(node) } function parseIfStatement() { var node = createNode(216); return parseExpected(90), parseExpected(19), node.expression = allowInAnd(parseExpression), parseExpected(20), node.thenStatement = parseStatement(), node.elseStatement = parseOptional(82) ? parseStatement() : void 0, finishNode(node) } function parseDoStatement() { var node = createNode(217); return parseExpected(81), node.statement = parseStatement(), parseExpected(106), parseExpected(19), node.expression = allowInAnd(parseExpression), parseExpected(20), parseOptional(25), finishNode(node) } function parseWhileStatement() { var node = createNode(218); return parseExpected(106), parseExpected(19), node.expression = allowInAnd(parseExpression), parseExpected(20), node.statement = parseStatement(), finishNode(node) } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(88); var awaitToken = parseOptionalToken(121); parseExpected(19); var initializer; 25 !== token() && (initializer = 104 === token() || 110 === token() || 76 === token() ? parseVariableDeclarationList(!0) : disallowInAnd(parseExpression)); var forOrForInOrForOfStatement; if (awaitToken ? parseExpected(144) : parseOptional(144)) { var forOfStatement = createNode(221, pos); forOfStatement.awaitModifier = awaitToken, forOfStatement.initializer = initializer, forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher), parseExpected(20), forOrForInOrForOfStatement = forOfStatement } else if (parseOptional(92)) { var forInStatement = createNode(220, pos); forInStatement.initializer = initializer, forInStatement.expression = allowInAnd(parseExpression), parseExpected(20), forOrForInOrForOfStatement = forInStatement } else { var forStatement = createNode(219, pos); forStatement.initializer = initializer, parseExpected(25), 25 !== token() && 20 !== token() && (forStatement.condition = allowInAnd(parseExpression)), parseExpected(25), 20 !== token() && (forStatement.incrementor = allowInAnd(parseExpression)), parseExpected(20), forOrForInOrForOfStatement = forStatement } return forOrForInOrForOfStatement.statement = parseStatement(), finishNode(forOrForInOrForOfStatement) } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); return parseExpected(223 === kind ? 72 : 77), canParseSemicolon() || (node.label = parseIdentifier()), parseSemicolon(), finishNode(node); } function parseReturnStatement() { var node = createNode(224); return parseExpected(96), canParseSemicolon() || (node.expression = allowInAnd(parseExpression)), parseSemicolon(), finishNode(node) } function parseWithStatement() { var node = createNode(225); return parseExpected(107), parseExpected(19), node.expression = allowInAnd(parseExpression), parseExpected(20), node.statement = doInsideOfContext(8388608, parseStatement), finishNode(node) } function parseCaseClause() { var node = createNode(265); return parseExpected(73), node.expression = allowInAnd(parseExpression), parseExpected(56), node.statements = parseList(3, parseStatement), finishNode(node) } function parseDefaultClause() { var node = createNode(266); return parseExpected(79), parseExpected(56), node.statements = parseList(3, parseStatement), finishNode(node) } function parseCaseOrDefaultClause() { return 73 === token() ? parseCaseClause() : parseDefaultClause() } function parseSwitchStatement() { var node = createNode(226); parseExpected(98), parseExpected(19), node.expression = allowInAnd(parseExpression), parseExpected(20); var caseBlock = createNode(240); return parseExpected(17), caseBlock.clauses = parseList(2, parseCaseOrDefaultClause), parseExpected(18), node.caseBlock = finishNode(caseBlock), finishNode(node) } function parseThrowStatement() { var node = createNode(228); return parseExpected(100), node.expression = scanner.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression), parseSemicolon(), finishNode(node) } function parseTryStatement() { var node = createNode(229); return parseExpected(102), node.tryBlock = parseBlock(!1), node.catchClause = 74 === token() ? parseCatchClause() : void 0, node.catchClause && 87 !== token() || (parseExpected(87), node.finallyBlock = parseBlock(!1)), finishNode(node) } function parseCatchClause() { var result = createNode(268); return parseExpected(74), parseOptional(19) ? (result.variableDeclaration = parseVariableDeclaration(), parseExpected(20)) : result.variableDeclaration = void 0, result.block = parseBlock(!1), finishNode(result) } function parseDebuggerStatement() { var node = createNode(230); return parseExpected(78), parseSemicolon(), finishNode(node) } function parseExpressionOrLabeledStatement() { var node = createNodeWithJSDoc(0), expression = allowInAnd(parseExpression); return 71 === expression.kind && parseOptional(56) ? (node.kind = 227, node.label = expression, node.statement = parseStatement()) : (node.kind = 215, node.expression = expression, parseSemicolon()), finishNode(node) } function nextTokenIsIdentifierOrKeywordOnSameLine() { return nextToken(), ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak() } function nextTokenIsClassKeywordOnSameLine() { return nextToken(), 75 === token() && !scanner.hasPrecedingLineBreak() } function nextTokenIsFunctionKeywordOnSameLine() { return nextToken(), 89 === token() && !scanner.hasPrecedingLineBreak() } function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() { return nextToken(), (ts.tokenIsIdentifierOrKeyword(token()) || 8 === token() || 9 === token()) && !scanner.hasPrecedingLineBreak() } function isDeclaration() { for (; ;)switch (token()) { case 104: case 110: case 76: case 89: case 75: case 83: return !0; case 109: case 139: return nextTokenIsIdentifierOnSameLine(); case 129: case 130: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 117: case 120: case 124: case 112: case 113: case 114: case 132: if (nextToken(), scanner.hasPrecedingLineBreak()) return !1; continue; case 143: return nextToken(), 17 === token() || 71 === token() || 84 === token(); case 91: return nextToken(), 9 === token() || 39 === token() || 17 === token() || ts.tokenIsIdentifierOrKeyword(token()); case 84: if (nextToken(), 58 === token() || 39 === token() || 17 === token() || 79 === token() || 118 === token()) return !0; continue; case 115: nextToken(); continue; default: return !1 } } function isStartOfDeclaration() { return lookAhead(isDeclaration) } function isStartOfStatement() { switch (token()) { case 57: case 25: case 17: case 104: case 110: case 89: case 75: case 83: case 90: case 81: case 106: case 88: case 77: case 72: case 96: case 107: case 98: case 100: case 102: case 78: case 74: case 87: return !0; case 91: return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot); case 76: case 84: return isStartOfDeclaration(); case 120: case 124: case 109: case 129: case 130: case 139: case 143: return !0; case 114: case 112: case 113: case 115: case 132: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression() } } function nextTokenIsIdentifierOrStartOfDestructuring() { return nextToken(), isIdentifier() || 17 === token() || 21 === token() } function isLetDeclaration() { return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring) } function parseStatement() { switch (token()) { case 25: return parseEmptyStatement(); case 17: return parseBlock(!1); case 104: return parseVariableStatement(createNodeWithJSDoc(231)); case 110: if (isLetDeclaration()) return parseVariableStatement(createNodeWithJSDoc(231)); break; case 89: return parseFunctionDeclaration(createNodeWithJSDoc(233)); case 75: return parseClassDeclaration(createNodeWithJSDoc(234)); case 90: return parseIfStatement(); case 81: return parseDoStatement(); case 106: return parseWhileStatement(); case 88: return parseForOrForInOrForOfStatement(); case 77: return parseBreakOrContinueStatement(222); case 72: return parseBreakOrContinueStatement(223); case 96: return parseReturnStatement(); case 107: return parseWithStatement(); case 98: return parseSwitchStatement(); case 100: return parseThrowStatement(); case 102: case 74: case 87: return parseTryStatement(); case 78: return parseDebuggerStatement(); case 57: return parseDeclaration(); case 120: case 109: case 139: case 129: case 130: case 124: case 76: case 83: case 84: case 91: case 112: case 113: case 114: case 117: case 115: case 132: case 143: if (isStartOfDeclaration()) return parseDeclaration() }return parseExpressionOrLabeledStatement() } function isDeclareModifier(modifier) { return 124 === modifier.kind } function parseDeclaration() { var node = createNodeWithJSDoc(0); if (node.decorators = parseDecorators(), node.modifiers = parseModifiers(), ts.some(node.modifiers, isDeclareModifier)) { for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var m = _a[_i]; m.flags |= 4194304 } return doInsideOfContext(4194304, function () { return parseDeclarationWorker(node) }) } return parseDeclarationWorker(node) } function parseDeclarationWorker(node) { switch (token()) { case 104: case 110: case 76: return parseVariableStatement(node); case 89: return parseFunctionDeclaration(node); case 75: return parseClassDeclaration(node); case 109: return parseInterfaceDeclaration(node); case 139: return parseTypeAliasDeclaration(node); case 83: return parseEnumDeclaration(node); case 143: case 129: case 130: return parseModuleDeclaration(node); case 91: return parseImportDeclarationOrImportEqualsDeclaration(node); case 84: switch (nextToken(), token()) { case 79: case 58: return parseExportAssignment(node); case 118: return parseNamespaceExportDeclaration(node); default: return parseExportDeclaration(node) }default: if (node.decorators || node.modifiers) { var missing = createMissingNode(252, !0, ts.Diagnostics.Declaration_expected); return missing.pos = node.pos, missing.decorators = node.decorators, missing.modifiers = node.modifiers, finishNode(missing) } } } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { return nextToken(), !scanner.hasPrecedingLineBreak() && (isIdentifier() || 9 === token()) } function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) { return 17 !== token() && canParseSemicolon() ? void parseSemicolon() : parseFunctionBlock(flags, diagnosticMessage) } function parseArrayBindingElement() { if (26 === token()) return createNode(205); var node = createNode(181); return node.dotDotDotToken = parseOptionalToken(24), node.name = parseIdentifierOrPattern(), node.initializer = parseInitializer(), finishNode(node) } function parseObjectBindingElement() { var node = createNode(181); node.dotDotDotToken = parseOptionalToken(24); var tokenIsIdentifier = isIdentifier(), propertyName = parsePropertyName(); return tokenIsIdentifier && 56 !== token() ? node.name = propertyName : (parseExpected(56), node.propertyName = propertyName, node.name = parseIdentifierOrPattern()), node.initializer = parseInitializer(), finishNode(node) } function parseObjectBindingPattern() { var node = createNode(179); return parseExpected(17), node.elements = parseDelimitedList(9, parseObjectBindingElement), parseExpected(18), finishNode(node) } function parseArrayBindingPattern() { var node = createNode(180); return parseExpected(21), node.elements = parseDelimitedList(10, parseArrayBindingElement), parseExpected(22), finishNode(node) } function isIdentifierOrPattern() { return 17 === token() || 21 === token() || isIdentifier() } function parseIdentifierOrPattern() { return 21 === token() ? parseArrayBindingPattern() : 17 === token() ? parseObjectBindingPattern() : parseIdentifier() } function parseVariableDeclarationAllowExclamation() { return parseVariableDeclaration(!0) } function parseVariableDeclaration(allowExclamation) { var node = createNode(231); return node.name = parseIdentifierOrPattern(), allowExclamation && 71 === node.name.kind && 51 === token() && !scanner.hasPrecedingLineBreak() && (node.exclamationToken = parseTokenNode()), node.type = parseTypeAnnotation(), isInOrOfKeyword(token()) || (node.initializer = parseInitializer()), finishNode(node) } function parseVariableDeclarationList(inForStatementInitializer) { var node = createNode(232); switch (token()) { case 104: break; case 110: node.flags |= 1; break; case 76: node.flags |= 2; break; default: ts.Debug.fail() }if (nextToken(), 144 === token() && lookAhead(canFollowContextualOfKeyword)) node.declarations = createMissingList(); else { var savedDisallowIn = inDisallowInContext(); setDisallowInContext(inForStatementInitializer), node.declarations = parseDelimitedList(8, inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation), setDisallowInContext(savedDisallowIn) } return finishNode(node) } function canFollowContextualOfKeyword() { return nextTokenIsIdentifier() && 20 === nextToken() } function parseVariableStatement(node) { return node.kind = 213, node.declarationList = parseVariableDeclarationList(!1), parseSemicolon(), finishNode(node) } function parseFunctionDeclaration(node) { node.kind = 233, parseExpected(89), node.asteriskToken = parseOptionalToken(39), node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = node.asteriskToken ? 1 : 0, isAsync = ts.hasModifier(node, 256) ? 2 : 0; return fillSignature(56, isGenerator | isAsync, node), node.body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected), finishNode(node) } function parseConstructorDeclaration(node) { return node.kind = 154, parseExpected(123), fillSignature(56, 0, node), node.body = parseFunctionBlockOrSemicolon(0, ts.Diagnostics.or_expected), finishNode(node) } function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) { node.kind = 153, node.asteriskToken = asteriskToken; var isGenerator = asteriskToken ? 1 : 0, isAsync = ts.hasModifier(node, 256) ? 2 : 0; return fillSignature(56, isGenerator | isAsync, node), node.body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage), finishNode(node) } function parsePropertyDeclaration(node) { return node.kind = 151, node.questionToken || 51 !== token() || scanner.hasPrecedingLineBreak() || (node.exclamationToken = parseTokenNode()), node.type = parseTypeAnnotation(), node.initializer = ts.hasModifier(node, 32) ? allowInAnd(parseInitializer) : doOutsideOfContext(6144, parseInitializer), parseSemicolon(), finishNode(node) } function parsePropertyOrMethodDeclaration(node) { var asteriskToken = parseOptionalToken(39); return node.name = parsePropertyName(), node.questionToken = parseOptionalToken(55), asteriskToken || 19 === token() || 27 === token() ? parseMethodDeclaration(node, asteriskToken, ts.Diagnostics.or_expected) : parsePropertyDeclaration(node) } function parseAccessorDeclaration(node, kind) { return node.kind = kind, node.name = parsePropertyName(), fillSignature(56, 0, node), node.body = parseFunctionBlockOrSemicolon(0), finishNode(node) } function isClassMemberStart() { var idToken; if (57 === token()) return !0; for (; ts.isModifierKind(token());) { if (idToken = token(), ts.isClassMemberModifier(idToken)) return !0; nextToken() } if (39 === token()) return !0; if (isLiteralPropertyName() && (idToken = token(), nextToken()), 21 === token()) return !0; if (void 0 !== idToken) { if (!ts.isKeyword(idToken) || 136 === idToken || 125 === idToken) return !0; switch (token()) { case 19: case 27: case 51: case 56: case 58: case 55: return !0; default: return canParseSemicolon() } } return !1 } function parseDecorators() { for (var list, listPos = getNodePos(); ;) { var decoratorStart = getNodePos(); if (!parseOptional(57)) break; var decorator = createNode(149, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher), finishNode(decorator), (list || (list = [])).push(decorator) } return list && createNodeArray(list, listPos) } function parseModifiers(permitInvalidConstAsModifier) { for (var list, listPos = getNodePos(); ;) { var modifierStart = scanner.getStartPos(), modifierKind = token(); if (76 === token() && permitInvalidConstAsModifier) { if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) break } else if (!parseAnyContextualModifier()) break; var modifier = finishNode(createNode(modifierKind, modifierStart)); (list || (list = [])).push(modifier) } return list && createNodeArray(list, listPos) } function parseModifiersForArrowFunction() { var modifiers; if (120 === token()) { var modifierStart = scanner.getStartPos(), modifierKind = token(); nextToken(); var modifier = finishNode(createNode(modifierKind, modifierStart)); modifiers = createNodeArray([modifier], modifierStart) } return modifiers } function parseClassElement() { if (25 === token()) { var result = createNode(211); return nextToken(), finishNode(result) } var node = createNodeWithJSDoc(0); return node.decorators = parseDecorators(), node.modifiers = parseModifiers(!0), parseContextualModifier(125) ? parseAccessorDeclaration(node, 155) : parseContextualModifier(136) ? parseAccessorDeclaration(node, 156) : 123 === token() ? parseConstructorDeclaration(node) : isIndexSignature() ? parseIndexSignatureDeclaration(node) : ts.tokenIsIdentifierOrKeyword(token()) || 9 === token() || 8 === token() || 39 === token() || 21 === token() ? parsePropertyOrMethodDeclaration(node) : node.decorators || node.modifiers ? (node.name = createMissingNode(71, !0, ts.Diagnostics.Declaration_expected), parsePropertyDeclaration(node)) : void ts.Debug.fail("Should not have attempted to parse class member declaration.") } function parseClassExpression() { return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 204) } function parseClassDeclaration(node) { return parseClassDeclarationOrExpression(node, 234) } function parseClassDeclarationOrExpression(node, kind) { return node.kind = kind, parseExpected(75), node.name = parseNameOfClassDeclarationOrExpression(), node.typeParameters = parseTypeParameters(), node.heritageClauses = parseHeritageClauses(), parseExpected(17) ? (node.members = parseClassMembers(), parseExpected(18)) : node.members = createMissingList(), finishNode(node) } function parseNameOfClassDeclarationOrExpression() { return isIdentifier() && !isImplementsClause() ? parseIdentifier() : void 0 } function isImplementsClause() { return 108 === token() && lookAhead(nextTokenIsIdentifierOrKeyword) } function parseHeritageClauses() { if (isHeritageClause()) return parseList(21, parseHeritageClause) } function parseHeritageClause() { var tok = token(); if (85 === tok || 108 === tok) { var node = createNode(267); return node.token = tok, nextToken(), node.types = parseDelimitedList(7, parseExpressionWithTypeArguments), finishNode(node) } } function parseExpressionWithTypeArguments() { var node = createNode(206); return node.expression = parseLeftHandSideExpressionOrHigher(), node.typeArguments = tryParseTypeArguments(), finishNode(node) } function tryParseTypeArguments() { return 27 === token() ? parseBracketedList(19, parseType, 27, 29) : void 0 } function isHeritageClause() { return 85 === token() || 108 === token() } function parseClassMembers() { return parseList(5, parseClassElement) } function parseInterfaceDeclaration(node) { return node.kind = 235, parseExpected(109), node.name = parseIdentifier(), node.typeParameters = parseTypeParameters(), node.heritageClauses = parseHeritageClauses(), node.members = parseObjectTypeMembers(), finishNode(node) } function parseTypeAliasDeclaration(node) { return node.kind = 236, parseExpected(139), node.name = parseIdentifier(), node.typeParameters = parseTypeParameters(), parseExpected(58), node.type = parseType(), parseSemicolon(), finishNode(node) } function parseEnumMember() { var node = createNodeWithJSDoc(272); return node.name = parsePropertyName(), node.initializer = allowInAnd(parseInitializer), finishNode(node) } function parseEnumDeclaration(node) { return node.kind = 237, parseExpected(83), node.name = parseIdentifier(), parseExpected(17) ? (node.members = parseDelimitedList(6, parseEnumMember), parseExpected(18)) : node.members = createMissingList(), finishNode(node) } function parseModuleBlock() { var node = createNode(239); return parseExpected(17) ? (node.statements = parseList(1, parseStatement), parseExpected(18)) : node.statements = createMissingList(), finishNode(node) } function parseModuleOrNamespaceDeclaration(node, flags) { node.kind = 238; var namespaceFlag = 16 & flags; return node.flags |= flags, node.name = parseIdentifier(), node.body = parseOptional(23) ? parseModuleOrNamespaceDeclaration(createNode(0), 4 | namespaceFlag) : parseModuleBlock(), finishNode(node) } function parseAmbientExternalModuleDeclaration(node) { return node.kind = 238, 143 === token() ? (node.name = parseIdentifier(), node.flags |= 512) : (node.name = parseLiteralNode(), node.name.text = internIdentifier(node.name.text)), 17 === token() ? node.body = parseModuleBlock() : parseSemicolon(), finishNode(node) } function parseModuleDeclaration(node) { var flags = 0; if (143 === token()) return parseAmbientExternalModuleDeclaration(node); if (parseOptional(130)) flags |= 16; else if (parseExpected(129), 9 === token()) return parseAmbientExternalModuleDeclaration(node); return parseModuleOrNamespaceDeclaration(node, flags) } function isExternalModuleReference() { return 133 === token() && lookAhead(nextTokenIsOpenParen) } function nextTokenIsOpenParen() { return 19 === nextToken() } function nextTokenIsSlash() { return 41 === nextToken() } function parseNamespaceExportDeclaration(node) { return node.kind = 241, parseExpected(118), parseExpected(130), node.name = parseIdentifier(), parseSemicolon(), finishNode(node) } function parseImportDeclarationOrImportEqualsDeclaration(node) { parseExpected(91); var identifier, afterImportPos = scanner.getStartPos(); return isIdentifier() && (identifier = parseIdentifier(), 26 !== token() && 142 !== token()) ? parseImportEqualsDeclaration(node, identifier) : (node.kind = 243, (identifier || 39 === token() || 17 === token()) && (node.importClause = parseImportClause(identifier, afterImportPos), parseExpected(142)), node.moduleSpecifier = parseModuleSpecifier(), parseSemicolon(), finishNode(node)) } function parseImportEqualsDeclaration(node, identifier) { return node.kind = 242, node.name = identifier, parseExpected(58), node.moduleReference = parseModuleReference(), parseSemicolon(), finishNode(node) } function parseImportClause(identifier, fullStart) { var importClause = createNode(244, fullStart); return identifier && (importClause.name = identifier), importClause.name && !parseOptional(26) || (importClause.namedBindings = 39 === token() ? parseNamespaceImport() : parseNamedImportsOrExports(246)), finishNode(importClause) } function parseModuleReference() { return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(!1) } function parseExternalModuleReference() { var node = createNode(253); return parseExpected(133), parseExpected(19), node.expression = parseModuleSpecifier(), parseExpected(20), finishNode(node) } function parseModuleSpecifier() { if (9 === token()) { var result = parseLiteralNode(); return result.text = internIdentifier(result.text), result } return parseExpression() } function parseNamespaceImport() { var namespaceImport = createNode(245); return parseExpected(39), parseExpected(118), namespaceImport.name = parseIdentifier(), finishNode(namespaceImport) } function parseNamedImportsOrExports(kind) { var node = createNode(kind); return node.elements = parseBracketedList(22, 246 === kind ? parseImportSpecifier : parseExportSpecifier, 17, 18), finishNode(node) } function parseExportSpecifier() { return parseImportOrExportSpecifier(251) } function parseImportSpecifier() { return parseImportOrExportSpecifier(247) } function parseImportOrExportSpecifier(kind) { var node = createNode(kind), checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier(), checkIdentifierStart = scanner.getTokenPos(), checkIdentifierEnd = scanner.getTextPos(), identifierName = parseIdentifierName(); return 118 === token() ? (node.propertyName = identifierName, parseExpected(118), checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier(), checkIdentifierStart = scanner.getTokenPos(), checkIdentifierEnd = scanner.getTextPos(), node.name = parseIdentifierName()) : node.name = identifierName, 247 === kind && checkIdentifierIsKeyword && parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected), finishNode(node) } function parseExportDeclaration(node) { return node.kind = 249, parseOptional(39) ? (parseExpected(142), node.moduleSpecifier = parseModuleSpecifier()) : (node.exportClause = parseNamedImportsOrExports(250), (142 === token() || 9 === token() && !scanner.hasPrecedingLineBreak()) && (parseExpected(142), node.moduleSpecifier = parseModuleSpecifier())), parseSemicolon(), finishNode(node) } function parseExportAssignment(node) { return node.kind = 248, parseOptional(58) ? node.isExportEquals = !0 : parseExpected(79), node.expression = parseAssignmentExpressionOrHigher(), parseSemicolon(), finishNode(node) } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) || getImportMetaIfNecessary(sourceFile) } function isAnExternalModuleIndicatorNode(node) { return ts.hasModifier(node, 1) || 242 === node.kind && 253 === node.moduleReference.kind || 243 === node.kind || 248 === node.kind || 249 === node.kind ? node : void 0 } function getImportMetaIfNecessary(sourceFile) { return 1048576 & sourceFile.flags ? walkTreeForExternalModuleIndicators(sourceFile) : void 0 } function walkTreeForExternalModuleIndicators(node) { return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators) } function isImportMeta(node) { return ts.isMetaProperty(node) && 91 === node.keywordToken && "meta" === node.name.escapedText } var NodeConstructor, TokenConstructor, IdentifierConstructor, SourceFileConstructor, sourceFile, parseDiagnostics, syntaxCursor, currentToken, sourceText, nodeCount, identifiers, identifierCount, parsingContext, contextFlags, scanner = ts.createScanner(6, !0), disallowInAndDecoratorContext = 10240, parseErrorBeforeNextFinishedNode = !1; Parser.parseSourceFile = parseSourceFile, Parser.parseIsolatedEntityName = parseIsolatedEntityName, Parser.parseJsonText = parseJsonText, Parser.fixupParentReferences = fixupParentReferences; var ParsingContext; !function (ParsingContext) { ParsingContext[ParsingContext.SourceElements = 0] = "SourceElements", ParsingContext[ParsingContext.BlockStatements = 1] = "BlockStatements", ParsingContext[ParsingContext.SwitchClauses = 2] = "SwitchClauses", ParsingContext[ParsingContext.SwitchClauseStatements = 3] = "SwitchClauseStatements", ParsingContext[ParsingContext.TypeMembers = 4] = "TypeMembers", ParsingContext[ParsingContext.ClassMembers = 5] = "ClassMembers", ParsingContext[ParsingContext.EnumMembers = 6] = "EnumMembers", ParsingContext[ParsingContext.HeritageClauseElement = 7] = "HeritageClauseElement", ParsingContext[ParsingContext.VariableDeclarations = 8] = "VariableDeclarations", ParsingContext[ParsingContext.ObjectBindingElements = 9] = "ObjectBindingElements", ParsingContext[ParsingContext.ArrayBindingElements = 10] = "ArrayBindingElements", ParsingContext[ParsingContext.ArgumentExpressions = 11] = "ArgumentExpressions", ParsingContext[ParsingContext.ObjectLiteralMembers = 12] = "ObjectLiteralMembers", ParsingContext[ParsingContext.JsxAttributes = 13] = "JsxAttributes", ParsingContext[ParsingContext.JsxChildren = 14] = "JsxChildren", ParsingContext[ParsingContext.ArrayLiteralMembers = 15] = "ArrayLiteralMembers", ParsingContext[ParsingContext.Parameters = 16] = "Parameters", ParsingContext[ParsingContext.RestProperties = 17] = "RestProperties", ParsingContext[ParsingContext.TypeParameters = 18] = "TypeParameters", ParsingContext[ParsingContext.TypeArguments = 19] = "TypeArguments", ParsingContext[ParsingContext.TupleElementTypes = 20] = "TupleElementTypes", ParsingContext[ParsingContext.HeritageClauses = 21] = "HeritageClauses", ParsingContext[ParsingContext.ImportOrExportSpecifiers = 22] = "ImportOrExportSpecifiers", ParsingContext[ParsingContext.Count = 23] = "Count" }(ParsingContext || (ParsingContext = {})); var Tristate; !function (Tristate) { Tristate[Tristate.False = 0] = "False", Tristate[Tristate.True = 1] = "True", Tristate[Tristate.Unknown = 2] = "Unknown" }(Tristate || (Tristate = {})); var JSDocParser; !function (JSDocParser) { function parseJSDocTypeExpressionForTests(content, start, length) { initializeState(content, 6, void 0, 1), sourceFile = createSourceFile("file.js", 6, 1, !1), scanner.setText(content, start, length), currentToken = scanner.scan(); var jsDocTypeExpression = parseJSDocTypeExpression(), diagnostics = parseDiagnostics; return clearState(), jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : void 0 } function parseJSDocTypeExpression(mayOmitBraces) { var result = createNode(277, scanner.getTokenPos()), hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(17); return result.type = doInsideOfContext(2097152, parseJSDocType), mayOmitBraces && !hasBrace || parseExpected(18), fixupParentReferences(result), finishNode(result) } function parseIsolatedJSDocComment(content, start, length) { initializeState(content, 6, void 0, 1), sourceFile = { languageVariant: 0, text: content }; var jsDoc = parseJSDocCommentWorker(start, length), diagnostics = parseDiagnostics; return clearState(), jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : void 0 } function parseJSDocComment(parent, start, length) { var _a, saveToken = currentToken, saveParseDiagnosticsLength = parseDiagnostics.length, saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode, comment = parseJSDocCommentWorker(start, length); return comment && (comment.parent = parent), 65536 & contextFlags && (sourceFile.jsDocDiagnostics || (sourceFile.jsDocDiagnostics = []), (_a = sourceFile.jsDocDiagnostics).push.apply(_a, parseDiagnostics)), currentToken = saveToken, parseDiagnostics.length = saveParseDiagnosticsLength, parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode, comment } function parseJSDocCommentWorker(start, length) { function removeLeadingNewlines(comments) { for (; comments.length && ("\n" === comments[0] || "\r" === comments[0]);)comments.shift() } function removeTrailingNewlines(comments) { for (; comments.length && ("\n" === comments[comments.length - 1] || "\r" === comments[comments.length - 1]);)comments.pop() } function createJSDocComment() { var result = createNode(285, start); return result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd), result.comment = comments.length ? comments.join("") : void 0, finishNode(result, end) } function isNextNonwhitespaceTokenEndOfFile() { for (; ;) { if (nextJSDocToken(), 1 === token()) return !0; if (5 !== token() && 4 !== token()) return !1 } } function skipWhitespace() { if (5 !== token() && 4 !== token() || !lookAhead(isNextNonwhitespaceTokenEndOfFile)) for (; 5 === token() || 4 === token();)nextJSDocToken() } function parseTag(indent) { ts.Debug.assert(57 === token()); var atToken = createNode(57, scanner.getTokenPos()); atToken.end = scanner.getTextPos(), nextJSDocToken(); var tagName = parseJSDocIdentifierName(); if (skipWhitespace(), tagName) { var tag; if (tagName) switch (tagName.escapedText) { case "augments": case "extends": tag = parseAugmentsTag(atToken, tagName); break; case "class": case "constructor": tag = parseClassTag(atToken, tagName); break; case "arg": case "argument": case "param": return parseParameterOrPropertyTag(atToken, tagName, 2, indent); case "return": case "returns": tag = parseReturnTag(atToken, tagName); break; case "template": tag = parseTemplateTag(atToken, tagName); break; case "type": tag = parseTypeTag(atToken, tagName); break; case "typedef": tag = parseTypedefTag(atToken, tagName, indent); break; case "callback": tag = parseCallbackTag(atToken, tagName, indent); break; default: tag = parseUnknownTag(atToken, tagName) } else tag = parseUnknownTag(atToken, tagName); if (tag) return tag.comment || (tag.comment = parseTagComments(indent + tag.end - tag.pos)), tag } } function parseTagComments(indent) { function pushComment(text) { margin || (margin = indent), comments.push(text), indent += text.length } var margin, comments = [], state = 0, tok = token(); loop: for (; ;) { switch (tok) { case 4: state >= 1 && (state = 0, comments.push(scanner.getTokenText())), indent = 0; break; case 57: scanner.setTextPos(scanner.getTextPos() - 1); case 1: break loop; case 5: if (2 === state) pushComment(scanner.getTokenText()); else { var whitespace = scanner.getTokenText(); void 0 !== margin && indent + whitespace.length > margin && comments.push(whitespace.slice(margin - indent - 1)), indent += whitespace.length } break; case 39: if (0 === state) { state = 1, indent += 1; break } default: state = 2, pushComment(scanner.getTokenText()) }tok = nextJSDocToken() } return removeLeadingNewlines(comments), removeTrailingNewlines(comments), 0 === comments.length ? void 0 : comments.join("") } function parseUnknownTag(atToken, tagName) { var result = createNode(288, atToken.pos); return result.atToken = atToken, result.tagName = tagName, finishNode(result) } function addTag(tag) { tag && (tags ? tags.push(tag) : (tags = [tag], tagsPos = tag.pos), tagsEnd = tag.end) } function tryParseTypeExpression() { return skipWhitespace(), 17 === token() ? parseJSDocTypeExpression() : void 0 } function parseBracketNameInPropertyAndParamTag() { if (13 === token()) return { name: createIdentifier(!0), isBracketed: !1 }; var isBracketed = parseOptional(21), name = parseJSDocEntityName(); return isBracketed && (skipWhitespace(), parseOptionalToken(58) && parseExpression(), parseExpected(22)), { name: name, isBracketed: isBracketed } } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { case 135: return !0; case 166: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && "Object" === node.typeName.escapedText } } function parseParameterOrPropertyTag(atToken, tagName, target, indent) { var typeExpression = tryParseTypeExpression(), isNameFirst = !typeExpression; skipWhitespace(); var _a = parseBracketNameInPropertyAndParamTag(), name = _a.name, isBracketed = _a.isBracketed; skipWhitespace(), isNameFirst && (typeExpression = tryParseTypeExpression()); var comment, result = 1 === target ? createNode(297, atToken.pos) : createNode(292, atToken.pos); void 0 !== indent && (comment = parseTagComments(indent + scanner.getStartPos() - atToken.pos)); var nestedTypeLiteral = 4 !== target && parseNestedTypeLiteral(typeExpression, name, target); return nestedTypeLiteral && (typeExpression = nestedTypeLiteral, isNameFirst = !0), result.atToken = atToken, result.tagName = tagName, result.typeExpression = typeExpression, result.name = name, result.isNameFirst = isNameFirst, result.isBracketed = isBracketed, result.comment = comment, finishNode(result) } function parseNestedTypeLiteral(typeExpression, name, target) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { for (var typeLiteralExpression = createNode(277, scanner.getTokenPos()), child = void 0, jsdocTypeLiteral = void 0, start_2 = scanner.getStartPos(), children = void 0; child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name) });)292 !== child.kind && 297 !== child.kind || (children = ts.append(children, child)); if (children) return jsdocTypeLiteral = createNode(286, start_2), jsdocTypeLiteral.jsDocPropertyTags = children, 166 === typeExpression.type.kind && (jsdocTypeLiteral.isArrayType = !0), typeLiteralExpression.type = finishNode(jsdocTypeLiteral), finishNode(typeLiteralExpression) } } function parseReturnTag(atToken, tagName) { ts.forEach(tags, function (t) { return 293 === t.kind }) && parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); var result = createNode(293, atToken.pos); return result.atToken = atToken, result.tagName = tagName, result.typeExpression = tryParseTypeExpression(), finishNode(result) } function parseTypeTag(atToken, tagName) { ts.forEach(tags, function (t) { return 294 === t.kind }) && parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); var result = createNode(294, atToken.pos); return result.atToken = atToken, result.tagName = tagName, result.typeExpression = parseJSDocTypeExpression(!0), finishNode(result) } function parseAugmentsTag(atToken, tagName) { var result = createNode(289, atToken.pos); return result.atToken = atToken, result.tagName = tagName, result.class = parseExpressionWithTypeArgumentsForAugments(), finishNode(result) } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(17), node = createNode(206); node.expression = parsePropertyAccessEntityNameExpression(), node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); return usedBrace && parseExpected(18), res } function parsePropertyAccessEntityNameExpression() { for (var node = parseJSDocIdentifierName(!0); parseOptional(23);) { var prop = createNode(184, node.pos); prop.expression = node, prop.name = parseJSDocIdentifierName(), node = finishNode(prop) } return node } function parseClassTag(atToken, tagName) { var tag = createNode(290, atToken.pos); return tag.atToken = atToken, tag.tagName = tagName, finishNode(tag) } function parseTypedefTag(atToken, tagName, indent) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); var typedefTag = createNode(296, atToken.pos); typedefTag.atToken = atToken, typedefTag.tagName = tagName, typedefTag.fullName = parseJSDocTypeNameWithNamespace(), typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName), skipWhitespace(), typedefTag.comment = parseTagComments(indent), typedefTag.typeExpression = typeExpression; var end; if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) { for (var child = void 0, jsdocTypeLiteral = void 0, childTypeTag = void 0, start_3 = scanner.getStartPos(); child = tryParse(function () { return parseChildPropertyTag() });)if (jsdocTypeLiteral || (jsdocTypeLiteral = createNode(286, start_3)), 294 === child.kind) { if (childTypeTag) break; childTypeTag = child } else jsdocTypeLiteral.jsDocPropertyTags = ts.append(jsdocTypeLiteral.jsDocPropertyTags, child); jsdocTypeLiteral && (typeExpression && 166 === typeExpression.type.kind && (jsdocTypeLiteral.isArrayType = !0), typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : finishNode(jsdocTypeLiteral), end = typedefTag.typeExpression.end) } return finishNode(typedefTag, end || void 0 !== typedefTag.comment ? scanner.getStartPos() : (typedefTag.fullName || typedefTag.typeExpression || typedefTag.tagName).end) } function parseJSDocTypeNameWithNamespace(nested) { var pos = scanner.getTokenPos(), typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(23)) { var jsDocNamespaceNode = createNode(238, pos); return nested && (jsDocNamespaceNode.flags |= 4), jsDocNamespaceNode.name = typeNameOrNamespaceName, jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(!0), finishNode(jsDocNamespaceNode) } return typeNameOrNamespaceName && nested && (typeNameOrNamespaceName.isInJSDocNamespace = !0), typeNameOrNamespaceName } function parseCallbackTag(atToken, tagName, indent) { var callbackTag = createNode(291, atToken.pos); callbackTag.atToken = atToken, callbackTag.tagName = tagName, callbackTag.fullName = parseJSDocTypeNameWithNamespace(), callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName), skipWhitespace(), callbackTag.comment = parseTagComments(indent); var child, start = scanner.getStartPos(), jsdocSignature = createNode(287, start); for (jsdocSignature.parameters = []; child = tryParse(function () { return parseChildParameterOrPropertyTag(4) });)jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child); var returnTag = tryParse(function () { if (57 === token()) { nextJSDocToken(); var tag = parseTag(indent); if (tag && 293 === tag.kind) return tag } }); return returnTag && (jsdocSignature.type = returnTag), callbackTag.typeExpression = finishNode(jsdocSignature), finishNode(callbackTag) } function getJSDocTypeAliasName(fullName) { if (fullName) for (var rightNode = fullName; ;) { if (ts.isIdentifier(rightNode) || !rightNode.body) return ts.isIdentifier(rightNode) ? rightNode : rightNode.name; rightNode = rightNode.body } } function escapedTextsEqual(a, b) { for (; !ts.isIdentifier(a) || !ts.isIdentifier(b);) { if (ts.isIdentifier(a) || ts.isIdentifier(b) || a.right.escapedText !== b.right.escapedText) return !1; a = a.left, b = b.left } return a.escapedText === b.escapedText } function parseChildPropertyTag() { return parseChildParameterOrPropertyTag(1) } function parseChildParameterOrPropertyTag(target, name) { for (var canParseTag = !0, seenAsterisk = !1; ;)switch (nextJSDocToken()) { case 57: if (canParseTag) { var child = tryParseChildTag(target); return !(child && 292 === child.kind && 4 !== target && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) && child } seenAsterisk = !1; break; case 4: canParseTag = !0, seenAsterisk = !1; break; case 39: seenAsterisk && (canParseTag = !1), seenAsterisk = !0; break; case 71: canParseTag = !1; break; case 1: return !1 } } function tryParseChildTag(target) { ts.Debug.assert(57 === token()); var atToken = createNode(57); atToken.end = scanner.getTextPos(), nextJSDocToken(); var tagName = parseJSDocIdentifierName(); if (skipWhitespace(), !tagName) return !1; var t; switch (tagName.escapedText) { case "type": return 1 === target && parseTypeTag(atToken, tagName); case "prop": case "property": t = 1; break; case "arg": case "argument": case "param": t = 6; break; default: return !1 }if (!(target & t)) return !1; var tag = parseParameterOrPropertyTag(atToken, tagName, target, void 0); return tag.comment = parseTagComments(tag.end - tag.pos), tag } function parseTemplateTag(atToken, tagName) { ts.some(tags, ts.isJSDocTemplateTag) && parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); for (var typeParameters = [], typeParametersPos = getNodePos(); ;) { var typeParameter = createNode(147), name = parseJSDocIdentifierNameWithOptionalBraces(); if (skipWhitespace(), !name) return void parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); if (typeParameter.name = name, finishNode(typeParameter), typeParameters.push(typeParameter), 26 !== token()) break; nextJSDocToken(), skipWhitespace() } var result = createNode(295, atToken.pos); return result.atToken = atToken, result.tagName = tagName, result.typeParameters = createNodeArray(typeParameters, typeParametersPos), finishNode(result), result } function parseJSDocIdentifierNameWithOptionalBraces() { var parsedBrace = parseOptional(17), res = parseJSDocIdentifierName(); return parsedBrace && parseExpected(18), res } function nextJSDocToken() { return currentToken = scanner.scanJSDocToken() } function parseJSDocEntityName() { var entity = parseJSDocIdentifierName(!0); for (parseOptional(21) && parseExpected(22); parseOptional(23);) { var name = parseJSDocIdentifierName(!0); parseOptional(21) && parseExpected(22), entity = createQualifiedName(entity, name) } return entity } function parseJSDocIdentifierName(createIfMissing) { if (void 0 === createIfMissing && (createIfMissing = !1), !ts.tokenIsIdentifierOrKeyword(token())) return createIfMissing ? createMissingNode(71, !0, ts.Diagnostics.Identifier_expected) : void parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected); var pos = scanner.getTokenPos(), end = scanner.getTextPos(), result = createNode(71, pos); return result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText()), finishNode(result, end), nextJSDocToken(), result } var content = sourceText; start = start || 0; var end = void 0 === length ? content.length : start + length; length = end - start, ts.Debug.assert(start >= 0), ts.Debug.assert(start <= end), ts.Debug.assert(end <= content.length); var tags, tagsPos, tagsEnd, result, comments = []; return isJSDocLikeText(content, start) ? (scanner.scanRange(start + 3, length - 5, function () { function pushComment(text) { margin || (margin = indent), comments.push(text), indent += text.length } for (var margin, state = 1, indent = start - Math.max(content.lastIndexOf("\n", start), 0) + 4, t = nextJSDocToken(); 5 === t;)t = nextJSDocToken(); 4 === t && (state = 0, indent = 0, t = nextJSDocToken()); loop: for (; ;) { switch (t) { case 57: 0 === state || 1 === state ? (removeTrailingNewlines(comments), addTag(parseTag(indent)), state = 0, margin = void 0, indent++) : pushComment(scanner.getTokenText()); break; case 4: comments.push(scanner.getTokenText()), state = 0, indent = 0; break; case 39: var asterisk = scanner.getTokenText(); 1 === state || 2 === state ? (state = 2, pushComment(asterisk)) : (state = 1, indent += asterisk.length); break; case 71: pushComment(scanner.getTokenText()), state = 2; break; case 5: var whitespace = scanner.getTokenText(); 2 === state ? comments.push(whitespace) : void 0 !== margin && indent + whitespace.length > margin && comments.push(whitespace.slice(margin - indent - 1)), indent += whitespace.length; break; case 1: break loop; default: state = 2, pushComment(scanner.getTokenText()) }t = nextJSDocToken() } removeLeadingNewlines(comments), removeTrailingNewlines(comments), result = createJSDocComment() }), result) : result } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests, JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression, JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment, JSDocParser.parseJSDocComment = parseJSDocComment; var JSDocState; !function (JSDocState) { JSDocState[JSDocState.BeginningOfLine = 0] = "BeginningOfLine", JSDocState[JSDocState.SawAsterisk = 1] = "SawAsterisk", JSDocState[JSDocState.SavingComments = 2] = "SavingComments" }(JSDocState || (JSDocState = {})); var PropertyLikeParse; !function (PropertyLikeParse) { PropertyLikeParse[PropertyLikeParse.Property = 1] = "Property", PropertyLikeParse[PropertyLikeParse.Parameter = 2] = "Parameter", PropertyLikeParse[PropertyLikeParse.CallbackParameter = 4] = "CallbackParameter" }(PropertyLikeParse || (PropertyLikeParse = {})), JSDocParser.parseJSDocCommentWorker = parseJSDocCommentWorker }(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {})) }(Parser || (Parser = {})); var IncrementalParser; !function (IncrementalParser) { function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { if (aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2), checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks), ts.textChangeRangeIsUnchanged(textChangeRange)) return sourceFile; if (0 === sourceFile.statements.length) return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, void 0, !0, sourceFile.scriptKind); var incrementalSourceFile = sourceFile; ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed), incrementalSourceFile.hasBeenIncrementallyParsed = !0; var oldText = sourceFile.text, syntaxCursor = createSyntaxCursor(sourceFile), changeRange = extendToAffectedRange(sourceFile, textChangeRange); checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks), ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start), ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span)), ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, !0, sourceFile.scriptKind); return result } function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) { function visitNode(node) { var text = ""; if (aggressiveChecks && shouldCheckNode(node) && (text = oldText.substring(node.pos, node.end)), node._children && (node._children = void 0), node.pos += delta, node.end += delta, aggressiveChecks && shouldCheckNode(node) && ts.Debug.assert(text === newText.substring(node.pos, node.end)), forEachChild(node, visitNode, visitArray), ts.hasJSDocNodes(node)) for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; visitNode(jsDocComment) } checkNodePositions(node, aggressiveChecks) } function visitArray(array) { array._children = void 0, array.pos += delta, array.end += delta; for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var node = array_8[_i]; visitNode(node) } } isArray ? visitArray(element) : visitNode(element) } function shouldCheckNode(node) { switch (node.kind) { case 9: case 8: case 71: return !0 }return !1 } function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { ts.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"), ts.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"), ts.Debug.assert(element.pos <= element.end), element.pos = Math.min(element.pos, changeRangeNewEnd), element.end >= changeRangeOldEnd ? element.end += delta : element.end = Math.min(element.end, changeRangeNewEnd), ts.Debug.assert(element.pos <= element.end), element.parent && (ts.Debug.assert(element.pos >= element.parent.pos), ts.Debug.assert(element.end <= element.parent.end)) } function checkNodePositions(node, aggressiveChecks) { if (aggressiveChecks) { var pos_2 = node.pos, visitNode_1 = function (child) { ts.Debug.assert(child.pos >= pos_2), pos_2 = child.end }; if (ts.hasJSDocNodes(node)) for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; visitNode_1(jsDocComment) } forEachChild(node, visitNode_1), ts.Debug.assert(pos_2 <= node.end) } } function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { function visitNode(child) { if (ts.Debug.assert(child.pos <= child.end), child.pos > changeRangeOldEnd) return void moveElementEntirelyPastChangeRange(child, !1, delta, oldText, newText, aggressiveChecks); var fullEnd = child.end; if (fullEnd >= changeStart) { if (child.intersectsChange = !0, child._children = void 0, adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta), forEachChild(child, visitNode, visitArray), ts.hasJSDocNodes(child)) for (var _i = 0, _a = child.jsDoc; _i < _a.length; _i++) { var jsDocComment = _a[_i]; visitNode(jsDocComment) } return void checkNodePositions(child, aggressiveChecks) } ts.Debug.assert(fullEnd < changeStart) } function visitArray(array) { if (ts.Debug.assert(array.pos <= array.end), array.pos > changeRangeOldEnd) return void moveElementEntirelyPastChangeRange(array, !0, delta, oldText, newText, aggressiveChecks); var fullEnd = array.end; if (fullEnd >= changeStart) { array.intersectsChange = !0, array._children = void 0, adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); for (var _i = 0, array_9 = array; _i < array_9.length; _i++) { var node = array_9[_i]; visitNode(node) } } else ts.Debug.assert(fullEnd < changeStart) } visitNode(sourceFile) } function extendToAffectedRange(sourceFile, changeRange) { for (var maxLookahead = 1, start = changeRange.span.start, i = 0; start > 0 && i <= maxLookahead; i++) { var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); ts.Debug.assert(nearestNode.pos <= start); var position = nearestNode.pos; start = Math.max(0, position - 1) } var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span)), finalLength = changeRange.newLength + (changeRange.span.start - start); return ts.createTextChangeRange(finalSpan, finalLength) } function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) { function getLastDescendant(node) { for (; ;) { var lastChild = ts.getLastChild(node); if (!lastChild) return node; node = lastChild } } function visit(child) { if (!ts.nodeIsMissing(child)) return child.pos <= position ? (child.pos >= bestResult.pos && (bestResult = child), position < child.end ? (forEachChild(child, visit), !0) : (ts.Debug.assert(child.end <= position), void (lastNodeEntirelyBeforePosition = child))) : (ts.Debug.assert(child.pos > position), !0) } var lastNodeEntirelyBeforePosition, bestResult = sourceFile; if (forEachChild(sourceFile, visit), lastNodeEntirelyBeforePosition) { var lastChildOfLastEntireNodeBeforePosition = getLastDescendant(lastNodeEntirelyBeforePosition); lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos && (bestResult = lastChildOfLastEntireNodeBeforePosition) } return bestResult } function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) { var oldText = sourceFile.text; if (textChangeRange && (ts.Debug.assert(oldText.length - textChangeRange.span.length + textChangeRange.newLength === newText.length), aggressiveChecks || ts.Debug.shouldAssert(3))) { var oldTextPrefix = oldText.substr(0, textChangeRange.span.start), newTextPrefix = newText.substr(0, textChangeRange.span.start); ts.Debug.assert(oldTextPrefix === newTextPrefix); var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length), newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length); ts.Debug.assert(oldTextSuffix === newTextSuffix) } } function createSyntaxCursor(sourceFile) { function findHighestListElementThatStartsAtPosition(position) { function visitNode(node) { return position >= node.pos && position < node.end && (forEachChild(node, visitNode, visitArray), !0) } function visitArray(array) { if (position >= array.pos && position < array.end) for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) return currentArray = array, currentArrayIndex = i, current = child, !0; if (child.pos < position && position < child.end) return forEachChild(child, visitNode, visitArray), !0 } } return !1 } currentArray = void 0, currentArrayIndex = -1, current = void 0, forEachChild(sourceFile, visitNode, visitArray) } var currentArray = sourceFile.statements, currentArrayIndex = 0; ts.Debug.assert(currentArrayIndex < currentArray.length); var current = currentArray[currentArrayIndex], lastQueriedPosition = -1; return { currentNode: function (position) { return position !== lastQueriedPosition && (current && current.end === position && currentArrayIndex < currentArray.length - 1 && (currentArrayIndex++ , current = currentArray[currentArrayIndex]), current && current.pos === position || findHighestListElementThatStartsAtPosition(position)), lastQueriedPosition = position, ts.Debug.assert(!current || current.pos === position), current } } } IncrementalParser.updateSourceFile = updateSourceFile; var InvalidPosition; !function (InvalidPosition) { InvalidPosition[InvalidPosition.Value = -1] = "Value" }(InvalidPosition || (InvalidPosition = {})) }(IncrementalParser || (IncrementalParser = {})), ts.processCommentPragmas = processCommentPragmas, ts.processPragmasIntoFields = processPragmasIntoFields; var namedArgRegExCache = ts.createMap(), tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im, singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im }(ts || (ts = {})); var ts; !function (ts) { function getModuleInstanceState(node) { return node.body ? getModuleInstanceStateWorker(node.body) : 1 } function getModuleInstanceStateWorker(node) { switch (node.kind) { case 235: case 236: return 0; case 237: if (ts.isConst(node)) return 2; break; case 243: case 242: if (!ts.hasModifier(node, 1)) return 0; break; case 239: var state_1 = 0; return ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateWorker(n); switch (childState) { case 0: return; case 2: return void (state_1 = 2); case 1: return state_1 = 1, !0; default: ts.Debug.assertNever(childState) } }), state_1; case 238: return getModuleInstanceState(node); case 71: if (node.isInJSDocNamespace) return 0 }return 1 } function bindSourceFile(file, options) { ts.performance.mark("beforeBind"), binder(file, options), ts.performance.mark("afterBind"), ts.performance.measure("Bind", "beforeBind", "afterBind") } function createBinder() { function createDiagnosticForNode(node, message, arg0, arg1, arg2) { return ts.createDiagnosticForNodeInSourceFile(ts.getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2) } function bindSourceFile(f, opts) { file = f, options = opts, languageVersion = ts.getEmitScriptTarget(options), inStrictMode = bindInStrictMode(file, opts), classifiableNames = ts.createUnderscoreEscapedMap(), symbolCount = 0, skipTransformFlagAggregation = file.isDeclarationFile, Symbol = ts.objectAllocator.getSymbolConstructor(), file.locals || (bind(file), file.symbolCount = symbolCount, file.classifiableNames = classifiableNames, delayedBindJSDocTypedefTag()), file = void 0, options = void 0, languageVersion = void 0, parent = void 0, container = void 0, thisParentContainer = void 0, blockScopeContainer = void 0, lastContainer = void 0, delayedTypeAliases = void 0, seenThisKeyword = !1, currentFlow = void 0, currentBreakTarget = void 0, currentContinueTarget = void 0, currentReturnTarget = void 0, currentTrueTarget = void 0, currentFalseTarget = void 0, activeLabels = void 0, hasExplicitReturn = !1, emitFlags = 0, subtreeTransformFlags = 0 } function bindInStrictMode(file, opts) { return !(!ts.getStrictOptionValue(opts, "alwaysStrict") || file.isDeclarationFile) || !!file.externalModuleIndicator } function createSymbol(flags, name) { return symbolCount++ , new Symbol(flags, name) } function addDeclarationToSymbol(symbol, node, symbolFlags) { if (symbol.flags |= symbolFlags, node.symbol = symbol, symbol.declarations = ts.append(symbol.declarations, node), 1952 & symbolFlags && !symbol.exports && (symbol.exports = ts.createSymbolTable()), 6240 & symbolFlags && !symbol.members && (symbol.members = ts.createSymbolTable()), 67216319 & symbolFlags) { var valueDeclaration = symbol.valueDeclaration; (!valueDeclaration || valueDeclaration.kind !== node.kind && 238 === valueDeclaration.kind) && (symbol.valueDeclaration = node) } } function getDeclarationName(node) { if (248 === node.kind) return node.isExportEquals ? "export=" : "default"; var name = ts.getNameOfDeclaration(node); if (name) { if (ts.isAmbientModule(node)) { var moduleName = ts.getTextOfIdentifierOrLiteral(name); return ts.isGlobalScopeAugmentation(node) ? "__global" : '"' + moduleName + '"' } if (146 === name.kind) { var nameExpression = name.expression; return ts.isStringOrNumericLiteral(nameExpression) ? ts.escapeLeadingUnderscores(nameExpression.text) : (ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)), ts.getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name))) } return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : void 0 } switch (node.kind) { case 154: return "__constructor"; case 162: case 157: case 287: return "__call"; case 163: case 158: return "__new"; case 159: return "__index"; case 249: return "__export"; case 273: return "export="; case 199: if (2 === ts.getSpecialPropertyAssignmentKind(node)) return "export="; ts.Debug.fail("Unknown binary declaration kind"); break; case 283: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; case 148: ts.Debug.assert(283 === node.parent.kind, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType" }); var functionType = node.parent, index = functionType.parameters.indexOf(node); return "arg" + index } } function getDisplayName(node) { return ts.isNamedDeclaration(node) ? ts.declarationNameToString(node.name) : ts.unescapeLeadingUnderscores(getDeclarationName(node)) } function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod) { ts.Debug.assert(!ts.hasDynamicName(node)); var symbol, isDefaultExport = ts.hasModifier(node, 512), name = isDefaultExport && parent ? "default" : getDeclarationName(node); if (void 0 === name) symbol = createSymbol(0, "__missing"); else if (symbol = symbolTable.get(name), 2885600 & includes && classifiableNames.set(name, !0), symbol) { if (isReplaceableByMethod && !symbol.isReplaceableByMethod) return symbol; if (symbol.flags & excludes) if (symbol.isReplaceableByMethod) symbolTable.set(name, symbol = createSymbol(0, name)); else { ts.isNamedDeclaration(node) && (node.name.parent = node); var message_1 = 2 & symbol.flags ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; (384 & symbol.flags || 384 & includes) && (message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations), symbol.declarations && symbol.declarations.length && (isDefaultExport ? message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports : symbol.declarations && symbol.declarations.length && 248 === node.kind && !node.isExportEquals && (message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports)), ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(declaration) || declaration, message_1, getDisplayName(declaration))) }), file.bindDiagnostics.push(createDiagnosticForNode(ts.getNameOfDeclaration(node) || node, message_1, getDisplayName(node))), symbol = createSymbol(0, name) } } else symbolTable.set(name, symbol = createSymbol(0, name)), isReplaceableByMethod && (symbol.isReplaceableByMethod = !0); return addDeclarationToSymbol(symbol, node, includes), symbol.parent ? ts.Debug.assert(symbol.parent === parent, "Existing symbol parent should match new one") : symbol.parent = parent, symbol } function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = 1 & ts.getCombinedModifierFlags(node); if (2097152 & symbolFlags) return 251 === node.kind || 242 === node.kind && hasExportModifier ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.locals, void 0, node, symbolFlags, symbolExcludes); if (ts.isJSDocTypeAlias(node) && ts.Debug.assert(ts.isInJavaScriptFile(node)), !ts.isAmbientModule(node) && (hasExportModifier || 32 & container.flags) || ts.isJSDocTypeAlias(node)) { if (ts.hasModifier(node, 512) && !getDeclarationName(node)) return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); var exportKind = 67216319 & symbolFlags ? 1048576 : 0, local = declareSymbol(container.locals, void 0, node, exportKind, symbolExcludes); return local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes), node.localSymbol = local, local } return declareSymbol(container.locals, void 0, node, symbolFlags, symbolExcludes) } function bindContainer(node, containerFlags) { var saveContainer = container, saveThisParentContainer = thisParentContainer, savedBlockScopeContainer = blockScopeContainer; if (1 & containerFlags ? (192 !== node.kind && (thisParentContainer = container), container = blockScopeContainer = node, 32 & containerFlags && (container.locals = ts.createSymbolTable()), addToContainerChain(container)) : 2 & containerFlags && (blockScopeContainer = node, blockScopeContainer.locals = void 0), 4 & containerFlags) { var saveCurrentFlow = currentFlow, saveBreakTarget = currentBreakTarget, saveContinueTarget = currentContinueTarget, saveReturnTarget = currentReturnTarget, saveActiveLabels = activeLabels, saveHasExplicitReturn = hasExplicitReturn, isIIFE = 16 & containerFlags && !ts.hasModifier(node, 256) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node); isIIFE || (currentFlow = { flags: 2 }, 144 & containerFlags && (currentFlow.container = node)), currentReturnTarget = isIIFE || 154 === node.kind ? createBranchLabel() : void 0, currentBreakTarget = void 0, currentContinueTarget = void 0, activeLabels = void 0, hasExplicitReturn = !1, bindChildren(node), node.flags &= -1409, !(1 & currentFlow.flags) && 8 & containerFlags && ts.nodeIsPresent(node.body) && (node.flags |= 128, hasExplicitReturn && (node.flags |= 256)), 273 === node.kind && (node.flags |= emitFlags), currentReturnTarget && (addAntecedent(currentReturnTarget, currentFlow), currentFlow = finishFlowLabel(currentReturnTarget), 154 === node.kind && (node.returnFlowNode = currentFlow)), isIIFE || (currentFlow = saveCurrentFlow), currentBreakTarget = saveBreakTarget, currentContinueTarget = saveContinueTarget, currentReturnTarget = saveReturnTarget, activeLabels = saveActiveLabels, hasExplicitReturn = saveHasExplicitReturn } else 64 & containerFlags ? (seenThisKeyword = !1, bindChildren(node), node.flags = seenThisKeyword ? 64 | node.flags : node.flags & -65) : bindChildren(node); container = saveContainer, thisParentContainer = saveThisParentContainer, blockScopeContainer = savedBlockScopeContainer } function bindChildren(node) { if (skipTransformFlagAggregation) bindChildrenWorker(node); else if (536870912 & node.transformFlags) skipTransformFlagAggregation = !0, bindChildrenWorker(node), skipTransformFlagAggregation = !1, subtreeTransformFlags |= node.transformFlags & ~getTransformFlagsSubtreeExclusions(node.kind); else { var savedSubtreeTransformFlags = subtreeTransformFlags; subtreeTransformFlags = 0, bindChildrenWorker(node), subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags) } } function bindEachFunctionsFirst(nodes) { bindEach(nodes, function (n) { return 233 === n.kind ? bind(n) : void 0 }), bindEach(nodes, function (n) { return 233 !== n.kind ? bind(n) : void 0 }) } function bindEach(nodes, bindFunction) { if (void 0 === bindFunction && (bindFunction = bind), void 0 !== nodes) if (skipTransformFlagAggregation) ts.forEach(nodes, bindFunction); else { var savedSubtreeTransformFlags = subtreeTransformFlags; subtreeTransformFlags = 0; for (var nodeArrayFlags = 0, _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { var node = nodes_2[_i]; bindFunction(node), nodeArrayFlags |= node.transformFlags & -536870913 } nodes.transformFlags = 536870912 | nodeArrayFlags, subtreeTransformFlags |= savedSubtreeTransformFlags } } function bindEachChild(node) { ts.forEachChild(node, bind, bindEach) } function bindChildrenWorker(node) { if (checkUnreachable(node)) return void bindEachChild(node); switch (node.kind) { case 218: bindWhileStatement(node); break; case 217: bindDoStatement(node); break; case 219: bindForStatement(node); break; case 220: case 221: bindForInOrForOfStatement(node); break; case 216: bindIfStatement(node); break; case 224: case 228: bindReturnOrThrow(node); break; case 223: case 222: bindBreakOrContinueStatement(node); break; case 229: bindTryStatement(node); break; case 226: bindSwitchStatement(node); break; case 240: bindCaseBlock(node); break; case 265: bindCaseClause(node); break; case 227: bindLabeledStatement(node); break; case 197: bindPrefixUnaryExpressionFlow(node); break; case 198: bindPostfixUnaryExpressionFlow(node); break; case 199: bindBinaryExpressionFlow(node); break; case 193: bindDeleteExpressionFlow(node); break; case 200: bindConditionalExpressionFlow(node); break; case 231: bindVariableDeclarationFlow(node); break; case 186: bindCallExpressionFlow(node); break; case 296: case 291: bindJSDocTypeAlias(node); break; case 273: bindEachFunctionsFirst(node.statements), bind(node.endOfFileToken); break; case 212: case 239: bindEachFunctionsFirst(node.statements); break; default: bindEachChild(node) }bindJSDoc(node) } function isNarrowingExpression(expr) { switch (expr.kind) { case 71: case 99: case 184: return isNarrowableReference(expr); case 186: return hasNarrowableArgument(expr); case 190: return isNarrowingExpression(expr.expression); case 199: return isNarrowingBinaryExpression(expr); case 197: return 51 === expr.operator && isNarrowingExpression(expr.operand) }return !1 } function isNarrowableReference(expr) { return 71 === expr.kind || 99 === expr.kind || 97 === expr.kind || 184 === expr.kind && isNarrowableReference(expr.expression) } function hasNarrowableArgument(expr) { if (expr.arguments) for (var _i = 0, _a = expr.arguments; _i < _a.length; _i++) { var argument = _a[_i]; if (isNarrowableReference(argument)) return !0 } return !(184 !== expr.expression.kind || !isNarrowableReference(expr.expression.expression)) } function isNarrowingTypeofOperands(expr1, expr2) { return ts.isTypeOfExpression(expr1) && isNarrowableOperand(expr1.expression) && ts.isStringLiteralLike(expr2) } function isNarrowableInOperands(left, right) { return ts.isStringLiteralLike(left) && isNarrowingExpression(right) } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { case 58: return isNarrowableReference(expr.left); case 32: case 33: case 34: case 35: return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right); case 93: return isNarrowableOperand(expr.left); case 92: return isNarrowableInOperands(expr.left, expr.right); case 26: return isNarrowingExpression(expr.right) }return !1 } function isNarrowableOperand(expr) { switch (expr.kind) { case 190: return isNarrowableOperand(expr.expression); case 199: switch (expr.operatorToken.kind) { case 58: return isNarrowableOperand(expr.left); case 26: return isNarrowableOperand(expr.right) } }return isNarrowableReference(expr) } function createBranchLabel() { return { flags: 4, antecedents: void 0 } } function createLoopLabel() { return { flags: 8, antecedents: void 0 } } function setFlowNodeReferenced(flow) { flow.flags |= 512 & flow.flags ? 1024 : 512 } function addAntecedent(label, antecedent) { 1 & antecedent.flags || ts.contains(label.antecedents, antecedent) || ((label.antecedents || (label.antecedents = [])).push(antecedent), setFlowNodeReferenced(antecedent)) } function createFlowCondition(flags, antecedent, expression) { return 1 & antecedent.flags ? antecedent : expression ? 101 === expression.kind && 64 & flags || 86 === expression.kind && 32 & flags ? unreachableFlow : isNarrowingExpression(expression) ? (setFlowNodeReferenced(antecedent), { flags: flags, expression: expression, antecedent: antecedent }) : antecedent : 32 & flags ? antecedent : unreachableFlow } function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) { return isNarrowingExpression(switchStatement.expression) ? (setFlowNodeReferenced(antecedent), { flags: 128, switchStatement: switchStatement, clauseStart: clauseStart, clauseEnd: clauseEnd, antecedent: antecedent }) : antecedent } function createFlowAssignment(antecedent, node) { return setFlowNodeReferenced(antecedent), { flags: 16, antecedent: antecedent, node: node } } function createFlowArrayMutation(antecedent, node) { setFlowNodeReferenced(antecedent); var res = { flags: 256, antecedent: antecedent, node: node }; return res } function finishFlowLabel(flow) { var antecedents = flow.antecedents; return antecedents ? 1 === antecedents.length ? antecedents[0] : flow : unreachableFlow } function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { case 216: case 218: case 217: return parent.expression === node; case 219: case 200: return parent.condition === node }return !1 } function isLogicalExpression(node) { for (; ;)if (190 === node.kind) node = node.expression; else { if (197 !== node.kind || 51 !== node.operator) return 199 === node.kind && (53 === node.operatorToken.kind || 54 === node.operatorToken.kind); node = node.operand } } function isTopLevelLogicalExpression(node) { for (; 190 === node.parent.kind || 197 === node.parent.kind && 51 === node.parent.operator;)node = node.parent; return !isStatementCondition(node) && !isLogicalExpression(node.parent) } function bindCondition(node, trueTarget, falseTarget) { var saveTrueTarget = currentTrueTarget, saveFalseTarget = currentFalseTarget; currentTrueTarget = trueTarget, currentFalseTarget = falseTarget, bind(node), currentTrueTarget = saveTrueTarget, currentFalseTarget = saveFalseTarget, node && isLogicalExpression(node) || (addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)), addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node))) } function bindIterativeStatement(node, breakTarget, continueTarget) { var saveBreakTarget = currentBreakTarget, saveContinueTarget = currentContinueTarget; currentBreakTarget = breakTarget, currentContinueTarget = continueTarget, bind(node), currentBreakTarget = saveBreakTarget, currentContinueTarget = saveContinueTarget } function bindWhileStatement(node) { var preWhileLabel = createLoopLabel(), preBodyLabel = createBranchLabel(), postWhileLabel = createBranchLabel(); addAntecedent(preWhileLabel, currentFlow), currentFlow = preWhileLabel, bindCondition(node.expression, preBodyLabel, postWhileLabel), currentFlow = finishFlowLabel(preBodyLabel), bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel), addAntecedent(preWhileLabel, currentFlow), currentFlow = finishFlowLabel(postWhileLabel) } function bindDoStatement(node) { var preDoLabel = createLoopLabel(), enclosingLabeledStatement = 227 === node.parent.kind ? ts.lastOrUndefined(activeLabels) : void 0, preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(), postDoLabel = enclosingLabeledStatement ? enclosingLabeledStatement.breakTarget : createBranchLabel(); addAntecedent(preDoLabel, currentFlow), currentFlow = preDoLabel, bindIterativeStatement(node.statement, postDoLabel, preConditionLabel), addAntecedent(preConditionLabel, currentFlow), currentFlow = finishFlowLabel(preConditionLabel), bindCondition(node.expression, preDoLabel, postDoLabel), currentFlow = finishFlowLabel(postDoLabel) } function bindForStatement(node) { var preLoopLabel = createLoopLabel(), preBodyLabel = createBranchLabel(), postLoopLabel = createBranchLabel(); bind(node.initializer), addAntecedent(preLoopLabel, currentFlow), currentFlow = preLoopLabel, bindCondition(node.condition, preBodyLabel, postLoopLabel), currentFlow = finishFlowLabel(preBodyLabel), bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel), bind(node.incrementor), addAntecedent(preLoopLabel, currentFlow), currentFlow = finishFlowLabel(postLoopLabel) } function bindForInOrForOfStatement(node) { var preLoopLabel = createLoopLabel(), postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow), currentFlow = preLoopLabel, 221 === node.kind && bind(node.awaitModifier), bind(node.expression), addAntecedent(postLoopLabel, currentFlow), bind(node.initializer), 232 !== node.initializer.kind && bindAssignmentTargetFlow(node.initializer), bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel), addAntecedent(preLoopLabel, currentFlow), currentFlow = finishFlowLabel(postLoopLabel) } function bindIfStatement(node) { var thenLabel = createBranchLabel(), elseLabel = createBranchLabel(), postIfLabel = createBranchLabel(); bindCondition(node.expression, thenLabel, elseLabel), currentFlow = finishFlowLabel(thenLabel), bind(node.thenStatement), addAntecedent(postIfLabel, currentFlow), currentFlow = finishFlowLabel(elseLabel), bind(node.elseStatement), addAntecedent(postIfLabel, currentFlow), currentFlow = finishFlowLabel(postIfLabel) } function bindReturnOrThrow(node) { bind(node.expression), 224 === node.kind && (hasExplicitReturn = !0, currentReturnTarget && addAntecedent(currentReturnTarget, currentFlow)), currentFlow = unreachableFlow } function findActiveLabel(name) { if (activeLabels) for (var _i = 0, activeLabels_1 = activeLabels; _i < activeLabels_1.length; _i++) { var label = activeLabels_1[_i]; if (label.name === name) return label } } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { var flowLabel = 223 === node.kind ? breakTarget : continueTarget; flowLabel && (addAntecedent(flowLabel, currentFlow), currentFlow = unreachableFlow) } function bindBreakOrContinueStatement(node) { if (bind(node.label), node.label) { var activeLabel = findActiveLabel(node.label.escapedText); activeLabel && (activeLabel.referenced = !0, bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget)) } else bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget) } function bindTryStatement(node) { var preFinallyLabel = createBranchLabel(), preTryFlow = currentFlow; bind(node.tryBlock), addAntecedent(preFinallyLabel, currentFlow); var flowAfterTry = currentFlow, flowAfterCatch = unreachableFlow; if (node.catchClause && (currentFlow = preTryFlow, bind(node.catchClause), addAntecedent(preFinallyLabel, currentFlow), flowAfterCatch = currentFlow), node.finallyBlock) { var preFinallyFlow = { flags: 2048, antecedent: preTryFlow, lock: {} }; if (addAntecedent(preFinallyLabel, preFinallyFlow), currentFlow = finishFlowLabel(preFinallyLabel), bind(node.finallyBlock), 1 & currentFlow.flags || 1 & flowAfterTry.flags && 1 & flowAfterCatch.flags && (currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow ? reportedUnreachableFlow : unreachableFlow), !(1 & currentFlow.flags)) { var afterFinallyFlow = { flags: 4096, antecedent: currentFlow }; preFinallyFlow.lock = afterFinallyFlow, currentFlow = afterFinallyFlow } } else currentFlow = finishFlowLabel(preFinallyLabel) } function bindSwitchStatement(node) { var postSwitchLabel = createBranchLabel(); bind(node.expression); var saveBreakTarget = currentBreakTarget, savePreSwitchCaseFlow = preSwitchCaseFlow; currentBreakTarget = postSwitchLabel, preSwitchCaseFlow = currentFlow, bind(node.caseBlock), addAntecedent(postSwitchLabel, currentFlow); var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return 266 === c.kind }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents, hasDefault || addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)), currentBreakTarget = saveBreakTarget, preSwitchCaseFlow = savePreSwitchCaseFlow, currentFlow = finishFlowLabel(postSwitchLabel) } function bindCaseBlock(node) { var savedSubtreeTransformFlags = subtreeTransformFlags; subtreeTransformFlags = 0; for (var clauses = node.clauses, fallthroughFlow = unreachableFlow, i = 0; i < clauses.length; i++) { for (var clauseStart = i; !clauses[i].statements.length && i + 1 < clauses.length;)bind(clauses[i]), i++; var preCaseLabel = createBranchLabel(); addAntecedent(preCaseLabel, createFlowSwitchClause(preSwitchCaseFlow, node.parent, clauseStart, i + 1)), addAntecedent(preCaseLabel, fallthroughFlow), currentFlow = finishFlowLabel(preCaseLabel); var clause = clauses[i]; bind(clause), fallthroughFlow = currentFlow, 1 & currentFlow.flags || i === clauses.length - 1 || !options.noFallthroughCasesInSwitch || errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch) } clauses.transformFlags = 536870912 | subtreeTransformFlags, subtreeTransformFlags |= savedSubtreeTransformFlags } function bindCaseClause(node) { var saveCurrentFlow = currentFlow; currentFlow = preSwitchCaseFlow, bind(node.expression), currentFlow = saveCurrentFlow, bindEach(node.statements) } function pushActiveLabel(name, breakTarget, continueTarget) { var activeLabel = { name: name, breakTarget: breakTarget, continueTarget: continueTarget, referenced: !1 }; return (activeLabels || (activeLabels = [])).push(activeLabel), activeLabel } function popActiveLabel() { activeLabels.pop() } function bindLabeledStatement(node) { var preStatementLabel = createLoopLabel(), postStatementLabel = createBranchLabel(); bind(node.label), addAntecedent(preStatementLabel, currentFlow); var activeLabel = pushActiveLabel(node.label.escapedText, postStatementLabel, preStatementLabel); bind(node.statement), popActiveLabel(), activeLabel.referenced || options.allowUnusedLabels || errorOrSuggestionOnFirstToken(ts.unusedLabelIsError(options), node, ts.Diagnostics.Unused_label), node.statement && 217 === node.statement.kind || (addAntecedent(postStatementLabel, currentFlow), currentFlow = finishFlowLabel(postStatementLabel)) } function bindDestructuringTargetFlow(node) { bindAssignmentTargetFlow(199 === node.kind && 58 === node.operatorToken.kind ? node.left : node) } function bindAssignmentTargetFlow(node) { if (isNarrowableReference(node)) currentFlow = createFlowAssignment(currentFlow, node); else if (182 === node.kind) for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; 203 === e.kind ? bindAssignmentTargetFlow(e.expression) : bindDestructuringTargetFlow(e) } else if (183 === node.kind) for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; 269 === p.kind ? bindDestructuringTargetFlow(p.initializer) : 270 === p.kind ? bindAssignmentTargetFlow(p.name) : 271 === p.kind && bindAssignmentTargetFlow(p.expression) } } function bindLogicalExpression(node, trueTarget, falseTarget) { var preRightLabel = createBranchLabel(); 53 === node.operatorToken.kind ? bindCondition(node.left, preRightLabel, falseTarget) : bindCondition(node.left, trueTarget, preRightLabel), currentFlow = finishFlowLabel(preRightLabel), bind(node.operatorToken), bindCondition(node.right, trueTarget, falseTarget) } function bindPrefixUnaryExpressionFlow(node) { if (51 === node.operator) { var saveTrueTarget = currentTrueTarget; currentTrueTarget = currentFalseTarget, currentFalseTarget = saveTrueTarget, bindEachChild(node), currentFalseTarget = currentTrueTarget, currentTrueTarget = saveTrueTarget } else bindEachChild(node), 43 !== node.operator && 44 !== node.operator || bindAssignmentTargetFlow(node.operand) } function bindPostfixUnaryExpressionFlow(node) { bindEachChild(node), 43 !== node.operator && 44 !== node.operator || bindAssignmentTargetFlow(node.operand) } function bindBinaryExpressionFlow(node) { var operator = node.operatorToken.kind; if (53 === operator || 54 === operator) if (isTopLevelLogicalExpression(node)) { var postExpressionLabel = createBranchLabel(); bindLogicalExpression(node, postExpressionLabel, postExpressionLabel), currentFlow = finishFlowLabel(postExpressionLabel) } else bindLogicalExpression(node, currentTrueTarget, currentFalseTarget); else if (bindEachChild(node), ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node) && (bindAssignmentTargetFlow(node.left), 58 === operator && 185 === node.left.kind)) { var elementAccess = node.left; isNarrowableOperand(elementAccess.expression) && (currentFlow = createFlowArrayMutation(currentFlow, node)) } } function bindDeleteExpressionFlow(node) { bindEachChild(node), 184 === node.expression.kind && bindAssignmentTargetFlow(node.expression) } function bindConditionalExpressionFlow(node) { var trueLabel = createBranchLabel(), falseLabel = createBranchLabel(), postExpressionLabel = createBranchLabel(); bindCondition(node.condition, trueLabel, falseLabel), currentFlow = finishFlowLabel(trueLabel), bind(node.questionToken), bind(node.whenTrue), addAntecedent(postExpressionLabel, currentFlow), currentFlow = finishFlowLabel(falseLabel), bind(node.colonToken), bind(node.whenFalse), addAntecedent(postExpressionLabel, currentFlow), currentFlow = finishFlowLabel(postExpressionLabel) } function bindInitializedVariableFlow(node) { var name = ts.isOmittedExpression(node) ? void 0 : node.name; if (ts.isBindingPattern(name)) for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { var child = _a[_i]; bindInitializedVariableFlow(child) } else currentFlow = createFlowAssignment(currentFlow, node) } function bindVariableDeclarationFlow(node) { bindEachChild(node), (node.initializer || ts.isForInOrOfStatement(node.parent.parent)) && bindInitializedVariableFlow(node) } function bindJSDocTypeAlias(node) { node.fullName && setParentPointers(node, node.fullName) } function bindCallExpressionFlow(node) { for (var expr = node.expression; 190 === expr.kind;)expr = expr.expression; if (191 === expr.kind || 192 === expr.kind ? (bindEach(node.typeArguments), bindEach(node.arguments), bind(node.expression)) : bindEachChild(node), 184 === node.expression.kind) { var propertyAccess = node.expression; isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name) && (currentFlow = createFlowArrayMutation(currentFlow, node)) } } function getContainerFlags(node) { switch (node.kind) { case 204: case 234: case 237: case 183: case 165: case 286: case 262: return 1; case 235: return 65; case 238: case 236: case 176: return 33; case 273: return 37; case 153: if (ts.isObjectLiteralOrClassExpressionMethod(node)) return 173; case 154: case 233: case 152: case 155: case 156: case 157: case 287: case 283: case 162: case 158: case 159: case 163: return 45; case 191: case 192: return 61; case 239: return 4; case 151: return node.initializer ? 4 : 0; case 268: case 219: case 220: case 221: case 240: return 2; case 212: return ts.isFunctionLike(node.parent) ? 0 : 2 }return 0 } function addToContainerChain(next) { lastContainer && (lastContainer.nextContainer = next), lastContainer = next } function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { switch (container.kind) { case 238: return declareModuleMember(node, symbolFlags, symbolExcludes); case 273: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 204: case 234: return declareClassMember(node, symbolFlags, symbolExcludes); case 237: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 165: case 286: case 183: case 235: case 262: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 162: case 163: case 157: case 158: case 287: case 159: case 153: case 152: case 154: case 155: case 156: case 233: case 191: case 192: case 283: case 296: case 291: case 236: case 176: return declareSymbol(container.locals, void 0, node, symbolFlags, symbolExcludes) } } function declareClassMember(node, symbolFlags, symbolExcludes) { return ts.hasModifier(node, 32) ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes) } function declareSourceFileMember(node, symbolFlags, symbolExcludes) { return ts.isExternalModule(file) ? declareModuleMember(node, symbolFlags, symbolExcludes) : declareSymbol(file.locals, void 0, node, symbolFlags, symbolExcludes) } function hasExportDeclarations(node) { var body = 273 === node.kind ? node : node.body; if (body && (273 === body.kind || 239 === body.kind)) for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; if (249 === stat.kind || 248 === stat.kind) return !0 } return !1 } function setExportContextFlag(node) { 4194304 & node.flags && !hasExportDeclarations(node) ? node.flags |= 32 : node.flags &= -33 } function bindModuleDeclaration(node) { if (setExportContextFlag(node), ts.isAmbientModule(node)) if (ts.hasModifier(node, 1) && errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible), ts.isModuleAugmentationExternal(node)) declareModuleSymbol(node); else { var pattern = void 0; if (9 === node.name.kind) { var text = node.name.text; ts.hasZeroOrOneAsteriskCharacter(text) ? pattern = ts.tryParsePattern(text) : errorOnFirstToken(node.name, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, text) } var symbol = declareSymbolAndAddToSymbolTable(node, 512, 67215503); file.patternAmbientModules = ts.append(file.patternAmbientModules, pattern && { pattern: pattern, symbol: symbol }) } else { var state = declareModuleSymbol(node); if (0 !== state) { var symbol = node.symbol; symbol.constEnumOnlyModule = !(304 & symbol.flags) && 2 === state && symbol.constEnumOnlyModule !== !1 } } } function declareModuleSymbol(node) { var state = getModuleInstanceState(node), instantiated = 0 !== state; return declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 67215503 : 0), state } function bindFunctionOrConstructorType(node) { var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048), typeLiteralSymbol.members = ts.createSymbolTable(), typeLiteralSymbol.members.set(symbol.escapedName, symbol) } function bindObjectLiteralExpression(node) { var ElementKind; if (function (ElementKind) { ElementKind[ElementKind.Property = 1] = "Property", ElementKind[ElementKind.Accessor = 2] = "Accessor" }(ElementKind || (ElementKind = {})), inStrictMode) for (var seen = ts.createUnderscoreEscapedMap(), _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; if (271 !== prop.kind && 71 === prop.name.kind) { var identifier = prop.name, currentKind = 269 === prop.kind || 270 === prop.kind || 153 === prop.kind ? 1 : 2, existingKind = seen.get(identifier.escapedText); if (existingKind) { if (1 === currentKind && 1 === existingKind) { var span = ts.getErrorSpanForNode(file, identifier); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)) } } else seen.set(identifier.escapedText, currentKind) } } return bindAnonymousDeclaration(node, 4096, "__object") } function bindJsxAttributes(node) { return bindAnonymousDeclaration(node, 4096, "__jsxAttributes") } function bindJsxAttribute(node, symbolFlags, symbolExcludes) { return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) } function bindAnonymousDeclaration(node, symbolFlags, name) { var symbol = createSymbol(symbolFlags, name); 106508 & symbolFlags && (symbol.parent = container.symbol), addDeclarationToSymbol(symbol, node, symbolFlags) } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { case 238: declareModuleMember(node, symbolFlags, symbolExcludes); break; case 273: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break } default: blockScopeContainer.locals || (blockScopeContainer.locals = ts.createSymbolTable(), addToContainerChain(blockScopeContainer)), declareSymbol(blockScopeContainer.locals, void 0, node, symbolFlags, symbolExcludes) } } function bindBlockScopedVariableDeclaration(node) { bindBlockScopedDeclaration(node, 2, 67216319) } function delayedBindJSDocTypedefTag() { if (delayedTypeAliases) { for (var saveContainer = container, saveLastContainer = lastContainer, saveBlockScopeContainer = blockScopeContainer, saveParent = parent, saveCurrentFlow = currentFlow, _i = 0, delayedTypeAliases_1 = delayedTypeAliases; _i < delayedTypeAliases_1.length; _i++) { var typeAlias = delayedTypeAliases_1[_i], host = ts.getJSDocHost(typeAlias); container = ts.findAncestor(host.parent, function (n) { return !!(1 & getContainerFlags(n)) }) || file, blockScopeContainer = ts.getEnclosingBlockScopeContainer(host) || file, currentFlow = { flags: 2 }, parent = typeAlias, bind(typeAlias.typeExpression), typeAlias.fullName && 71 !== typeAlias.fullName.kind ? bind(typeAlias.fullName) : (parent = typeAlias.parent, bindBlockScopedDeclaration(typeAlias, 524288, 67901928)) } container = saveContainer, lastContainer = saveLastContainer, blockScopeContainer = saveBlockScopeContainer, parent = saveParent, currentFlow = saveCurrentFlow } } function checkStrictModeIdentifier(node) { !(inStrictMode && node.originalKeywordKind >= 108 && node.originalKeywordKind <= 116) || ts.isIdentifierName(node) || 4194304 & node.flags || file.parseDiagnostics.length || file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))) } function getStrictModeIdentifierMessage(node) { return ts.getContainingClass(node) ? ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode : file.externalModuleIndicator ? ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode : ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode } function checkStrictModeBinaryExpression(node) { inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind) && checkStrictModeEvalOrArguments(node, node.left) } function checkStrictModeCatchClause(node) { inStrictMode && node.variableDeclaration && checkStrictModeEvalOrArguments(node, node.variableDeclaration.name) } function checkStrictModeDeleteExpression(node) { if (inStrictMode && 71 === node.expression.kind) { var span = ts.getErrorSpanForNode(file, node.expression); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)) } } function isEvalOrArgumentsIdentifier(node) { return ts.isIdentifier(node) && ("eval" === node.escapedText || "arguments" === node.escapedText) } function checkStrictModeEvalOrArguments(contextNode, name) { if (name && 71 === name.kind) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { var span = ts.getErrorSpanForNode(file, name); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), ts.idText(identifier))) } } } function getStrictModeEvalOrArgumentsMessage(node) { return ts.getContainingClass(node) ? ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode : file.externalModuleIndicator ? ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode : ts.Diagnostics.Invalid_use_of_0_in_strict_mode } function checkStrictModeFunctionName(node) { inStrictMode && checkStrictModeEvalOrArguments(node, node.name) } function getStrictModeBlockScopeFunctionDeclarationMessage(node) { return ts.getContainingClass(node) ? ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode : file.externalModuleIndicator ? ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode : ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5 } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 && 273 !== blockScopeContainer.kind && 238 !== blockScopeContainer.kind && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))) } } function checkStrictModeNumericLiteral(node) { inStrictMode && 32 & node.numericLiteralFlags && file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)) } function checkStrictModePostfixUnaryExpression(node) { inStrictMode && checkStrictModeEvalOrArguments(node, node.operand) } function checkStrictModePrefixUnaryExpression(node) { inStrictMode && (43 !== node.operator && 44 !== node.operator || checkStrictModeEvalOrArguments(node, node.operand)) } function checkStrictModeWithStatement(node) { inStrictMode && errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode) } function errorOnFirstToken(node, message, arg0, arg1, arg2) { var span = ts.getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)) } function errorOrSuggestionOnFirstToken(isError, node, message, arg0, arg1, arg2) { var span = ts.getSpanOfTokenAtPosition(file, node.pos), diag = ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2); isError ? file.bindDiagnostics.push(diag) : file.bindSuggestionDiagnostics = ts.append(file.bindSuggestionDiagnostics, __assign({}, diag, { category: ts.DiagnosticCategory.Suggestion })) } function bind(node) { if (node) { node.parent = parent; var saveInStrictMode = inStrictMode; if (bindWorker(node), node.kind > 144) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); 0 === containerFlags ? bindChildren(node) : bindContainer(node, containerFlags), parent = saveParent } else skipTransformFlagAggregation || 0 !== (536870912 & node.transformFlags) || (subtreeTransformFlags |= computeTransformFlagsForNode(node, 0), bindJSDoc(node)); inStrictMode = saveInStrictMode } } function bindJSDoc(node) { if (ts.hasJSDocNodes(node)) if (ts.isInJavaScriptFile(node)) for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var j = _a[_i]; bind(j) } else for (var _b = 0, _c = node.jsDoc; _b < _c.length; _b++) { var j = _c[_b]; setParentPointers(node, j) } } function updateStrictModeStatementList(statements) { if (!inStrictMode) for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { var statement = statements_1[_i]; if (!ts.isPrologueDirective(statement)) return; if (isUseStrictPrologueDirective(statement)) return void (inStrictMode = !0) } } function isUseStrictPrologueDirective(node) { var nodeText = ts.getSourceTextOfNodeFromSourceFile(file, node.expression); return '"use strict"' === nodeText || "'use strict'" === nodeText } function bindWorker(node) { switch (node.kind) { case 71: if (node.isInJSDocNamespace) { for (var parentNode = node.parent; parentNode && !ts.isJSDocTypeAlias(parentNode);)parentNode = parentNode.parent; bindBlockScopedDeclaration(parentNode, 524288, 67901928); break } case 99: return currentFlow && (ts.isExpression(node) || 270 === parent.kind) && (node.flowNode = currentFlow), checkStrictModeIdentifier(node); case 184: currentFlow && isNarrowableReference(node) && (node.flowNode = currentFlow), ts.isSpecialPropertyDeclaration(node) && bindSpecialPropertyDeclaration(node); break; case 199: var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { case 1: bindExportsPropertyAssignment(node); break; case 2: bindModuleExportsAssignment(node); break; case 3: bindPrototypePropertyAssignment(node.left, node); break; case 6: bindPrototypeAssignment(node); break; case 4: bindThisPropertyAssignment(node); break; case 5: bindSpecialPropertyAssignment(node); break; case 0: break; default: ts.Debug.fail("Unknown special property assignment kind") }return checkStrictModeBinaryExpression(node); case 268: return checkStrictModeCatchClause(node); case 193: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); case 198: return checkStrictModePostfixUnaryExpression(node); case 197: return checkStrictModePrefixUnaryExpression(node); case 225: return checkStrictModeWithStatement(node); case 173: return void (seenThisKeyword = !0); case 160: break; case 147: return bindTypeParameter(node); case 148: return bindParameter(node); case 231: return bindVariableDeclarationOrBindingElement(node); case 181: return node.flowNode = currentFlow, bindVariableDeclarationOrBindingElement(node); case 151: case 150: return bindPropertyWorker(node); case 269: case 270: return bindPropertyOrMethodOrAccessor(node, 4, 0); case 272: return bindPropertyOrMethodOrAccessor(node, 8, 68008959); case 157: case 158: case 159: return declareSymbolAndAddToSymbolTable(node, 131072, 0); case 153: case 152: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 67208127); case 233: return bindFunctionDeclaration(node); case 154: return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 155: return bindPropertyOrMethodOrAccessor(node, 32768, 67150783); case 156: return bindPropertyOrMethodOrAccessor(node, 65536, 67183551); case 162: case 283: case 287: case 163: return bindFunctionOrConstructorType(node); case 165: case 286: case 176: return bindAnonymousTypeWorker(node); case 183: return bindObjectLiteralExpression(node); case 191: case 192: return bindFunctionExpression(node); case 186: ts.isInJavaScriptFile(node) && bindCallExpression(node); break; case 204: case 234: return inStrictMode = !0, bindClassLikeDeclaration(node); case 235: return bindBlockScopedDeclaration(node, 64, 67901832); case 236: return bindBlockScopedDeclaration(node, 524288, 67901928); case 237: return bindEnumDeclaration(node); case 238: return bindModuleDeclaration(node); case 262: return bindJsxAttributes(node); case 261: return bindJsxAttribute(node, 4, 0); case 242: case 245: case 247: case 251: return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); case 241: return bindNamespaceExportDeclaration(node); case 244: return bindImportClause(node); case 249: return bindExportDeclaration(node); case 248: return bindExportAssignment(node); case 273: return updateStrictModeStatementList(node.statements), bindSourceFileIfExternalModule(); case 212: if (!ts.isFunctionLike(node.parent)) return; case 239: return updateStrictModeStatementList(node.statements); case 292: if (287 === node.parent.kind) return bindParameter(node); if (286 !== node.parent.kind) break; case 297: var propTag = node, flags = propTag.isBracketed || propTag.typeExpression && 282 === propTag.typeExpression.type.kind ? 16777220 : 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); case 296: case 291: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node) } } function bindPropertyWorker(node) { return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 16777216 : 0), 0) } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048, "__type") } function bindSourceFileIfExternalModule() { if (setExportContextFlag(file), ts.isExternalModule(file)) bindSourceFileAsExternalModule(); else if (ts.isJsonSourceFile(file)) { bindSourceFileAsExternalModule(); var originalSymbol = file.symbol; declareSymbol(file.symbol.exports, file.symbol, file, 4, 67108863), file.symbol = originalSymbol } } function bindSourceFileAsExternalModule() { bindAnonymousDeclaration(file, 512, '"' + ts.removeFileExtension(file.fileName) + '"') } function bindExportAssignment(node) { if (container.symbol && container.symbol.exports) { var flags = 248 === node.kind && ts.exportAssignmentIsAlias(node) ? 2097152 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863) } else bindAnonymousDeclaration(node, 2097152, getDeclarationName(node)) } function bindNamespaceExportDeclaration(node) { if (node.modifiers && node.modifiers.length && file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)), 273 !== node.parent.kind) return void file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); var parent_1 = node.parent; return ts.isExternalModule(parent_1) ? parent_1.isDeclarationFile ? (file.symbol.globalExports = file.symbol.globalExports || ts.createSymbolTable(), void declareSymbol(file.symbol.globalExports, file.symbol, node, 2097152, 2097152)) : void file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)) : void file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)) } function bindExportDeclaration(node) { container.symbol && container.symbol.exports ? node.exportClause || declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 0) : bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)) } function bindImportClause(node) { node.name && declareSymbolAndAddToSymbolTable(node, 2097152, 2097152) } function setCommonJsModuleIndicator(node) { file.commonJsModuleIndicator || (file.commonJsModuleIndicator = node, file.externalModuleIndicator || bindSourceFileAsExternalModule()) } function bindExportsPropertyAssignment(node) { setCommonJsModuleIndicator(node); var lhs = node.left, symbol = forEachIdentifierInEntityName(lhs.expression, function (id, original) { if (original) { var s = ts.getJSInitializerSymbol(original); return addDeclarationToSymbol(s, id, 67110400), s } }); if (symbol) { var flags = ts.isClassExpression(node.right) ? 1048612 : 1048580; declareSymbol(symbol.exports, symbol, lhs, flags, 0) } } function bindModuleExportsAssignment(node) { var assignedExpression = ts.getRightMostAssignedExpression(node.right); if (ts.isEmptyObjectLiteral(assignedExpression) || container === file && isExportsOrModuleExportsOrAlias(file, assignedExpression)) return void setCommonJsModuleIndicator(node); setCommonJsModuleIndicator(node); var flags = ts.exportAssignmentIsAlias(node) ? 2097152 : 1049092; declareSymbol(file.symbol.exports, file.symbol, node, flags, 0) } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); var thisContainer = ts.getThisContainer(node, !1); switch (thisContainer.kind) { case 233: case 191: var constructorSymbol = thisContainer.symbol; if (ts.isBinaryExpression(thisContainer.parent) && 58 === thisContainer.parent.operatorToken.kind) { var l = thisContainer.parent.left; ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression) && (constructorSymbol = getJSInitializerSymbolFromName(l.expression.expression, thisParentContainer)) } constructorSymbol && (constructorSymbol.members = constructorSymbol.members || ts.createSymbolTable(), declareSymbol(constructorSymbol.members, constructorSymbol, node, 4, 0)); break; case 154: case 151: case 153: case 155: case 156: var containingClass = thisContainer.parent, symbolTable = ts.hasModifier(thisContainer, 32) ? containingClass.symbol.exports : containingClass.symbol.members; declareSymbol(symbolTable, containingClass.symbol, node, 4, 0, !0); break; case 273: break; default: ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer)) } } function bindSpecialPropertyDeclaration(node) { 99 === node.expression.kind ? bindThisPropertyAssignment(node) : ts.isPropertyAccessEntityNameExpression(node) && 273 === node.parent.parent.kind && (ts.isPrototypeAccess(node.expression) ? bindPrototypePropertyAssignment(node, node.parent) : bindStaticPropertyAssignment(node)) } function bindPrototypeAssignment(node) { node.left.parent = node, node.right.parent = node; var lhs = node.left; bindPropertyAssignment(lhs, lhs, !1) } function bindPrototypePropertyAssignment(lhs, parent) { var classPrototype = lhs.expression, constructorFunction = classPrototype.expression; lhs.parent = parent, constructorFunction.parent = classPrototype, classPrototype.parent = lhs, bindPropertyAssignment(constructorFunction, lhs, !0) } function bindSpecialPropertyAssignment(node) { var lhs = node.left; node.left.parent = node, node.right.parent = node, ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression) ? bindExportsPropertyAssignment(node) : bindStaticPropertyAssignment(lhs) } function bindStaticPropertyAssignment(node) { node.expression.parent = node, bindPropertyAssignment(node.expression, node, !1) } function getJSInitializerSymbolFromName(name, lookupContainer) { return ts.getJSInitializerSymbol(lookupSymbolForPropertyAccess(name, lookupContainer)) } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) { var symbol = getJSInitializerSymbolFromName(name), isToplevelNamespaceableInitializer = ts.isBinaryExpression(propertyAccess.parent) ? 273 === getParentOfBinaryExpression(propertyAccess.parent).parent.kind && !!ts.getJavascriptInitializer(ts.getInitializerOfBinaryExpression(propertyAccess.parent), ts.isPrototypeAccess(propertyAccess.parent.left)) : 273 === propertyAccess.parent.parent.kind; if (!isPrototypeProperty && (!symbol || !(1920 & symbol.flags)) && isToplevelNamespaceableInitializer) { var flags_1 = 67110400, excludeFlags_1 = 106639; forEachIdentifierInEntityName(propertyAccess.expression, function (id, original) { return original ? (addDeclarationToSymbol(original, id, flags_1), original) : symbol = declareSymbol(symbol ? symbol.exports : container.locals, symbol, id, flags_1, excludeFlags_1) }) } if (symbol && 5168 & symbol.flags) { var symbolTable = isPrototypeProperty ? symbol.members || (symbol.members = ts.createSymbolTable()) : symbol.exports || (symbol.exports = ts.createSymbolTable()), jsContainerFlag = isToplevelNamespaceableInitializer ? 67108864 : 0, isMethod = ts.isFunctionLikeDeclaration(ts.getAssignedJavascriptInitializer(propertyAccess)), symbolFlags = (isMethod ? 8192 : 4) | jsContainerFlag, symbolExcludes = (isMethod ? 67208127 : 0) & ~jsContainerFlag; declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes) } } function getParentOfBinaryExpression(expr) { for (; ts.isBinaryExpression(expr.parent);)expr = expr.parent; return expr.parent } function lookupSymbolForPropertyAccess(node, lookupContainer) { if (void 0 === lookupContainer && (lookupContainer = container), ts.isIdentifier(node)) return lookupSymbolForNameWorker(lookupContainer, node.escapedText); var symbol = ts.getJSInitializerSymbol(lookupSymbolForPropertyAccess(node.expression)); return symbol && symbol.exports && symbol.exports.get(node.name.escapedText) } function forEachIdentifierInEntityName(e, action) { if (isExportsOrModuleExportsOrAlias(file, e)) return file.symbol; if (ts.isIdentifier(e)) return action(e, lookupSymbolForPropertyAccess(e)); var s = ts.getJSInitializerSymbol(forEachIdentifierInEntityName(e.expression, action)); return ts.Debug.assert(!!s && !!s.exports), action(e.name, s.exports.get(e.name.escapedText)) } function bindCallExpression(node) { !file.commonJsModuleIndicator && ts.isRequireCall(node, !1) && setCommonJsModuleIndicator(node) } function bindClassLikeDeclaration(node) { if (234 === node.kind) bindBlockScopedDeclaration(node, 32, 68008383); else { var bindingName = node.name ? node.name.escapedText : "__class"; bindAnonymousDeclaration(node, 32, bindingName), node.name && classifiableNames.set(node.name.escapedText, !0) } var symbol = node.symbol, prototypeSymbol = createSymbol(4194308, "prototype"), symbolExport = symbol.exports.get(prototypeSymbol.escapedName); symbolExport && (node.name && (node.name.parent = node), file.bindDiagnostics.push(createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(prototypeSymbol)))), symbol.exports.set(prototypeSymbol.escapedName, prototypeSymbol), prototypeSymbol.parent = symbol } function bindEnumDeclaration(node) { return ts.isConst(node) ? bindBlockScopedDeclaration(node, 128, 68008831) : bindBlockScopedDeclaration(node, 256, 68008191) } function bindVariableDeclarationOrBindingElement(node) { inStrictMode && checkStrictModeEvalOrArguments(node, node.name), ts.isBindingPattern(node.name) || (ts.isBlockOrCatchScoped(node) ? bindBlockScopedVariableDeclaration(node) : ts.isParameterDeclaration(node) ? declareSymbolAndAddToSymbolTable(node, 1, 67216319) : declareSymbolAndAddToSymbolTable(node, 1, 67216318)) } function bindParameter(node) { if ((292 !== node.kind || 287 === container.kind) && (!inStrictMode || 4194304 & node.flags || checkStrictModeEvalOrArguments(node, node.name), ts.isBindingPattern(node.name) ? bindAnonymousDeclaration(node, 1, "__" + node.parent.parameters.indexOf(node)) : declareSymbolAndAddToSymbolTable(node, 1, 67216319), ts.isParameterPropertyDeclaration(node))) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 16777216 : 0), 0) } } function bindFunctionDeclaration(node) { file.isDeclarationFile || 4194304 & node.flags || ts.isAsyncFunction(node) && (emitFlags |= 1024), checkStrictModeFunctionName(node), inStrictMode ? (checkStrictModeFunctionDeclaration(node), bindBlockScopedDeclaration(node, 16, 67215791)) : declareSymbolAndAddToSymbolTable(node, 16, 67215791) } function bindFunctionExpression(node) { file.isDeclarationFile || 4194304 & node.flags || ts.isAsyncFunction(node) && (emitFlags |= 1024), currentFlow && (node.flowNode = currentFlow), checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.escapedText : "__function"; return bindAnonymousDeclaration(node, 16, bindingName) } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { return file.isDeclarationFile || 4194304 & node.flags || !ts.isAsyncFunction(node) || (emitFlags |= 1024), currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node) && (node.flowNode = currentFlow), ts.hasDynamicName(node) ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) } function getInferTypeContainer(node) { var extendsType = ts.findAncestor(node, function (n) { return n.parent && ts.isConditionalTypeNode(n.parent) && n.parent.extendsType === n }); return extendsType && extendsType.parent } function bindTypeParameter(node) { if (ts.isJSDocTemplateTag(node.parent)) { var container_1 = ts.find(node.parent.parent.tags, ts.isJSDocTypeAlias) || ts.getHostSignatureFromJSDoc(node.parent); container_1 ? (container_1.locals || (container_1.locals = ts.createSymbolTable()), declareSymbol(container_1.locals, void 0, node, 262144, 67639784)) : declareSymbolAndAddToSymbolTable(node, 262144, 67639784) } else if (171 === node.parent.kind) { var container_2 = getInferTypeContainer(node.parent); container_2 ? (container_2.locals || (container_2.locals = ts.createSymbolTable()), declareSymbol(container_2.locals, void 0, node, 262144, 67639784)) : bindAnonymousDeclaration(node, 262144, getDeclarationName(node)) } else declareSymbolAndAddToSymbolTable(node, 262144, 67639784) } function shouldReportErrorOnModuleDeclaration(node) { var instanceState = getModuleInstanceState(node); return 1 === instanceState || 2 === instanceState && options.preserveConstEnums } function checkUnreachable(node) { if (!(1 & currentFlow.flags)) return !1; if (currentFlow === unreachableFlow) { var reportError = ts.isStatementButNotDeclaration(node) && 214 !== node.kind || 234 === node.kind || 238 === node.kind && shouldReportErrorOnModuleDeclaration(node) || 237 === node.kind && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums); if (reportError && (currentFlow = reportedUnreachableFlow, !options.allowUnreachableCode)) { var isError = ts.unreachableCodeIsError(options) && !(4194304 & node.flags) && (!ts.isVariableStatement(node) || !!(3 & ts.getCombinedNodeFlags(node.declarationList)) || node.declarationList.declarations.some(function (d) { return !!d.initializer })); errorOrSuggestionOnFirstToken(isError, node, ts.Diagnostics.Unreachable_code_detected) } } return !0 } var file, options, languageVersion, parent, container, thisParentContainer, blockScopeContainer, lastContainer, delayedTypeAliases, seenThisKeyword, currentFlow, currentBreakTarget, currentContinueTarget, currentReturnTarget, currentTrueTarget, currentFalseTarget, preSwitchCaseFlow, activeLabels, hasExplicitReturn, emitFlags, inStrictMode, Symbol, classifiableNames, skipTransformFlagAggregation, symbolCount = 0, unreachableFlow = { flags: 1 }, reportedUnreachableFlow = { flags: 1 }, subtreeTransformFlags = 0; return bindSourceFile } function isExportsOrModuleExportsOrAlias(sourceFile, node) { return ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node) || ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) } function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) { var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText); return symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer) } function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) { return isExportsOrModuleExportsOrAlias(sourceFile, node) || ts.isAssignmentExpression(node, !0) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)) } function lookupSymbolForNameWorker(container, name) { var local = container.locals && container.locals.get(name); return local ? local.exportSymbol || local : container.symbol && container.symbol.exports && container.symbol.exports.get(name) } function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { case 186: return computeCallExpression(node, subtreeFlags); case 187: return computeNewExpression(node, subtreeFlags); case 238: return computeModuleDeclaration(node, subtreeFlags); case 190: return computeParenthesizedExpression(node, subtreeFlags); case 199: return computeBinaryExpression(node, subtreeFlags); case 215: return computeExpressionStatement(node, subtreeFlags); case 148: return computeParameter(node, subtreeFlags); case 192: return computeArrowFunction(node, subtreeFlags); case 191: return computeFunctionExpression(node, subtreeFlags); case 233: return computeFunctionDeclaration(node, subtreeFlags); case 231: return computeVariableDeclaration(node, subtreeFlags); case 232: return computeVariableDeclarationList(node, subtreeFlags); case 213: return computeVariableStatement(node, subtreeFlags); case 227: return computeLabeledStatement(node, subtreeFlags); case 234: return computeClassDeclaration(node, subtreeFlags); case 204: return computeClassExpression(node, subtreeFlags); case 267: return computeHeritageClause(node, subtreeFlags); case 268: return computeCatchClause(node, subtreeFlags); case 206: return computeExpressionWithTypeArguments(node, subtreeFlags); case 154: return computeConstructor(node, subtreeFlags); case 151: return computePropertyDeclaration(node, subtreeFlags); case 153: return computeMethod(node, subtreeFlags); case 155: case 156: return computeAccessor(node, subtreeFlags); case 242: return computeImportEquals(node, subtreeFlags); case 184: return computePropertyAccess(node, subtreeFlags); case 185: return computeElementAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags) } } function computeCallExpression(node, subtreeFlags) { var transformFlags = subtreeFlags, expression = node.expression; return node.typeArguments && (transformFlags |= 3), (524288 & subtreeFlags || 402653184 & expression.transformFlags) && (transformFlags |= 192, 268435456 & expression.transformFlags && (transformFlags |= 16384)), 91 === expression.kind && (transformFlags |= 67108864, 16384 & subtreeFlags && (transformFlags |= 32768)), node.transformFlags = 536870912 | transformFlags, transformFlags & -940049730 } function computeNewExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; return node.typeArguments && (transformFlags |= 3), 524288 & subtreeFlags && (transformFlags |= 192), node.transformFlags = 536870912 | transformFlags, transformFlags & -940049730 } function computeBinaryExpression(node, subtreeFlags) { var transformFlags = subtreeFlags, operatorTokenKind = node.operatorToken.kind, leftKind = node.left.kind; return 58 === operatorTokenKind && 183 === leftKind ? transformFlags |= 3272 : 58 === operatorTokenKind && 182 === leftKind ? transformFlags |= 3264 : 40 !== operatorTokenKind && 62 !== operatorTokenKind || (transformFlags |= 32), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeParameter(node, subtreeFlags) { var transformFlags = subtreeFlags, name = node.name, initializer = node.initializer, dotDotDotToken = node.dotDotDotToken; return (node.questionToken || node.type || 4096 & subtreeFlags || ts.isThisIdentifier(name)) && (transformFlags |= 3), ts.hasModifier(node, 92) && (transformFlags |= 262147), 1048576 & subtreeFlags && (transformFlags |= 8), (8388608 & subtreeFlags || initializer || dotDotDotToken) && (transformFlags |= 131264), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeParenthesizedExpression(node, subtreeFlags) { var transformFlags = subtreeFlags, expression = node.expression, expressionKind = expression.kind, expressionTransformFlags = expression.transformFlags; return 207 !== expressionKind && 189 !== expressionKind || (transformFlags |= 3), 1024 & expressionTransformFlags && (transformFlags |= 1024), node.transformFlags = 536870912 | transformFlags, transformFlags & -536872258 } function computeClassDeclaration(node, subtreeFlags) { var transformFlags; return ts.hasModifier(node, 2) ? transformFlags = 3 : (transformFlags = 192 | subtreeFlags, (274432 & subtreeFlags || node.typeParameters) && (transformFlags |= 3), 65536 & subtreeFlags && (transformFlags |= 16384)), node.transformFlags = 536870912 | transformFlags, transformFlags & -942011714 } function computeClassExpression(node, subtreeFlags) { var transformFlags = 192 | subtreeFlags; return (274432 & subtreeFlags || node.typeParameters) && (transformFlags |= 3), 65536 & subtreeFlags && (transformFlags |= 16384), node.transformFlags = 536870912 | transformFlags, transformFlags & -942011714 } function computeHeritageClause(node, subtreeFlags) { var transformFlags = subtreeFlags; switch (node.token) { case 85: transformFlags |= 192; break; case 108: transformFlags |= 3; break; default: ts.Debug.fail("Unexpected token for heritage clause") }return node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeCatchClause(node, subtreeFlags) { var transformFlags = subtreeFlags; return node.variableDeclaration ? ts.isBindingPattern(node.variableDeclaration.name) && (transformFlags |= 192) : transformFlags |= 8, node.transformFlags = 536870912 | transformFlags, transformFlags & -940574018 } function computeExpressionWithTypeArguments(node, subtreeFlags) { var transformFlags = 192 | subtreeFlags; return node.typeArguments && (transformFlags |= 3), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeConstructor(node, subtreeFlags) { var transformFlags = subtreeFlags; return !ts.hasModifier(node, 2270) && node.body || (transformFlags |= 3), 1048576 & subtreeFlags && (transformFlags |= 8), node.transformFlags = 536870912 | transformFlags, transformFlags & -1003668802 } function computeMethod(node, subtreeFlags) { var transformFlags = 192 | subtreeFlags; return (node.decorators || ts.hasModifier(node, 2270) || node.typeParameters || node.type || node.name && ts.isComputedPropertyName(node.name) || !node.body) && (transformFlags |= 3), 1048576 & subtreeFlags && (transformFlags |= 8), ts.hasModifier(node, 256) && (transformFlags |= node.asteriskToken ? 8 : 16), node.asteriskToken && (transformFlags |= 768), node.transformFlags = 536870912 | transformFlags, transformFlags & -1003668802 } function computeAccessor(node, subtreeFlags) { var transformFlags = subtreeFlags; return (node.decorators || ts.hasModifier(node, 2270) || node.type || node.name && ts.isComputedPropertyName(node.name) || !node.body) && (transformFlags |= 3), 1048576 & subtreeFlags && (transformFlags |= 8), node.transformFlags = 536870912 | transformFlags, transformFlags & -1003668802 } function computePropertyDeclaration(node, subtreeFlags) { var transformFlags = 3 | subtreeFlags; return (node.initializer || ts.isComputedPropertyName(node.name)) && (transformFlags |= 8192), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeFunctionDeclaration(node, subtreeFlags) { var transformFlags, modifierFlags = ts.getModifierFlags(node), body = node.body; return !body || 2 & modifierFlags ? transformFlags = 3 : (transformFlags = 33554432 | subtreeFlags, (2270 & modifierFlags || node.typeParameters || node.type) && (transformFlags |= 3), 256 & modifierFlags && (transformFlags |= node.asteriskToken ? 8 : 16), 1048576 & subtreeFlags && (transformFlags |= 8), 163840 & subtreeFlags && (transformFlags |= 192), node.asteriskToken && (transformFlags |= 768)), node.transformFlags = 536870912 | transformFlags, transformFlags & -1003935042 } function computeFunctionExpression(node, subtreeFlags) { var transformFlags = subtreeFlags; return (ts.hasModifier(node, 2270) || node.typeParameters || node.type) && (transformFlags |= 3), ts.hasModifier(node, 256) && (transformFlags |= node.asteriskToken ? 8 : 16), 1048576 & subtreeFlags && (transformFlags |= 8), 163840 & subtreeFlags && (transformFlags |= 192), node.asteriskToken && (transformFlags |= 768), node.transformFlags = 536870912 | transformFlags, transformFlags & -1003935042 } function computeArrowFunction(node, subtreeFlags) { var transformFlags = 192 | subtreeFlags; return (ts.hasModifier(node, 2270) || node.typeParameters || node.type) && (transformFlags |= 3), ts.hasModifier(node, 256) && (transformFlags |= 16), 1048576 & subtreeFlags && (transformFlags |= 8), 16384 & subtreeFlags && (transformFlags |= 32768), node.transformFlags = 536870912 | transformFlags, transformFlags & -1003902274 } function computePropertyAccess(node, subtreeFlags) { var transformFlags = subtreeFlags; return 134217728 & transformFlags && (transformFlags ^= 134217728, transformFlags |= 268435456), node.transformFlags = 536870912 | transformFlags, transformFlags & -671089986 } function computeElementAccess(node, subtreeFlags) { var transformFlags = subtreeFlags, expression = node.expression, expressionFlags = expression.transformFlags; return 134217728 & expressionFlags && (transformFlags &= -134217729, transformFlags |= 268435456), node.transformFlags = 536870912 | transformFlags, transformFlags & -671089986 } function computeVariableDeclaration(node, subtreeFlags) { var transformFlags = subtreeFlags; return transformFlags |= 8388800, 1048576 & subtreeFlags && (transformFlags |= 8), node.type && (transformFlags |= 3), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeVariableStatement(node, subtreeFlags) { var transformFlags, declarationListTransformFlags = node.declarationList.transformFlags; return ts.hasModifier(node, 2) ? transformFlags = 3 : (transformFlags = subtreeFlags, 8388608 & declarationListTransformFlags && (transformFlags |= 192)), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeLabeledStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; return 4194304 & subtreeFlags && ts.isIterationStatement(node, !0) && (transformFlags |= 192), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeImportEquals(node, subtreeFlags) { var transformFlags = subtreeFlags; return ts.isExternalModuleImportEqualsDeclaration(node) || (transformFlags |= 3), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeExpressionStatement(node, subtreeFlags) { var transformFlags = subtreeFlags; return 1024 & node.expression.transformFlags && (transformFlags |= 192), node.transformFlags = 536870912 | transformFlags, transformFlags & -939525442 } function computeModuleDeclaration(node, subtreeFlags) { var transformFlags = 3, modifierFlags = ts.getModifierFlags(node); return 0 === (2 & modifierFlags) && (transformFlags |= subtreeFlags), node.transformFlags = 536870912 | transformFlags, transformFlags & -977327426 } function computeVariableDeclarationList(node, subtreeFlags) { var transformFlags = 33554432 | subtreeFlags; return 8388608 & subtreeFlags && (transformFlags |= 192), 3 & node.flags && (transformFlags |= 4194496), node.transformFlags = 536870912 | transformFlags, transformFlags & -948962626 } function computeOther(node, kind, subtreeFlags) { var transformFlags = subtreeFlags, excludeFlags = 939525441; switch (kind) { case 120: case 196: transformFlags |= 24; break; case 189: case 207: case 300: transformFlags |= 3, excludeFlags = 536872257; break; case 114: case 112: case 113: case 117: case 124: case 76: case 237: case 272: case 208: case 132: transformFlags |= 3; break; case 254: case 255: case 256: case 10: case 257: case 258: case 259: case 260: case 261: case 262: case 263: case 264: transformFlags |= 4; break; case 13: case 14: case 15: case 16: case 201: case 188: case 270: case 115: case 209: transformFlags |= 192; break; case 9: node.hasExtendedUnicodeEscape && (transformFlags |= 192); break; case 8: 384 & node.numericLiteralFlags && (transformFlags |= 192); break; case 221: node.awaitModifier && (transformFlags |= 8), transformFlags |= 192; break; case 202: transformFlags |= 16777416; break; case 119: case 134: case 131: case 135: case 137: case 122: case 138: case 105: case 147: case 150: case 152: case 157: case 158: case 159: case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: case 169: case 170: case 171: case 172: case 235: case 236: case 173: case 174: case 175: case 176: case 177: case 241: transformFlags = 3, excludeFlags = -3; break; case 146: transformFlags |= 2097152, 16384 & subtreeFlags && (transformFlags |= 65536); break; case 203: transformFlags |= 524480; break; case 271: transformFlags |= 1048584; break; case 97: transformFlags |= 134217920, excludeFlags = 536872257; break; case 99: transformFlags |= 16384; break; case 179: transformFlags |= 8388800, 524288 & subtreeFlags && (transformFlags |= 1048584), excludeFlags = 940049729; break; case 180: transformFlags |= 8388800, excludeFlags = 940049729; break; case 181: transformFlags |= 192, node.dotDotDotToken && (transformFlags |= 524288); break; case 149: transformFlags |= 4099; break; case 183: excludeFlags = 942740801, 2097152 & subtreeFlags && (transformFlags |= 192), 65536 & subtreeFlags && (transformFlags |= 16384), 1048576 & subtreeFlags && (transformFlags |= 8); break; case 182: case 187: excludeFlags = 940049729, 524288 & subtreeFlags && (transformFlags |= 192); break; case 217: case 218: case 219: case 220: 4194304 & subtreeFlags && (transformFlags |= 192); break; case 273: 32768 & subtreeFlags && (transformFlags |= 192); break; case 224: transformFlags |= 33554440; break; case 222: case 223: transformFlags |= 33554432 }return node.transformFlags = 536870912 | transformFlags, transformFlags & ~excludeFlags } function getTransformFlagsSubtreeExclusions(kind) { if (kind >= 160 && kind <= 178) return -3; switch (kind) { case 186: case 187: case 182: return 940049729; case 238: return 977327425; case 148: return 939525441; case 192: return 1003902273; case 191: case 233: return 1003935041; case 232: return 948962625; case 234: case 204: return 942011713; case 154: return 1003668801; case 153: case 155: case 156: return 1003668801; case 119: case 134: case 131: case 137: case 135: case 122: case 138: case 105: case 147: case 150: case 152: case 157: case 158: case 159: case 235: case 236: return -3; case 183: return 942740801; case 268: return 940574017; case 179: case 180: return 940049729; case 189: case 207: case 300: case 190: case 97: return 536872257; case 184: case 185: return 671089985; default: return 939525441 } } function setParentPointers(parent, child) { child.parent = parent, ts.forEachChild(child, function (grandchild) { return setParentPointers(child, grandchild) }) } var ModuleInstanceState; !function (ModuleInstanceState) { ModuleInstanceState[ModuleInstanceState.NonInstantiated = 0] = "NonInstantiated", ModuleInstanceState[ModuleInstanceState.Instantiated = 1] = "Instantiated", ModuleInstanceState[ModuleInstanceState.ConstEnumOnly = 2] = "ConstEnumOnly" }(ModuleInstanceState = ts.ModuleInstanceState || (ts.ModuleInstanceState = {})), ts.getModuleInstanceState = getModuleInstanceState; var ContainerFlags; !function (ContainerFlags) { ContainerFlags[ContainerFlags.None = 0] = "None", ContainerFlags[ContainerFlags.IsContainer = 1] = "IsContainer", ContainerFlags[ContainerFlags.IsBlockScopedContainer = 2] = "IsBlockScopedContainer", ContainerFlags[ContainerFlags.IsControlFlowContainer = 4] = "IsControlFlowContainer", ContainerFlags[ContainerFlags.IsFunctionLike = 8] = "IsFunctionLike", ContainerFlags[ContainerFlags.IsFunctionExpression = 16] = "IsFunctionExpression", ContainerFlags[ContainerFlags.HasLocals = 32] = "HasLocals", ContainerFlags[ContainerFlags.IsInterface = 64] = "IsInterface", ContainerFlags[ContainerFlags.IsObjectLiteralOrClassExpressionMethod = 128] = "IsObjectLiteralOrClassExpressionMethod" }(ContainerFlags || (ContainerFlags = {})); var binder = createBinder(); ts.bindSourceFile = bindSourceFile, ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias, ts.computeTransformFlagsForNode = computeTransformFlagsForNode, ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions }(ts || (ts = {})); var ts; !function (ts) { function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintFromTypeParameter, getFirstIdentifier) { function getSymbolWalker(accept) { function visitType(type) { if (type && !visitedTypes[type.id]) { visitedTypes[type.id] = type; var shouldBail = visitSymbol(type.symbol); if (!shouldBail) { if (65536 & type.flags) { var objectType = type, objectFlags = objectType.objectFlags; 4 & objectFlags && visitTypeReference(type), 32 & objectFlags && visitMappedType(type), 3 & objectFlags && visitInterfaceType(type), 24 & objectFlags && visitObjectType(objectType) } 32768 & type.flags && visitTypeParameter(type), 393216 & type.flags && visitUnionOrIntersectionType(type), 524288 & type.flags && visitIndexType(type), 1048576 & type.flags && visitIndexedAccessType(type) } } } function visitTypeReference(type) { visitType(type.target), ts.forEach(type.typeArguments, visitType) } function visitTypeParameter(type) { visitType(getConstraintFromTypeParameter(type)) } function visitUnionOrIntersectionType(type) { ts.forEach(type.types, visitType) } function visitIndexType(type) { visitType(type.type) } function visitIndexedAccessType(type) { visitType(type.objectType), visitType(type.indexType), visitType(type.constraint) } function visitMappedType(type) { visitType(type.typeParameter), visitType(type.constraintType), visitType(type.templateType), visitType(type.modifiersType) } function visitSignature(signature) { var typePredicate = getTypePredicateOfSignature(signature); typePredicate && visitType(typePredicate.type), ts.forEach(signature.typeParameters, visitType); for (var _i = 0, _a = signature.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; visitSymbol(parameter) } visitType(getRestTypeOfSignature(signature)), visitType(getReturnTypeOfSignature(signature)) } function visitInterfaceType(interfaceT) { visitObjectType(interfaceT), ts.forEach(interfaceT.typeParameters, visitType), ts.forEach(getBaseTypes(interfaceT), visitType), visitType(interfaceT.thisType) } function visitObjectType(type) { var stringIndexType = getIndexTypeOfStructuredType(type, 0); visitType(stringIndexType); var numberIndexType = getIndexTypeOfStructuredType(type, 1); visitType(numberIndexType); for (var resolved = resolveStructuredTypeMembers(type), _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; visitSignature(signature) } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; visitSignature(signature) } for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; visitSymbol(p) } } function visitSymbol(symbol) { if (symbol) { var symbolId = ts.getSymbolId(symbol); if (!visitedSymbols[symbolId]) { if (visitedSymbols[symbolId] = symbol, !accept(symbol)) return !0; var t = getTypeOfSymbol(symbol); visitType(t), 1952 & symbol.flags && symbol.exports.forEach(visitSymbol), ts.forEach(symbol.declarations, function (d) { if (d.type && 164 === d.type.kind) { var query = d.type, entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity) } }) } } } void 0 === accept && (accept = function () { return !0 }); var visitedTypes = [], visitedSymbols = []; return { walkType: function (type) { try { return visitType(type), { visitedTypes: ts.getOwnValues(visitedTypes), visitedSymbols: ts.getOwnValues(visitedSymbols) } } finally { ts.clear(visitedTypes), ts.clear(visitedSymbols) } }, walkSymbol: function (symbol) { try { return visitSymbol(symbol), { visitedTypes: ts.getOwnValues(visitedTypes), visitedSymbols: ts.getOwnValues(visitedSymbols) } } finally { ts.clear(visitedTypes), ts.clear(visitedSymbols) } } } } return getSymbolWalker } ts.createGetSymbolWalker = createGetSymbolWalker }(ts || (ts = {})); var ts; !function (ts) { function trace(host) { host.trace(ts.formatMessage.apply(void 0, arguments)) } function isTraceEnabled(compilerOptions, host) { return compilerOptions.traceResolution && void 0 !== host.trace } function withPackageId(packageId, r) { return r && { path: r.path, extension: r.ext, packageId: packageId } } function noPackageId(r) { return withPackageId(void 0, r) } function resolvedTypeScriptOnly(resolved) { if (resolved) return ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)), { fileName: resolved.path, packageId: resolved.packageId } } function createResolvedModuleWithFailedLookupLocations(resolved, originalPath, isExternalLibraryImport, failedLookupLocations) { return { resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId }, failedLookupLocations: failedLookupLocations } } function tryReadPackageJsonFields(readTypes, jsonContent, baseDirectory, state) { function tryReadFromField(fieldName) { if (!ts.hasProperty(jsonContent, fieldName)) return void (state.traceEnabled && trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName)); var fileName = jsonContent[fieldName]; if (!ts.isString(fileName)) return void (state.traceEnabled && trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName)); var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); return state.traceEnabled && trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path), path } return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main") } function readJson(path, host) { try { var jsonText = host.readFile(path); if (!jsonText) return {}; var result = ts.parseConfigFileTextToJson(path, jsonText); return result.error ? {} : result.config } catch (e) { return {} } } function getEffectiveTypeRoots(options, host) { if (options.typeRoots) return options.typeRoots; var currentDirectory; return options.configFilePath ? currentDirectory = ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory && (currentDirectory = host.getCurrentDirectory()), void 0 !== currentDirectory ? getDefaultTypeRoots(currentDirectory, host) : void 0 } function getDefaultTypeRoots(currentDirectory, host) { if (!host.directoryExists) return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; var typeRoots; return ts.forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); host.directoryExists(atTypes) && (typeRoots || (typeRoots = [])).push(atTypes) }), typeRoots } function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { function primaryLookup() { return typeRoots && typeRoots.length ? (traceEnabled && trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")), ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName), candidateDirectory = ts.getDirectoryPath(candidate), directoryExists = directoryProbablyExists(candidateDirectory, host); return !directoryExists && traceEnabled && trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory), resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)) })) : void (traceEnabled && trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths)) } function secondaryLookup() { var resolvedFile, initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); if (void 0 !== initialLocationForSecondaryLookup) { traceEnabled && trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, void 0); return resolvedFile = resolvedTypeScriptOnly(result && result.value), !resolvedFile && traceEnabled && trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName), resolvedFile } traceEnabled && trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder) } var traceEnabled = isTraceEnabled(options, host), moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled }, typeRoots = getEffectiveTypeRoots(options, host); traceEnabled && (void 0 === containingFile ? void 0 === typeRoots ? trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName) : trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots) : void 0 === typeRoots ? trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile) : trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots)); var failedLookupLocations = [], resolved = primaryLookup(), primary = !0; resolved || (resolved = secondaryLookup(), primary = !1); var resolvedTypeReferenceDirective; return resolved && (options.preserveSymlinks || (resolved = __assign({}, resolved, { fileName: realPath(resolved.fileName, host, traceEnabled) })), traceEnabled && trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved.fileName, primary), resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved.fileName, packageId: resolved.packageId }), { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations } } function getAutomaticTypeDirectiveNames(options, host) { if (options.types) return options.types; var result = []; if (host.directoryExists && host.getDirectories) { var typeRoots = getEffectiveTypeRoots(options, host); if (typeRoots) for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { var root = typeRoots_1[_i]; if (host.directoryExists(root)) for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { var typeDirectivePath = _b[_a], normalized = ts.normalizePath(typeDirectivePath), packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)), isNotNeededPackage = host.fileExists(packageJsonPath) && null === readJson(packageJsonPath, host).typings; isNotNeededPackage || result.push(ts.getBaseFileName(normalized)) } } } return result } function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { return createModuleResolutionCacheWithMaps(ts.createMap(), ts.createMap(), currentDirectory, getCanonicalFileName) } function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) { function getOrCreateCacheForDirectory(directoryName) { var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName), perFolderCache = directoryToModuleNameMap.get(path); return perFolderCache || (perFolderCache = ts.createMap(), directoryToModuleNameMap.set(path, perFolderCache)), perFolderCache } function getOrCreateCacheForModuleName(nonRelativeModuleName) { if (!ts.isExternalModuleNameRelative(nonRelativeModuleName)) { var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); return perModuleNameCache || (perModuleNameCache = createPerModuleNameCache(), moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache)), perModuleNameCache } } function createPerModuleNameCache() { function get(directory) { return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)) } function set(directory, result) { var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); if (!directoryPathMap.has(path)) { directoryPathMap.set(path, result); for (var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName, commonPrefix = getCommonPrefix(path, resolvedFileName), current = path; ;) { var parent = ts.getDirectoryPath(current); if (parent === current || directoryPathMap.has(parent)) break; if (directoryPathMap.set(parent, result), current = parent, current === commonPrefix) break } } } function getCommonPrefix(directory, resolution) { if (void 0 !== resolution) { for (var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName), i = 0; i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i);)i++; var sep = directory.lastIndexOf(ts.directorySeparator, i); if (!(sep < 0)) return directory.substr(0, sep) } } var directoryPathMap = ts.createMap(); return { get: get, set: set } } return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName } } function resolveModuleNameFromCache(moduleName, containingFile, cache) { var containingDirectory = ts.getDirectoryPath(containingFile), perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); return perFolderCache && perFolderCache.get(moduleName) } function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); traceEnabled && trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); var containingDirectory = ts.getDirectoryPath(containingFile), perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory), result = perFolderCache && perFolderCache.get(moduleName); if (result) traceEnabled && trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory); else { var moduleResolution = compilerOptions.moduleResolution; switch (void 0 === moduleResolution ? (moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic, traceEnabled && trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution])) : traceEnabled && trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]), moduleResolution) { case ts.ModuleResolutionKind.NodeJs: result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); break; case ts.ModuleResolutionKind.Classic: result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); break; default: ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution) }if (perFolderCache) { perFolderCache.set(moduleName, result); var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); perModuleNameCache && perModuleNameCache.set(containingDirectory, result) } } return traceEnabled && (result.resolvedModule ? trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName) : trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName)), result } function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { return ts.isExternalModuleNameRelative(moduleName) ? tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) : tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) } function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { if (state.compilerOptions.rootDirs) { state.traceEnabled && trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); for (var matchedRootDir, matchedNormalizedPrefix, candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)), _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { var rootDir = _a[_i], normalizedRoot = ts.normalizePath(rootDir); ts.endsWith(normalizedRoot, ts.directorySeparator) || (normalizedRoot += ts.directorySeparator); var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && (void 0 === matchedNormalizedPrefix || matchedNormalizedPrefix.length < normalizedRoot.length); state.traceEnabled && trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix), isLongestMatchingPrefix && (matchedNormalizedPrefix = normalizedRoot, matchedRootDir = rootDir) } if (matchedNormalizedPrefix) { state.traceEnabled && trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); var suffix = candidate.substr(matchedNormalizedPrefix.length); state.traceEnabled && trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); if (resolvedFileName) return resolvedFileName; state.traceEnabled && trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { var rootDir = _c[_b]; if (rootDir !== matchedRootDir) { var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); state.traceEnabled && trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); var baseDirectory = ts.getDirectoryPath(candidate_1), resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); if (resolvedFileName_1) return resolvedFileName_1 } } state.traceEnabled && trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed) } } } function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) { if (state.compilerOptions.baseUrl) { state.traceEnabled && trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); var matchedPattern; if (state.compilerOptions.paths && (state.traceEnabled && trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName), matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName)), matchedPattern) { var matchedStar_1 = ts.isString(matchedPattern) ? void 0 : ts.matchedText(matchedPattern, moduleName), matchedPatternText = ts.isString(matchedPattern) ? matchedPattern : ts.patternText(matchedPattern); return state.traceEnabled && trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText), ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) { var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst, candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); state.traceEnabled && trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); var extension = ts.tryGetExtensionFromPath(candidate); if (void 0 !== extension) { var path_1 = tryFile(candidate, failedLookupLocations, !1, state); if (void 0 !== path_1) return noPackageId({ path: path_1, ext: extension }) } return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state) }) } var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); return state.traceEnabled && trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate), loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state) } } function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { return nodeModuleNameResolverWorker(moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, !1) } function resolveJavaScriptModule(moduleName, initialDir, host) { var _a = nodeModuleNameResolverWorker(moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: !0 }, host, void 0, !0), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; if (!resolvedModule) throw new Error("Could not resolve JS module '" + moduleName + "' starting at '" + initialDir + "'. Looked in: " + failedLookupLocations.join(", ")); return resolvedModule.resolvedFileName } function nodeModuleNameResolverWorker(moduleName, containingDirectory, compilerOptions, host, cache, jsOnly) { function tryResolve(extensions) { var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, !0) }, resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); if (resolved) return toSearchResult({ resolved: resolved, isExternalLibraryImport: !1 }); if (ts.isExternalModuleNameRelative(moduleName)) { var _a = ts.normalizePathAndParts(ts.combinePaths(containingDirectory, moduleName)), candidate = _a.path, parts = _a.parts, resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, !1, state, !0); return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") }) } traceEnabled && trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); if (resolved_1) { var resolvedValue = resolved_1.value, originalPath = void 0; if (!compilerOptions.preserveSymlinks && resolvedValue) { originalPath = resolvedValue.path; var path = realPath(resolved_1.value.path, host, traceEnabled); path === originalPath && (originalPath = void 0), resolvedValue = __assign({}, resolvedValue, { path: path }) } return { value: resolvedValue && { resolved: resolvedValue, originalPath: originalPath, isExternalLibraryImport: !0 } } } } var traceEnabled = isTraceEnabled(compilerOptions, host), failedLookupLocations = [], state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }, result = jsOnly ? tryResolve(Extensions.JavaScript) : tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript) || (compilerOptions.resolveJsonModule ? tryResolve(Extensions.Json) : void 0); if (result && result.value) { var _a = result.value, resolved = _a.resolved, originalPath = _a.originalPath, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, originalPath, isExternalLibraryImport, failedLookupLocations) } return { resolvedModule: void 0, failedLookupLocations: failedLookupLocations } } function realPath(path, host, traceEnabled) { if (!host.realpath) return path; var real = ts.normalizePath(host.realpath(path)); return traceEnabled && trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real), ts.Debug.assert(host.fileExists(real), path + " linked to nonexistent file " + real), real } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { if (state.traceEnabled && trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]), !ts.hasTrailingDirectorySeparator(candidate)) { if (!onlyRecordFailures) { var parentOfCandidate = ts.getDirectoryPath(candidate); directoryProbablyExists(parentOfCandidate, state.host) || (state.traceEnabled && trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate), onlyRecordFailures = !0) } var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); if (resolvedFromFile) { var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : void 0, packageId = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, failedLookupLocations, !1, state).packageId; return withPackageId(packageId, resolvedFromFile) } } if (!onlyRecordFailures) { var candidateExists = directoryProbablyExists(candidate, state.host); candidateExists || (state.traceEnabled && trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate), onlyRecordFailures = !0) } return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) } function parseNodeModuleFromPath(resolved) { var path = ts.normalizePath(resolved.path), idx = path.lastIndexOf(nodeModulesPathPart); if (idx !== -1) { var indexAfterNodeModules = idx + nodeModulesPathPart.length, indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules); 64 === path.charCodeAt(indexAfterNodeModules) && (indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName)); var packageDirectory = path.slice(0, indexAfterPackageName), subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts"; return { packageDirectory: packageDirectory, subModuleName: subModuleName } } } function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) { var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1); return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex } function addExtensionAndIndex(path) { return "" === path ? "index.d.ts" : ts.endsWith(path, ".d.ts") ? path : ts.endsWith(path, "/index") ? path + ".d.ts" : path + "/index.d.ts" } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName) } function loadModuleFromFileNoPackageId(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return noPackageId(loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state)) } function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { if (extensions === Extensions.Json) { var extensionLess = ts.tryRemoveExtension(candidate, ".json"); return extensionLess && tryAddingExtensions(extensionLess, extensions, failedLookupLocations, onlyRecordFailures, state) } var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state); if (resolvedByAddingExtension) return resolvedByAddingExtension; if (ts.hasJavaScriptFileExtension(candidate)) { var extensionless = ts.removeFileExtension(candidate); if (state.traceEnabled) { var extension = candidate.substring(extensionless.length); trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension) } return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state) } } function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) { function tryExtension(ext) { var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state); return path && { path: path, ext: ext } } if (!onlyRecordFailures) { var directory_1 = ts.getDirectoryPath(candidate); directory_1 && (onlyRecordFailures = !directoryProbablyExists(directory_1, state.host)) } switch (extensions) { case Extensions.DtsOnly: return tryExtension(".d.ts"); case Extensions.TypeScript: return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts"); case Extensions.JavaScript: return tryExtension(".js") || tryExtension(".jsx"); case Extensions.Json: return tryExtension(".json") } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { if (!onlyRecordFailures) { if (state.host.fileExists(fileName)) return state.traceEnabled && trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName), fileName; state.traceEnabled && trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName) } failedLookupLocations.push(fileName) } function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { void 0 === considerPackageJson && (considerPackageJson = !0); var _a = considerPackageJson ? getPackageJsonInfo(candidate, "", failedLookupLocations, onlyRecordFailures, state) : { packageJsonContent: void 0, packageId: void 0 }, packageJsonContent = _a.packageJsonContent, packageId = _a.packageId; return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, packageJsonContent)) } function loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, packageJsonContent) { var fromPackageJson = packageJsonContent && loadModuleFromPackageJson(packageJsonContent, extensions, candidate, failedLookupLocations, state); if (fromPackageJson) return fromPackageJson; var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state) } function getPackageJsonInfo(nodeModuleDirectory, subModuleName, failedLookupLocations, onlyRecordFailures, state) { var host = state.host, traceEnabled = state.traceEnabled, directoryExists = !onlyRecordFailures && directoryProbablyExists(nodeModuleDirectory, host), packageJsonPath = pathToPackageJson(nodeModuleDirectory); if (directoryExists && host.fileExists(packageJsonPath)) { var packageJsonContent = readJson(packageJsonPath, host); if ("" === subModuleName) { var path = tryReadPackageJsonFields(!0, packageJsonContent, nodeModuleDirectory, state); if ("string" == typeof path) subModuleName = addExtensionAndIndex(path.substring(nodeModuleDirectory.length + 1)); else { var jsPath = tryReadPackageJsonFields(!1, packageJsonContent, nodeModuleDirectory, state); if ("string" == typeof jsPath && jsPath.length > nodeModuleDirectory.length) { var potentialSubModule_1 = jsPath.substring(nodeModuleDirectory.length + 1); subModuleName = (ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.tryRemoveExtension(potentialSubModule_1, extension) }) || potentialSubModule_1) + ".d.ts" } else subModuleName = "index.d.ts" } } ts.endsWith(subModuleName, ".d.ts") || (subModuleName = addExtensionAndIndex(subModuleName)); var packageId = "string" == typeof packageJsonContent.name && "string" == typeof packageJsonContent.version ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } : void 0; return traceEnabled && (packageId ? trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId)) : trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath)), { found: !0, packageJsonContent: packageJsonContent, packageId: packageId } } return directoryExists && traceEnabled && trace(host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath), failedLookupLocations.push(packageJsonPath), { found: !1, packageJsonContent: void 0, packageId: void 0 } } function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript && extensions !== Extensions.Json, jsonContent, candidate, state); if (!file) { if (extensions !== Extensions.TypeScript) return; if (file = tryReadPackageJsonFields(!1, jsonContent, candidate, state), !file) return } var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host), fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); if (fromFile) { var resolved = resolvedIfExtensionMatches(extensions, fromFile); if (resolved) return resolved; state.traceEnabled && trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile) } var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions, result = nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, !1); if (result) return ts.Debug.assert(void 0 === result.packageId), { path: result.path, ext: result.extension } } function resolvedIfExtensionMatches(extensions, path) { var ext = ts.tryGetExtensionFromPath(path); return void 0 !== ext && extensionIsOk(extensions, ext) ? { path: path, ext: ext } : void 0 } function extensionIsOk(extensions, extension) { switch (extensions) { case Extensions.JavaScript: return ".js" === extension || ".jsx" === extension; case Extensions.Json: return ".json" === extension; case Extensions.TypeScript: return ".ts" === extension || ".tsx" === extension || ".d.ts" === extension; case Extensions.DtsOnly: return ".d.ts" === extension } } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json") } function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var packageJsonContent, packageId, candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)), packageInfo = getPackageJsonInfo(candidate, "", failedLookupLocations, !nodeModulesFolderExists, state); if (packageInfo.found) packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId; else { var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; if ("" !== rest) { var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); packageId = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state).packageId } } var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); return withPackageId(packageId, pathAndExtension) } function getPackageName(moduleName) { var idx = moduleName.indexOf(ts.directorySeparator); return "@" === moduleName[0] && (idx = moduleName.indexOf(ts.directorySeparator, idx + 1)), idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) } } function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, !1, cache) } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, !0, void 0) } function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if ("node_modules" !== ts.getBaseFileName(ancestorDirectory)) { var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host, failedLookupLocations); return resolutionFromCache ? resolutionFromCache : toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)) } }) } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { void 0 === typesOnly && (typesOnly = !1); var nodeModulesFolder = ts.combinePaths(directory, "node_modules"), nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); !nodeModulesFolderExists && state.traceEnabled && trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); var packageResult = typesOnly ? void 0 : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) return packageResult; if (extensions !== Extensions.JavaScript && extensions !== Extensions.Json) { var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"), nodeModulesAtTypesExists = nodeModulesFolderExists; return nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host) && (state.traceEnabled && trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1), nodeModulesAtTypesExists = !1), loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state) } } function mangleScopedPackage(packageName, state) { var mangled = getMangledNameForScopedPackage(packageName); return state.traceEnabled && mangled !== packageName && trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled), mangled } function getTypesPackageName(packageName) { return "@types/" + getMangledNameForScopedPackage(packageName) } function getMangledNameForScopedPackage(packageName) { if (ts.startsWith(packageName, "@")) { var replaceSlash = packageName.replace(ts.directorySeparator, mangledScopedPackageSeparator); if (replaceSlash !== packageName) return replaceSlash.slice(1) } return packageName } function getPackageNameFromAtTypesDirectory(mangledName) { var withoutAtTypePrefix = ts.removePrefix(mangledName, "@types/"); return withoutAtTypePrefix !== mangledName ? getUnmangledNameForScopedPackage(withoutAtTypePrefix) : mangledName } function getUnmangledNameForScopedPackage(typesPackageName) { return ts.stringContains(typesPackageName, mangledScopedPackageSeparator) ? "@" + typesPackageName.replace(mangledScopedPackageSeparator, ts.directorySeparator) : typesPackageName } function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host, failedLookupLocations) { var result = cache && cache.get(containingDirectory); if (result) return traceEnabled && trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory), failedLookupLocations.push.apply(failedLookupLocations, result.failedLookupLocations), { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId } } } function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, failedLookupLocations, state); if (resolvedUsingSettings) return { value: resolvedUsingSettings }; var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (ts.isExternalModuleNameRelative(moduleName)) { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); return toSearchResult(loadModuleFromFileNoPackageId(extensions, candidate, failedLookupLocations, !1, state)) } var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) { var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host, failedLookupLocations); if (resolutionFromCache) return resolutionFromCache; var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); return toSearchResult(loadModuleFromFileNoPackageId(extensions, searchName, failedLookupLocations, !1, state)) }); return resolved_3 ? resolved_3 : extensions === Extensions.TypeScript ? loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state) : void 0 } var traceEnabled = isTraceEnabled(compilerOptions, host), state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }, failedLookupLocations = [], containingDirectory = ts.getDirectoryPath(containingFile), resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, void 0, !1, failedLookupLocations) } function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) { var traceEnabled = isTraceEnabled(compilerOptions, host); traceEnabled && trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }, failedLookupLocations = [], resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, void 0, !0, failedLookupLocations) } function toSearchResult(value) { return void 0 !== value ? { value: value } : void 0 } ts.trace = trace, ts.isTraceEnabled = isTraceEnabled; var Extensions; !function (Extensions) { Extensions[Extensions.TypeScript = 0] = "TypeScript", Extensions[Extensions.JavaScript = 1] = "JavaScript", Extensions[Extensions.Json = 2] = "Json", Extensions[Extensions.DtsOnly = 3] = "DtsOnly" }(Extensions || (Extensions = {})), ts.readJson = readJson, ts.getEffectiveTypeRoots = getEffectiveTypeRoots; var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective, ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames, ts.createModuleResolutionCache = createModuleResolutionCache, ts.createModuleResolutionCacheWithMaps = createModuleResolutionCacheWithMaps, ts.resolveModuleNameFromCache = resolveModuleNameFromCache, ts.resolveModuleName = resolveModuleName, ts.nodeModuleNameResolver = nodeModuleNameResolver, ts.resolveJavaScriptModule = resolveJavaScriptModule; var nodeModulesPathPart = "/node_modules/"; ts.directoryProbablyExists = directoryProbablyExists, ts.getPackageName = getPackageName; var mangledScopedPackageSeparator = "__"; ts.getTypesPackageName = getTypesPackageName, ts.getMangledNameForScopedPackage = getMangledNameForScopedPackage, ts.getPackageNameFromAtTypesDirectory = getPackageNameFromAtTypesDirectory, ts.getUnmangledNameForScopedPackage = getUnmangledNameForScopedPackage, ts.classicNameResolver = classicNameResolver, ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache }(ts || (ts = {})); var ts; !function (ts) { function getNodeId(node) { return node.id || (node.id = nextNodeId, nextNodeId++), node.id } function getSymbolId(symbol) { return symbol.id || (symbol.id = nextSymbolId, nextSymbolId++), symbol.id } function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); return 1 === moduleState || preserveConstEnums && 2 === moduleState } function createTypeChecker(host, produceDiagnostics) { function getSymbolDisplayBuilder() { function emitTextWriterWrapper(underlying) { return { write: ts.noop, writeTextOfNode: ts.noop, writeLine: ts.noop, increaseIndent: function () { return underlying.increaseIndent() }, decreaseIndent: function () { return underlying.decreaseIndent() }, getText: function () { return "" }, rawWrite: ts.noop, writeLiteral: function (s) { return underlying.writeStringLiteral(s) }, getTextPos: function () { return 0 }, getLine: function () { return 0 }, getColumn: function () { return 0 }, getIndent: function () { return 0 }, isAtStartOfLine: function () { return !1 }, clear: function () { return underlying.clear() }, writeKeyword: function (text) { return underlying.writeKeyword(text) }, writeOperator: function (text) { return underlying.writeOperator(text) }, writePunctuation: function (text) { return underlying.writePunctuation(text) }, writeSpace: function (text) { return underlying.writeSpace(text) }, writeStringLiteral: function (text) { return underlying.writeStringLiteral(text) }, writeParameter: function (text) { return underlying.writeParameter(text) }, writeProperty: function (text) { return underlying.writeProperty(text) }, writeSymbol: function (text, symbol) { return underlying.writeSymbol(text, symbol) }, trackSymbol: function (symbol, enclosing, meaning) { return underlying.trackSymbol && underlying.trackSymbol(symbol, enclosing, meaning) }, reportInaccessibleThisError: function () { return underlying.reportInaccessibleThisError && underlying.reportInaccessibleThisError() }, reportPrivateInBaseOfClassExpression: function (name) { return underlying.reportPrivateInBaseOfClassExpression && underlying.reportPrivateInBaseOfClassExpression(name) }, reportInaccessibleUniqueSymbolError: function () { return underlying.reportInaccessibleUniqueSymbolError && underlying.reportInaccessibleUniqueSymbolError() } } } return { buildTypeDisplay: function (type, writer, enclosingDeclaration, flags) { typeToString(type, enclosingDeclaration, flags, emitTextWriterWrapper(writer)) }, buildSymbolDisplay: function (symbol, writer, enclosingDeclaration, meaning, flags) { symbolToString(symbol, enclosingDeclaration, meaning, 4 | flags, emitTextWriterWrapper(writer)) }, buildSignatureDisplay: function (signature, writer, enclosing, flags, kind) { signatureToString(signature, enclosing, flags, kind, emitTextWriterWrapper(writer)) }, buildIndexSignatureDisplay: function (info, writer, kind, enclosing, flags) { var sig = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, kind, enclosing, 3112960 | toNodeBuilderFlags(flags), writer), printer = ts.createPrinter({ removeComments: !0 }); printer.writeNode(4, sig, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosing)), emitTextWriterWrapper(writer)) }, buildParameterDisplay: function (symbol, writer, enclosing, flags) { var node = nodeBuilder.symbolToParameterDeclaration(symbol, enclosing, 3112960 | toNodeBuilderFlags(flags), writer), printer = ts.createPrinter({ removeComments: !0 }); printer.writeNode(4, node, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosing)), emitTextWriterWrapper(writer)) }, buildTypeParameterDisplay: function (tp, writer, enclosing, flags) { var node = nodeBuilder.typeParameterToDeclaration(tp, enclosing, 3112960 | toNodeBuilderFlags(flags) | 8192, writer), printer = ts.createPrinter({ removeComments: !0 }); printer.writeNode(4, node, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosing)), emitTextWriterWrapper(writer)) }, buildTypePredicateDisplay: function (predicate, writer, enclosing, flags) { typePredicateToString(predicate, enclosing, flags, emitTextWriterWrapper(writer)) }, buildTypeParameterDisplayFromSymbol: function (symbol, writer, enclosing, flags) { var nodes = nodeBuilder.symbolToTypeParameterDeclarations(symbol, enclosing, 3112960 | toNodeBuilderFlags(flags), writer), printer = ts.createPrinter({ removeComments: !0 }); printer.writeList(26896, nodes, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosing)), emitTextWriterWrapper(writer)) }, buildDisplayForParametersAndDelimiters: function (thisParameter, parameters, writer, enclosing, originalFlags) { var printer = ts.createPrinter({ removeComments: !0 }), flags = 3121152 | toNodeBuilderFlags(originalFlags), thisParameterArray = thisParameter ? [nodeBuilder.symbolToParameterDeclaration(thisParameter, enclosing, flags)] : [], params = ts.createNodeArray(thisParameterArray.concat(ts.map(parameters, function (param) { return nodeBuilder.symbolToParameterDeclaration(param, enclosing, flags) }))); printer.writeList(1296, params, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosing)), emitTextWriterWrapper(writer)) }, buildDisplayForTypeParametersAndDelimiters: function (typeParameters, writer, enclosing, flags) { var printer = ts.createPrinter({ removeComments: !0 }), args = ts.createNodeArray(ts.map(typeParameters, function (p) { return nodeBuilder.typeParameterToDeclaration(p, enclosing, toNodeBuilderFlags(flags)) })); printer.writeList(26896, args, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosing)), emitTextWriterWrapper(writer)) }, buildReturnTypeDisplay: function (signature, writer, enclosing, flags) { writer.writePunctuation(":"), writer.writeSpace(" "); var predicate = getTypePredicateOfSignature(signature); if (predicate) return typePredicateToString(predicate, enclosing, flags, emitTextWriterWrapper(writer)); var node = nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosing, 3112960 | toNodeBuilderFlags(flags), writer), printer = ts.createPrinter({ removeComments: !0 }); printer.writeNode(4, node, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosing)), emitTextWriterWrapper(writer)) } } } function getJsxNamespace(location) { if (location) { var file_1 = ts.getSourceFileOfNode(location); if (file_1) { if (file_1.localJsxNamespace) return file_1.localJsxNamespace; var jsxPragma = file_1.pragmas.get("jsx"); if (jsxPragma) { var chosenpragma = ts.isArray(jsxPragma) ? jsxPragma[0] : jsxPragma; if (file_1.localJsxFactory = ts.parseIsolatedEntityName(chosenpragma.arguments.factory, languageVersion), file_1.localJsxFactory) return file_1.localJsxNamespace = getFirstIdentifier(file_1.localJsxFactory).escapedText } } } return _jsxNamespace || (_jsxNamespace = "React", compilerOptions.jsxFactory ? (_jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion), _jsxFactoryEntity && (_jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).escapedText)) : compilerOptions.reactNamespace && (_jsxNamespace = ts.escapeLeadingUnderscores(compilerOptions.reactNamespace))), _jsxNamespace } function getEmitResolver(sourceFile, cancellationToken) { return getDiagnostics(sourceFile, cancellationToken), emitResolver } function error(location, message, arg0, arg1, arg2, arg3) { var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2, arg3); diagnostics.add(diagnostic) } function addErrorOrSuggestion(isError, diagnostic) { isError ? diagnostics.add(diagnostic) : suggestionDiagnostics.add(diagnostic.file.fileName, __assign({}, diagnostic, { category: ts.DiagnosticCategory.Suggestion })) } function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) { addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)) } function createSymbol(flags, name, checkFlags) { symbolCount++; var symbol = new Symbol(33554432 | flags, name); return symbol.checkFlags = checkFlags || 0, symbol } function isTransientSymbol(symbol) { return 0 !== (33554432 & symbol.flags) } function getExcludedSymbolFlags(flags) { var result = 0; return 2 & flags && (result |= 67216319), 1 & flags && (result |= 67216318), 4 & flags && (result |= 0), 8 & flags && (result |= 68008959), 16 & flags && (result |= 67215791), 32 & flags && (result |= 68008383), 64 & flags && (result |= 67901832), 256 & flags && (result |= 68008191), 128 & flags && (result |= 68008831), 512 & flags && (result |= 67215503), 8192 & flags && (result |= 67208127), 32768 & flags && (result |= 67150783), 65536 & flags && (result |= 67183551), 262144 & flags && (result |= 67639784), 524288 & flags && (result |= 67901928), 2097152 & flags && (result |= 2097152), result } function recordMergedSymbol(target, source) { source.mergeId || (source.mergeId = nextMergeId, nextMergeId++), mergedSymbols[source.mergeId] = target } function cloneSymbol(symbol) { var result = createSymbol(symbol.flags, symbol.escapedName); return result.declarations = symbol.declarations ? symbol.declarations.slice() : [], result.parent = symbol.parent, symbol.valueDeclaration && (result.valueDeclaration = symbol.valueDeclaration), symbol.constEnumOnlyModule && (result.constEnumOnlyModule = !0), symbol.members && (result.members = ts.cloneMap(symbol.members)), symbol.exports && (result.exports = ts.cloneMap(symbol.exports)), recordMergedSymbol(result, symbol), result } function mergeSymbol(target, source) { if (!(target.flags & getExcludedSymbolFlags(source.flags)) || 67108864 & (source.flags | target.flags)) { var targetValueDeclaration = target.valueDeclaration; if (ts.Debug.assert(!!(33554432 & target.flags)), 512 & source.flags && 512 & target.flags && target.constEnumOnlyModule && !source.constEnumOnlyModule && (target.constEnumOnlyModule = !1), target.flags |= source.flags, source.valueDeclaration && (!target.valueDeclaration || 238 === target.valueDeclaration.kind && 238 !== source.valueDeclaration.kind) && (target.valueDeclaration = source.valueDeclaration), ts.addRange(target.declarations, source.declarations), source.members && (target.members || (target.members = ts.createSymbolTable()), mergeSymbolTable(target.members, source.members)), source.exports && (target.exports || (target.exports = ts.createSymbolTable()), mergeSymbolTable(target.exports, source.exports)), 67108864 & (source.flags | target.flags)) { var sourceInitializer = ts.getJSInitializerSymbol(source), init = ts.getDeclaredJavascriptInitializer(targetValueDeclaration) || ts.getAssignedJavascriptInitializer(targetValueDeclaration), targetInitializer = init && init.symbol ? init.symbol : target; if (!(33554432 & targetInitializer.flags)) { var mergedInitializer = getMergedSymbol(targetInitializer); targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer } sourceInitializer === source && targetInitializer === target || mergeSymbol(targetInitializer, sourceInitializer) } recordMergedSymbol(target, source) } else if (1024 & target.flags) error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); else { var message_2 = 384 & target.flags || 384 & source.flags ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations : 2 & target.flags || 2 & source.flags ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { var errorNode = (ts.getJavascriptInitializer(node, !1) ? ts.getOuterNameOfJsInitializer(node) : ts.getNameOfDeclaration(node)) || node; error(errorNode, message_2, symbolToString(source)) }), ts.forEach(target.declarations, function (node) { var errorNode = (ts.getJavascriptInitializer(node, !1) ? ts.getOuterNameOfJsInitializer(node) : ts.getNameOfDeclaration(node)) || node; error(errorNode, message_2, symbolToString(source)) }) } } function combineSymbolTables(first, second) { if (!first || 0 === first.size) return second; if (!second || 0 === second.size) return first; var combined = ts.createSymbolTable(); return mergeSymbolTable(combined, first), mergeSymbolTable(combined, second), combined } function mergeSymbolTable(target, source) { source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); targetSymbol ? (33554432 & targetSymbol.flags || (targetSymbol = cloneSymbol(targetSymbol), target.set(id, targetSymbol)), mergeSymbol(targetSymbol, sourceSymbol)) : target.set(id, sourceSymbol) }) } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) return void ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); if (ts.isGlobalScopeAugmentation(moduleAugmentation)) mergeSymbolTable(globals, moduleAugmentation.symbol.exports); else { var moduleNotFoundError = 4194304 & moduleName.parent.parent.flags ? void 0 : ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found, mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, !0); if (!mainModule) return; mainModule = resolveExternalModuleSymbol(mainModule), 1920 & mainModule.flags ? (mainModule = 33554432 & mainModule.flags ? mainModule : cloneSymbol(mainModule), mergeSymbol(mainModule, moduleAugmentation.symbol)) : error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text) } } function addToSymbolTable(target, source, message) { function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)) } } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); targetSymbol ? ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(ts.unescapeLeadingUnderscores(id), message)) : target.set(id, sourceSymbol) }) } function getSymbolLinks(symbol) { if (33554432 & symbol.flags) return symbol; var id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}) } function getNodeLinks(node) { var nodeId = getNodeId(node); return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }) } function isGlobalSourceFile(node) { return 273 === node.kind && !ts.isExternalOrCommonJsModule(node) } function getSymbol(symbols, name, meaning) { if (meaning) { var symbol = symbols.get(name); if (symbol) { if (ts.Debug.assert(0 === (1 & ts.getCheckFlags(symbol)), "Should never get an instantiated symbol here."), symbol.flags & meaning) return symbol; if (2097152 & symbol.flags) { var target = resolveAlias(symbol); if (target === unknownSymbol || target.flags & meaning) return symbol } } } } function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) { var constructorDeclaration = parameter.parent, classDeclaration = parameter.parent.parent, parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 67216319), propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 67216319); return parameterSymbol && propertySymbol ? [parameterSymbol, propertySymbol] : void ts.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration") } function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { case 213: case 219: case 221: if (isSameScopeDescendentOf(usage, declaration, container)) return !0 }return ts.isForInOrOfStatement(declaration.parent.parent) && isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container) } function isUsedInFunctionOrInstanceProperty(usage, declaration, container) { return !!ts.findAncestor(usage, function (current) { if (current === container) return "quit"; if (ts.isFunctionLike(current)) return !0; var initializerOfProperty = current.parent && 151 === current.parent.kind && current.parent.initializer === current; if (initializerOfProperty) if (ts.hasModifier(current.parent, 32)) { if (153 === declaration.kind) return !0 } else { var isDeclarationInstanceProperty = 151 === declaration.kind && !ts.hasModifier(declaration, 32); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) return !0 } }) } var declarationFile = ts.getSourceFileOfNode(declaration), useFile = ts.getSourceFileOfNode(usage); if (declarationFile !== useFile) { if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !compilerOptions.outFile && !compilerOptions.out || isInTypeQuery(usage) || 4194304 & declaration.flags) return !0; if (isUsedInFunctionOrInstanceProperty(usage, declaration)) return !0; var sourceFiles = host.getSourceFiles(); return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile) } if (declaration.pos <= usage.pos) { if (181 === declaration.kind) { var errorBindingElement = ts.getAncestor(usage, 181); return errorBindingElement ? ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos : isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 231), usage) } return 231 === declaration.kind ? !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) : !ts.isClassDeclaration(declaration) || !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration }) } if (251 === usage.parent.kind || 248 === usage.parent.kind && usage.parent.isExportEquals) return !0; if (248 === usage.kind && usage.isExportEquals) return !0; var container = ts.getEnclosingBlockScopeContainer(declaration); return isInTypeQuery(usage) || isUsedInFunctionOrInstanceProperty(usage, declaration, container) } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, suggestedNameNotFoundMessage) { return void 0 === excludeGlobals && (excludeGlobals = !1), resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol, suggestedNameNotFoundMessage) } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup, suggestedNameNotFoundMessage) { var result, lastLocation, lastSelfReferenceLocation, propertyWithInvalidInitializer, grandparent, originalLocation = location, errorLocation = location, isInExternalModule = !1; loop: for (; location;) { if (location.locals && !isGlobalSourceFile(location) && (result = lookup(location.locals, name, meaning))) { var useResult = !0; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body ? (meaning & result.flags & 67901928 && 285 !== lastLocation.kind && (useResult = !!(262144 & result.flags) && (lastLocation === location.type || 148 === lastLocation.kind || 147 === lastLocation.kind)), 67216319 & meaning && 1 & result.flags && (useResult = 148 === lastLocation.kind || lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter))) : 170 === location.kind && (useResult = lastLocation === location.trueType), useResult) break loop; result = void 0 } switch (location.kind) { case 273: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = !0; case 238: var moduleExports = getSymbolOfNode(location).exports; if (273 === location.kind || ts.isAmbientModule(location)) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) break loop; result = void 0 } var moduleExport = moduleExports.get(name); if (moduleExport && 2097152 === moduleExport.flags && ts.getDeclarationOfKind(moduleExport, 251)) break } if ("default" !== name && (result = lookup(moduleExports, name, 2623475 & meaning))) { if (!ts.isSourceFile(location) || !location.commonJsModuleIndicator || result.declarations.some(ts.isJSDocTypeAlias)) break loop; result = void 0 } break; case 237: if (result = lookup(getSymbolOfNode(location).exports, name, 8 & meaning)) break loop; break; case 151: case 150: if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32)) { var ctor = findConstructorDeclaration(location.parent); ctor && ctor.locals && lookup(ctor.locals, name, 67216319 & meaning) && (propertyWithInvalidInitializer = location) } break; case 234: case 204: case 235: if (result = lookup(getMembersOfSymbol(getSymbolOfNode(location)), name, 67901928 & meaning)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { result = void 0; break } if (lastLocation && ts.hasModifier(lastLocation, 32)) return void error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); break loop } if (204 === location.kind && 32 & meaning) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; break loop } } break; case 206: if (lastLocation === location.expression && 85 === location.parent.token) { var container = location.parent.parent; if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, 67901928 & meaning))) return void (nameNotFoundMessage && error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters)) } break; case 146: if (grandparent = location.parent.parent, (ts.isClassLike(grandparent) || 235 === grandparent.kind) && (result = lookup(getSymbolOfNode(grandparent).members, name, 67901928 & meaning))) return void error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); break; case 153: case 152: case 154: case 155: case 156: case 233: case 192: if (3 & meaning && "arguments" === name) { result = argumentsSymbol; break loop } break; case 191: if (3 & meaning && "arguments" === name) { result = argumentsSymbol; break loop } if (16 & meaning) { var functionName = location.name; if (functionName && name === functionName.escapedText) { result = location.symbol; break loop } } break; case 149: location.parent && 148 === location.parent.kind && (location = location.parent), location.parent && ts.isClassElement(location.parent) && (location = location.parent); break; case 296: case 291: location = ts.getJSDocHost(location) }isSelfReferenceLocation(location) && (lastSelfReferenceLocation = location), lastLocation = location, location = location.parent } if (!isUse || !result || lastSelfReferenceLocation && result === lastSelfReferenceLocation.symbol || (result.isReferenced |= meaning), !result) { if (lastLocation && (ts.Debug.assert(273 === lastLocation.kind), lastLocation.commonJsModuleIndicator && "exports" === name)) return lastLocation.symbol; excludeGlobals || (result = lookup(globals, name, meaning)) } if (!result && originalLocation && ts.isInJavaScriptFile(originalLocation) && originalLocation.parent) { if (ts.isRequireCall(originalLocation.parent, !1)) return requireSymbol; if (ts.isIdentifier(originalLocation) && ts.isPropertyAccessExpression(originalLocation.parent) && "module" === originalLocation.escapedText && "exports" === originalLocation.parent.name.escapedText) return moduleSymbol } if (result) { if (nameNotFoundMessage) { if (propertyWithInvalidInitializer) { var propertyName = propertyWithInvalidInitializer.name; return void error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg)) } if (errorLocation && (2 & meaning || (32 & meaning || 384 & meaning) && 67216319 === (67216319 & meaning))) { var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); (2 & exportOrLocalSymbol.flags || 32 & exportOrLocalSymbol.flags || 384 & exportOrLocalSymbol.flags) && checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation) } if (result && isInExternalModule && 67216319 === (67216319 & meaning) && !(2097152 & originalLocation.flags)) { var decls = result.declarations; decls && 1 === decls.length && 241 === decls[0].kind && error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)) } } return result } if (nameNotFoundMessage && !(errorLocation && (checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) || checkAndReportErrorForExtendingInterface(errorLocation) || checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) || checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) || checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)))) { var suggestion = void 0; suggestedNameNotFoundMessage && suggestionCount < maximumSuggestionCount && (suggestion = getSuggestionForNonexistentSymbol(originalLocation, name, meaning), suggestion && error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), suggestion)), suggestion || error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg)), suggestionCount++ } } function isSelfReferenceLocation(node) { switch (node.kind) { case 233: case 234: case 235: case 237: case 236: case 238: return !0; default: return !1 } } function diagnosticName(nameArg) { return ts.isString(nameArg) ? ts.unescapeLeadingUnderscores(nameArg) : ts.declarationNameToString(nameArg) } function isTypeParameterSymbolDeclaredInContainer(symbol, container) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; if (147 === decl.kind) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)) } } return !1 } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { if (!ts.isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) return !1; for (var container = ts.getThisContainer(errorLocation, !1), location = container; location;) { if (ts.isClassLike(location.parent)) { var classSymbol = getSymbolOfNode(location.parent); if (!classSymbol) break; var constructorType = getTypeOfSymbol(classSymbol); if (getPropertyOfType(constructorType, name)) return error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol)), !0; if (location === container && !ts.hasModifier(location, 32)) { var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; if (getPropertyOfType(instanceType, name)) return error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg)), !0 } } location = location.parent } return !1 } function checkAndReportErrorForExtendingInterface(errorLocation) { var expression = getEntityNameForExtendingInterface(errorLocation), isError = !(!expression || !resolveEntityName(expression, 64, !0)); return isError && error(errorLocation, ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, ts.getTextOfNode(expression)), isError } function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 71: case 184: return node.parent ? getEntityNameForExtendingInterface(node.parent) : void 0; case 206: if (ts.isEntityNameExpression(node.expression)) return node.expression; default: return } } function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { var namespaceMeaning = 1920 | (ts.isInJavaScriptFile(errorLocation) ? 67216319 : 0); if (meaning === namespaceMeaning) { var symbol = resolveSymbol(resolveName(errorLocation, name, 67901928 & ~namespaceMeaning, void 0, void 0, !1)), parent = errorLocation.parent; if (symbol) { if (ts.isQualifiedName(parent)) { ts.Debug.assert(parent.left === errorLocation, "Should only be resolving left side of qualified name as a namespace"); var propName = parent.right.escapedText, propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName); if (propType) return error(parent, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, ts.unescapeLeadingUnderscores(name), ts.unescapeLeadingUnderscores(propName)), !0 } return error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, ts.unescapeLeadingUnderscores(name)), !0 } } return !1 } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { if (67216319 & meaning) { if ("any" === name || "string" === name || "number" === name || "boolean" === name || "never" === name) return error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name)), !0; var symbol = resolveSymbol(resolveName(errorLocation, name, 792640, void 0, void 0, !1)); if (symbol && !(1024 & symbol.flags)) return error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name)), !0 } return !1 } function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { if (107031 & meaning) { var symbol = resolveSymbol(resolveName(errorLocation, name, 1024, void 0, void 0, !1)); if (symbol) return error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)), !0 } else if (792640 & meaning) { var symbol = resolveSymbol(resolveName(errorLocation, name, 1536, void 0, void 0, !1)); if (symbol) return error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)), !0 } return !1 } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert(!!(2 & result.flags || 32 & result.flags || 384 & result.flags)); var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || 237 === d.kind ? d : void 0 }); ts.Debug.assert(void 0 !== declaration, "Declaration to checkResolvedBlockScopedVariable is undefined"), 4194304 & declaration.flags || isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation) || (2 & result.flags ? error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(ts.getNameOfDeclaration(declaration))) : 32 & result.flags ? error(errorLocation, ts.Diagnostics.Class_0_used_before_its_declaration, ts.declarationNameToString(ts.getNameOfDeclaration(declaration))) : 256 & result.flags && error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, ts.declarationNameToString(ts.getNameOfDeclaration(declaration)))) } function isSameScopeDescendentOf(initial, parent, stopAt) { return parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent }) } function getAnyImportSyntax(node) { switch (node.kind) { case 242: return node; case 244: return node.parent; case 245: return node.parent.parent; case 247: return node.parent.parent.parent; default: return } } function getDeclarationOfAliasSymbol(symbol) { return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration) } function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { return 253 === node.moduleReference.kind ? resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))) : getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias) } function resolveExportByName(moduleSymbol, name, dontResolveAlias) { var exportValue = moduleSymbol.exports.get("export="); return exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : resolveSymbol(moduleSymbol.exports.get(name), dontResolveAlias) } function isSyntacticDefault(node) { return ts.isExportAssignment(node) && !node.isExportEquals || ts.hasModifier(node, 512) || ts.isExportSpecifier(node) } function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias) { if (!allowSyntheticDefaultImports) return !1; if (!file || file.isDeclarationFile) { var defaultExportSymbol = resolveExportByName(moduleSymbol, "default", !0); return (!defaultExportSymbol || !ts.some(defaultExportSymbol.declarations, isSyntacticDefault)) && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), dontResolveAlias) } return ts.isSourceFileJavaScript(file) ? !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), dontResolveAlias) : hasExportAssignmentSymbol(moduleSymbol) } function getTargetOfImportClause(node, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { var exportDefaultSymbol = void 0; exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? moduleSymbol : resolveExportByName(moduleSymbol, "default", dontResolveAlias); var file_2 = ts.find(moduleSymbol.declarations, ts.isSourceFile), hasSyntheticDefault = canHaveSyntheticDefault(file_2, moduleSymbol, dontResolveAlias); if (exportDefaultSymbol || hasSyntheticDefault) { if (hasSyntheticDefault) return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias) } else error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); return exportDefaultSymbol } } function getTargetOfNamespaceImport(node, dontResolveAlias) { var moduleSpecifier = node.parent.parent.moduleSpecifier; return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier, dontResolveAlias) } function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) return unknownSymbol; if (67903464 & valueSymbol.flags) return valueSymbol; var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName); return result.declarations = ts.deduplicate(ts.concatenate(valueSymbol.declarations, typeSymbol.declarations), ts.equateValues), result.parent = valueSymbol.parent || typeSymbol.parent, valueSymbol.valueDeclaration && (result.valueDeclaration = valueSymbol.valueDeclaration), typeSymbol.members && (result.members = typeSymbol.members), valueSymbol.exports && (result.exports = valueSymbol.exports), result } function getExportOfModule(symbol, name, dontResolveAlias) { if (1536 & symbol.flags) return resolveSymbol(getExportsOfSymbol(symbol).get(name), dontResolveAlias) } function getPropertyOfVariable(symbol, name) { if (3 & symbol.flags) { var typeAnnotation = symbol.valueDeclaration.type; if (typeAnnotation) return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)) } } function getExternalModuleMember(node, specifier, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier), targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier, dontResolveAlias); if (targetSymbol) { var name = specifier.propertyName || specifier.name; if (name.escapedText) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) return moduleSymbol; var symbolFromVariable = void 0; symbolFromVariable = moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=") ? getPropertyOfType(getTypeOfSymbol(targetSymbol), name.escapedText) : getPropertyOfVariable(targetSymbol, name.escapedText), symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); var symbolFromModule = getExportOfModule(targetSymbol, name.escapedText, dontResolveAlias); !symbolFromModule && allowSyntheticDefaultImports && "default" === name.escapedText && (symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias)); var symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { var moduleName = getFullyQualifiedName(moduleSymbol), declarationName = ts.declarationNameToString(name), suggestion = getSuggestionForNonexistentModule(name, targetSymbol); void 0 !== suggestion ? error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2, moduleName, declarationName, suggestion) : error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName) } return symbol } } } function getTargetOfImportSpecifier(node, dontResolveAlias) { return getExternalModuleMember(node.parent.parent.parent, node, dontResolveAlias) } function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) { return resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias) } function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : resolveEntityName(node.propertyName || node.name, meaning, !1, dontResolveAlias) } function getTargetOfExportAssignment(node, dontResolveAlias) { var expression = ts.isExportAssignment(node) ? node.expression : node.right; if (ts.isClassExpression(expression)) return checkExpression(expression).symbol; var aliasLike = resolveEntityName(expression, 68009983, !0, dontResolveAlias); return aliasLike ? aliasLike : (checkExpression(expression), getNodeLinks(expression).resolvedSymbol) } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { case 242: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); case 244: return getTargetOfImportClause(node, dontRecursivelyResolve); case 245: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); case 247: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); case 251: return getTargetOfExportSpecifier(node, 68009983, dontRecursivelyResolve); case 248: case 199: return getTargetOfExportAssignment(node, dontRecursivelyResolve); case 241: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve) } } function isNonLocalAlias(symbol, excludes) { return void 0 === excludes && (excludes = 68009983), !!symbol && (2097152 === (symbol.flags & (2097152 | excludes)) || 2097152 & symbol.flags && 67108864 & symbol.flags) } function resolveSymbol(symbol, dontResolveAlias) { var shouldResolve = !dontResolveAlias && isNonLocalAlias(symbol); return shouldResolve ? resolveAlias(symbol) : symbol } function resolveAlias(symbol) { ts.Debug.assert(0 !== (2097152 & symbol.flags), "Should only get Alias here."); var links = getSymbolLinks(symbol); if (links.target) links.target === resolvingSymbol && (links.target = unknownSymbol); else { links.target = resolvingSymbol; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); var target = getTargetOfAliasDeclaration(node); links.target === resolvingSymbol ? links.target = target || unknownSymbol : error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)) } return links.target } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node), target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || 67216319 & target.flags && !isConstEnumOrConstEnumOnlyModule(target); markAlias && markAliasSymbolAsReferenced(symbol) } } function markAliasSymbolAsReferenced(symbol) { var links = getSymbolLinks(symbol); if (!links.referenced) { links.referenced = !0; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node), 248 === node.kind ? checkExpressionCached(node.expression) : 251 === node.kind ? checkExpressionCached(node.propertyName || node.name) : ts.isInternalModuleImportEqualsDeclaration(node) && checkExpressionCached(node.moduleReference) } } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) { return 71 === entityName.kind && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName) && (entityName = entityName.parent), 71 === entityName.kind || 145 === entityName.parent.kind ? resolveEntityName(entityName, 1920, !1, dontResolveAlias) : (ts.Debug.assert(242 === entityName.parent.kind), resolveEntityName(entityName, 68009983, !1, dontResolveAlias)) } function getFullyQualifiedName(symbol) { return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol) } function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) { if (!ts.nodeIsMissing(name)) { var symbol, namespaceMeaning = 1920 | (ts.isInJavaScriptFile(name) ? 67216319 & meaning : 0); if (71 === name.kind) { var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0, symbolFromJSPrototype = ts.isInJavaScriptFile(name) ? resolveEntityNameFromJSSpecialAssignment(name, meaning) : void 0; if (symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? void 0 : message, name, !0), !symbol) return symbolFromJSPrototype } else if (145 === name.kind || 184 === name.kind) { var left = 145 === name.kind ? name.left : name.expression, right = 145 === name.kind ? name.right : name.name, namespace_1 = resolveEntityName(left, namespaceMeaning, ignoreErrors, !1, location); if (!namespace_1 || ts.nodeIsMissing(right)) return; if (namespace_1 === unknownSymbol) return namespace_1; if (ts.isInJavaScriptFile(name)) { var initializer = ts.getDeclaredJavascriptInitializer(namespace_1.valueDeclaration) || ts.getAssignedJavascriptInitializer(namespace_1.valueDeclaration); if (initializer && (namespace_1 = getSymbolOfNode(initializer)), !namespace_1) return; if (namespace_1.valueDeclaration && ts.isVariableDeclaration(namespace_1.valueDeclaration) && namespace_1.valueDeclaration.initializer && isCommonJsRequire(namespace_1.valueDeclaration.initializer)) { var moduleName = namespace_1.valueDeclaration.initializer.arguments[0], moduleSym = resolveExternalModuleName(moduleName, moduleName); if (moduleSym) { var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); resolvedModuleSymbol && (namespace_1 = resolvedModuleSymbol) } } } if (symbol = getSymbol(getExportsOfSymbol(namespace_1), right.escapedText, meaning), !symbol) return void (ignoreErrors || error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(namespace_1), ts.declarationNameToString(right))) } else ts.Debug.assertNever(name, "Unknown entity name kind."); return ts.Debug.assert(0 === (1 & ts.getCheckFlags(symbol)), "Should never get an instantiated symbol here."), symbol.flags & meaning || dontResolveAlias ? symbol : resolveAlias(symbol) } } function resolveEntityNameFromJSSpecialAssignment(name, meaning) { if (isJSDocTypeReference(name.parent)) { var secondaryLocation = getJSSpecialAssignmentLocation(name.parent); if (secondaryLocation) return resolveName(secondaryLocation, name.escapedText, meaning, void 0, name, !0) } } function getJSSpecialAssignmentLocation(node) { var typeAlias = ts.findAncestor(node, function (node) { return ts.isJSDocNode(node) || 2097152 & node.flags ? ts.isJSDocTypeAlias(node) : "quit" }); if (!typeAlias) { var host = ts.getJSDocHost(node); if (ts.isExpressionStatement(host) && ts.isBinaryExpression(host.expression) && 3 === ts.getSpecialPropertyAssignmentKind(host.expression)) { var symbol = getSymbolOfNode(host.expression.left); return symbol && symbol.parent.valueDeclaration } var sig = ts.getHostSignatureFromJSDocHost(host); if (sig) { var symbol = getSymbolOfNode(sig); return symbol && symbol.valueDeclaration } } } function resolveExternalModuleName(location, moduleReferenceExpression) { return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0) } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { return void 0 === isForAugmentation && (isForAugmentation = !1), ts.isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0 } function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) { if (void 0 === isForAugmentation && (isForAugmentation = !1), void 0 !== moduleReference) { if (ts.startsWith(moduleReference, "@types/")) { var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1, withoutAtTypePrefix = ts.removePrefix(moduleReference, "@types/"); error(errorNode, diag, withoutAtTypePrefix, moduleReference) } var ambientModule = tryFindAmbientModule(moduleReference, !0); if (ambientModule) return ambientModule; var currentSourceFile = ts.getSourceFileOfNode(location), resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference), resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule), sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) return sourceFile.symbol ? (resolvedModule.isExternalLibraryImport && !ts.extensionIsTypeScript(resolvedModule.extension) && errorOnImplicitAnyModule(!1, errorNode, resolvedModule, moduleReference), getMergedSymbol(sourceFile.symbol)) : void (moduleNotFoundError && error(errorNode, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName)); if (patternAmbientModules) { var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern }, moduleReference); if (pattern) return getMergedSymbol(pattern.symbol) } if (resolvedModule && !ts.resolutionExtensionIsTypeScriptOrJson(resolvedModule.extension) && void 0 === resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) if (isForAugmentation) { var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName) } else errorOnImplicitAnyModule(noImplicitAny && !!moduleNotFoundError, errorNode, resolvedModule, moduleReference); else if (moduleNotFoundError) { if (ts.pathIsRelative(moduleReference)) { var sourceFile_1 = ts.getSourceFileOfNode(location), redirects = sourceFile_1.redirectedReferences; if (redirects) for (var normalizedTargetPath = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(sourceFile_1.fileName)), _i = 0, _a = [".ts", ".tsx"]; _i < _a.length; _i++) { var ext = _a[_i], probePath = normalizedTargetPath + ext; if (redirects.indexOf(probePath) >= 0) return void error(errorNode, ts.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, moduleReference, probePath) } } if (resolutionDiagnostic) error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); else { var tsExtension = ts.tryExtractTypeScriptExtension(moduleReference); if (tsExtension) { var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead; error(errorNode, diag, tsExtension, ts.removeExtension(moduleReference, tsExtension)) } else error(errorNode, moduleNotFoundError, moduleReference) } } } } function errorOnImplicitAnyModule(isError, errorNode, _a, moduleReference) { var packageId = _a.packageId, resolvedFileName = _a.resolvedFileName, errorInfo = packageId && ts.chainDiagnosticMessages(void 0, ts.Diagnostics.Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, ts.getMangledNameForScopedPackage(packageId.name)); errorOrSuggestion(isError, errorNode, ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedFileName)) } function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias), moduleSymbol)) || moduleSymbol } function getCommonJsExportEquals(exported, moduleSymbol) { if (!exported || 1 === moduleSymbol.exports.size) return exported; var merged = cloneSymbol(exported); return void 0 === merged.exports && (merged.flags = 512 | merged.flags, merged.exports = ts.createSymbolTable()), moduleSymbol.exports.forEach(function (s, name) { if ("export=" !== name) if (merged.exports.has(name)) { var ms = cloneSymbol(merged.exports.get(name)); mergeSymbol(ms, s), merged.exports.set(name, ms) } else merged.exports.set(name, s) }), merged } function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) { var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { if (!(1539 & symbol.flags)) return error(referencingLocation, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)), symbol; if (compilerOptions.esModuleInterop) { var referenceParent = referencingLocation.parent; if (ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent) || ts.isImportCall(referenceParent)) { var type = getTypeOfSymbol(symbol), sigs = getSignaturesOfStructuredType(type, 0); if (sigs && sigs.length || (sigs = getSignaturesOfStructuredType(type, 1)), sigs && sigs.length) { var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol), result = createSymbol(symbol.flags, symbol.escapedName); result.declarations = symbol.declarations ? symbol.declarations.slice() : [], result.parent = symbol.parent, result.target = symbol, result.originatingImport = referenceParent, symbol.valueDeclaration && (result.valueDeclaration = symbol.valueDeclaration), symbol.constEnumOnlyModule && (result.constEnumOnlyModule = !0), symbol.members && (result.members = ts.cloneMap(symbol.members)), symbol.exports && (result.exports = ts.cloneMap(symbol.exports)); var resolvedModuleType = resolveStructuredTypeMembers(moduleType); return result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.stringIndexInfo, resolvedModuleType.numberIndexInfo), result } } } } return symbol } function hasExportAssignmentSymbol(moduleSymbol) { return void 0 !== moduleSymbol.exports.get("export=") } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)) } function getExportsAndPropertiesOfModule(moduleSymbol) { var exports = getExportsOfModuleAsArray(moduleSymbol), exportEquals = resolveExternalModuleSymbol(moduleSymbol); return exportEquals !== moduleSymbol && ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))), exports } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) return symbolTable.get(memberName) } function tryGetMemberInModuleExportsAndProperties(memberName, moduleSymbol) { var symbol = tryGetMemberInModuleExports(memberName, moduleSymbol); if (symbol) return symbol; var exportEquals = resolveExternalModuleSymbol(moduleSymbol); if (exportEquals !== moduleSymbol) { var type = getTypeOfSymbol(exportEquals); return 16382 & type.flags ? void 0 : getPropertyOfType(type, memberName) } } function getExportsOfSymbol(symbol) { return 32 & symbol.flags ? getResolvedMembersOrExportsOfSymbol(symbol, "resolvedExports") : 1536 & symbol.flags ? getExportsOfModule(symbol) : symbol.exports || emptySymbols } function getExportsOfModule(moduleSymbol) { var links = getSymbolLinks(moduleSymbol); return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol)) } function extendExportSymbols(target, source, lookupTable, exportNode) { source && source.forEach(function (sourceSymbol, id) { if ("default" !== id) { var targetSymbol = target.get(id); if (targetSymbol) { if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { var collisionTracker = lookupTable.get(id); collisionTracker.exportsWithDuplicate ? collisionTracker.exportsWithDuplicate.push(exportNode) : collisionTracker.exportsWithDuplicate = [exportNode] } } else target.set(id, sourceSymbol), lookupTable && exportNode && lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) }) } }) } function getExportsOfModuleWorker(moduleSymbol) { function visit(symbol) { if (symbol && 1952 & symbol.flags && ts.pushIfUnique(visitedSymbols, symbol)) { var symbols = ts.cloneMap(symbol.exports), exportStars = symbol.exports.get("__export"); if (exportStars) { for (var nestedSymbols = ts.createSymbolTable(), lookupTable_1 = ts.createMap(), _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i], resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier), exportedSymbols = visit(resolvedModule); extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node) } lookupTable_1.forEach(function (_a, id) { var exportsWithDuplicate = _a.exportsWithDuplicate; if ("export=" !== id && exportsWithDuplicate && exportsWithDuplicate.length && !symbols.has(id)) for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { var node = exportsWithDuplicate_1[_i]; diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, ts.unescapeLeadingUnderscores(id))) } }), extendExportSymbols(symbols, nestedSymbols) } return symbols } } var visitedSymbols = []; return moduleSymbol = resolveExternalModuleSymbol(moduleSymbol), visit(moduleSymbol) || emptySymbols } function getMergedSymbol(symbol) { var merged; return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol } function getSymbolOfNode(node) { return getMergedSymbol(node.symbol && getLateBoundSymbol(node.symbol)) } function getParentOfSymbol(symbol) { return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent)) } function getContainerOfSymbol(symbol) { var container = getParentOfSymbol(symbol); if (container) return container; var candidate = ts.forEach(symbol.declarations, function (d) { return !ts.isAmbientModule(d) && d.parent && hasNonGlobalAugmentationExternalModuleSymbol(d.parent) ? getSymbolOfNode(d.parent) : void 0 }); if (candidate) { var alias = getAliasForSymbolInContainer(candidate, symbol); return alias ? candidate : void 0 } } function getAliasForSymbolInContainer(container, symbol) { function symbolRefersToTarget(s) { if (s === symbol || resolveSymbol(s) === symbol || resolveSymbol(s) === resolveSymbol(symbol)) return s } if (container === getParentOfSymbol(symbol)) return symbol; var exports = getExportsOfSymbol(container), quick = exports.get(symbol.escapedName); return quick && symbolRefersToTarget(quick) ? quick : ts.forEachEntry(exports, function (exported) { if (symbolRefersToTarget(exported)) return exported }) } function getExportSymbolOfValueSymbolIfExported(symbol) { return symbol && 0 !== (1048576 & symbol.flags) ? getMergedSymbol(symbol.exportSymbol) : symbol } function symbolIsValue(symbol) { return !!(67216319 & symbol.flags || 2097152 & symbol.flags && 67216319 & resolveAlias(symbol).flags) } function findConstructorDeclaration(node) { for (var members = node.members, _i = 0, members_2 = members; _i < members_2.length; _i++) { var member = members_2[_i]; if (154 === member.kind && ts.nodeIsPresent(member.body)) return member } } function createType(flags) { var result = new Type(checker, flags); return typeCount++ , result.id = typeCount, result } function createIntrinsicType(kind, intrinsicName) { var type = createType(kind); return type.intrinsicName = intrinsicName, type } function createBooleanType(trueFalseTypes) { var type = getUnionType(trueFalseTypes); return type.flags |= 8, type.intrinsicName = "boolean", type } function createObjectType(objectFlags, symbol) { var type = createType(65536); return type.objectFlags = objectFlags, type.symbol = symbol, type } function createTypeofType() { return getUnionType(ts.arrayFrom(typeofEQFacts.keys(), getLiteralType)) } function isReservedMemberName(name) { return 95 === name.charCodeAt(0) && 95 === name.charCodeAt(1) && 95 !== name.charCodeAt(2) && 64 !== name.charCodeAt(2) } function getNamedMembers(members) { var result; return members.forEach(function (symbol, id) { isReservedMemberName(id) || (result || (result = []), symbolIsValue(symbol) && result.push(symbol)) }), result || ts.emptyArray } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { return type.members = members, type.properties = getNamedMembers(members), type.callSignatures = callSignatures, type.constructSignatures = constructSignatures, stringIndexInfo && (type.stringIndexInfo = stringIndexInfo), numberIndexInfo && (type.numberIndexInfo = numberIndexInfo), type } function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { return setStructuredTypeMembers(createObjectType(16, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) } function forEachSymbolTableInScope(enclosingDeclaration, callback) { for (var result, location = enclosingDeclaration; location; location = location.parent) { if (location.locals && !isGlobalSourceFile(location) && (result = callback(location.locals))) return result; switch (location.kind) { case 273: if (!ts.isExternalOrCommonJsModule(location)) break; case 238: if (result = callback(getSymbolOfNode(location).exports)) return result } } return callback(globals) } function getQualifiedLeftMeaning(rightMeaning) { return 67216319 === rightMeaning ? 67216319 : 1920 } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) { function getAccessibleSymbolChainFromSymbolTable(symbols, ignoreQualification) { if (ts.pushIfUnique(visitedSymbolTables, symbols)) { var result = trySymbolTable(symbols, ignoreQualification); return visitedSymbolTables.pop(), result } } function canQualifySymbol(symbolFromSymbolTable, meaning) { return !needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning) || !!getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing, visitedSymbolTablesMap) } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol, ignoreQualification) { return symbol === (resolvedAliasSymbol || symbolFromSymbolTable) && !ts.some(symbolFromSymbolTable.declarations, hasNonGlobalAugmentationExternalModuleSymbol) && (ignoreQualification || canQualifySymbol(symbolFromSymbolTable, meaning)) } function trySymbolTable(symbols, ignoreQualification) { return isAccessible(symbols.get(symbol.escapedName), void 0, ignoreQualification) ? [symbol] : ts.forEachEntry(symbols, function (symbolFromSymbolTable) { if (2097152 & symbolFromSymbolTable.flags && "export=" !== symbolFromSymbolTable.escapedName && "default" !== symbolFromSymbolTable.escapedName && !(ts.isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && ts.isExternalModule(ts.getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) return [symbolFromSymbolTable]; var candidateTable = getExportsOfSymbol(resolvedImportedSymbol), accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable(candidateTable, !0); if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports) } if (symbolFromSymbolTable.escapedName === symbol.escapedName && symbolFromSymbolTable.exportSymbol && isAccessible(getMergedSymbol(symbolFromSymbolTable.exportSymbol), void 0, ignoreQualification)) return [symbol] }) } if (void 0 === visitedSymbolTablesMap && (visitedSymbolTablesMap = ts.createMap()), symbol && !isPropertyOrMethodDeclarationSymbol(symbol)) { var id = "" + getSymbolId(symbol), visitedSymbolTables = visitedSymbolTablesMap.get(id); return visitedSymbolTables || visitedSymbolTablesMap.set(id, visitedSymbolTables = []), forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable) } } function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = !1; return forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { var symbolFromSymbolTable = getMergedSymbol(symbolTable.get(symbol.escapedName)); return !!symbolFromSymbolTable && (symbolFromSymbolTable === symbol || (symbolFromSymbolTable = 2097152 & symbolFromSymbolTable.flags && !ts.getDeclarationOfKind(symbolFromSymbolTable, 251) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable, !!(symbolFromSymbolTable.flags & meaning) && (qualify = !0, !0))) }), qualify } function isPropertyOrMethodDeclarationSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { case 151: case 153: case 155: case 156: continue; default: return !1 } } return !0 } return !1 } function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) { var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67901928, !1); return 0 === access.accessibility } function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) { var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 67216319, !1); return 0 === access.accessibility } function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) { function getExternalModuleContainer(declaration) { var node = ts.findAncestor(declaration, hasExternalModuleSymbol); return node && getSymbolOfNode(node) } if (symbol && enclosingDeclaration) { for (var initialSymbol = symbol, meaningToLook = meaning; symbol;) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, !1); if (accessibleSymbolChain) { var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible); return hasAccessibleDeclarations ? hasAccessibleDeclarations : { accessibility: 1, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920) : void 0 } } if (ts.some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) return { accessibility: 0 }; meaningToLook = getQualifiedLeftMeaning(meaning), symbol = getContainerOfSymbol(symbol) } var symbolExternalModule = ts.forEach(initialSymbol.declarations, getExternalModuleContainer); if (symbolExternalModule) { var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); if (symbolExternalModule !== enclosingExternalModule) return { accessibility: 2, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), errorModuleName: symbolToString(symbolExternalModule) } } return { accessibility: 1, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) } } return { accessibility: 0 } } function hasExternalModuleSymbol(declaration) { return ts.isAmbientModule(declaration) || 273 === declaration.kind && ts.isExternalOrCommonJsModule(declaration) } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { return ts.isModuleWithStringLiteralName(declaration) || 273 === declaration.kind && ts.isExternalOrCommonJsModule(declaration) } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); return anyImportSyntax && !ts.hasModifier(anyImportSyntax, 1) && isDeclarationVisible(anyImportSyntax.parent) ? addVisibleAlias(declaration, anyImportSyntax) : ts.isVariableDeclaration(declaration) && ts.isVariableStatement(declaration.parent.parent) && !ts.hasModifier(declaration.parent.parent, 1) && isDeclarationVisible(declaration.parent.parent.parent) ? addVisibleAlias(declaration, declaration.parent.parent) : !(!ts.isLateVisibilityPaintedStatement(declaration) || ts.hasModifier(declaration, 1) || !isDeclarationVisible(declaration.parent)) && addVisibleAlias(declaration, declaration) } return !0 } function addVisibleAlias(declaration, aliasingStatement) { return shouldComputeAliasToMakeVisible && (getNodeLinks(declaration).isVisible = !0, aliasesToMakeVisible = ts.appendIfUnique(aliasesToMakeVisible, aliasingStatement)), !0 } var aliasesToMakeVisible; if (!ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration) })) return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible } } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; meaning = 164 === entityName.parent.kind || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) || 146 === entityName.parent.kind ? 68264895 : 145 === entityName.kind || 184 === entityName.kind || 242 === entityName.parent.kind ? 1920 : 67901928; var firstIdentifier = getFirstIdentifier(entityName), symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, void 0, void 0, !1); return symbol && hasVisibleDeclarations(symbol, !0) || { accessibility: 1, errorSymbolName: ts.getTextOfNode(firstIdentifier), errorNode: firstIdentifier } } function symbolToString(symbol, enclosingDeclaration, meaning, flags, writer) { function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags), printer = ts.createPrinter({ removeComments: !0 }), sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); return printer.writeNode(4, entity, sourceFile, writer), writer } void 0 === flags && (flags = 4); var nodeFlags = 3112960; 2 & flags && (nodeFlags |= 128), 1 & flags && (nodeFlags |= 512), 8 & flags && (nodeFlags |= 16384); var builder = 4 & flags ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker) } function signatureToString(signature, enclosingDeclaration, flags, kind, writer) { function signatureToStringWorker(writer) { var sigOutput; sigOutput = 262144 & flags ? 1 === kind ? 163 : 162 : 1 === kind ? 158 : 157; var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, 3112960 | toNodeBuilderFlags(flags) | 512), printer = ts.createPrinter({ removeComments: !0, omitTrailingSemicolon: !0 }), sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); return printer.writeNode(4, sig, sourceFile, writer), writer } return writer ? signatureToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(signatureToStringWorker) } function typeToString(type, enclosingDeclaration, flags, writer) { void 0 === flags && (flags = 1064960), void 0 === writer && (writer = ts.createTextWriter("")); var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, 3112960 | toNodeBuilderFlags(flags), writer); ts.Debug.assert(void 0 !== typeNode, "should always get typenode"); var options = { removeComments: !0 }, printer = ts.createPrinter(options), sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4, typeNode, sourceFile, writer); var result = writer.getText(), maxLength = compilerOptions.noErrorTruncation || 1 & flags ? void 0 : 100; return maxLength && result && result.length >= maxLength ? result.substr(0, maxLength - "...".length) + "..." : result } function toNodeBuilderFlags(flags) { return 9469291 & flags } function createNodeBuilder() { function createNodeBuilderContext(enclosingDeclaration, flags, tracker) { return { enclosingDeclaration: enclosingDeclaration, flags: flags, tracker: tracker && tracker.trackSymbol ? tracker : { trackSymbol: ts.noop }, encounteredError: !1, visitedSymbols: void 0, inferTypeParameters: void 0 } } function typeToTypeNodeHelper(type, context) { function createMappedTypeNodeFromType(type) { ts.Debug.assert(!!(65536 & type.flags)); var appropriateConstraintTypeNode, readonlyToken = type.declaration.readonlyToken ? ts.createToken(type.declaration.readonlyToken.kind) : void 0, questionToken = type.declaration.questionToken ? ts.createToken(type.declaration.questionToken.kind) : void 0; appropriateConstraintTypeNode = isMappedTypeWithKeyofConstraintDeclaration(type) ? ts.createTypeOperatorNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)) : typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); var typeParameterNode = typeParameterToDeclarationWithConstraint(getTypeParameterFromMappedType(type), context, appropriateConstraintTypeNode), templateTypeNode = typeToTypeNodeHelper(getTemplateTypeFromMappedType(type), context), mappedTypeNode = ts.createMappedTypeNode(readonlyToken, typeParameterNode, questionToken, templateTypeNode); return ts.setEmitFlags(mappedTypeNode, 1) } function createAnonymousTypeNode(type) { function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(8192 & symbol.flags) && ts.some(symbol.declarations, function (declaration) { return ts.hasModifier(declaration, 32) }), isNonLocalFunctionSymbol = !!(16 & symbol.flags) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { return 273 === declaration.parent.kind || 239 === declaration.parent.kind })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) return (!!(4096 & context.flags) || context.visitedSymbols && context.visitedSymbols.has(id)) && (!(8 & context.flags) || isValueSymbolAccessible(symbol, context.enclosingDeclaration)) } var id, symbol = type.symbol; if (symbol) { var isConstructorObject = 16 & ts.getObjectFlags(type) && type.symbol && 32 & type.symbol.flags; if (id = (isConstructorObject ? "+" : "") + getSymbolId(symbol), isJavaScriptConstructor(symbol.valueDeclaration)) { var isInstanceType = type === getInferredClassType(symbol) ? 67901928 : 67216319; return symbolToTypeNode(symbol, context, isInstanceType) } if (32 & symbol.flags && !getBaseTypeVariableOfClass(symbol) && !(204 === symbol.valueDeclaration.kind && 2048 & context.flags) || 896 & symbol.flags || shouldWriteTypeOfFunctionSymbol()) return symbolToTypeNode(symbol, context, 67216319); if (context.visitedSymbols && context.visitedSymbols.has(id)) { var typeAlias = getTypeAliasForTypeLiteral(type); return typeAlias ? symbolToTypeNode(typeAlias, context, 67901928) : ts.createKeywordTypeNode(119) } context.visitedSymbols || (context.visitedSymbols = ts.createMap()), context.visitedSymbols.set(id, !0); var result = createTypeNodeFromObjectType(type); return context.visitedSymbols.delete(id), result } return createTypeNodeFromObjectType(type) } function createTypeNodeFromObjectType(type) { if (isGenericMappedType(type)) return createMappedTypeNodeFromType(type); var resolved = resolveStructuredTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) return ts.setEmitFlags(ts.createTypeLiteralNode(void 0), 1); if (1 === resolved.callSignatures.length && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0], signatureNode = signatureToSignatureDeclarationHelper(signature, 162, context); return signatureNode } if (1 === resolved.constructSignatures.length && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0], signatureNode = signatureToSignatureDeclarationHelper(signature, 163, context); return signatureNode } } var savedFlags = context.flags; context.flags |= 4194304; var members = createTypeNodesFromResolvedType(resolved); context.flags = savedFlags; var typeLiteralNode = ts.createTypeLiteralNode(members); return ts.setEmitFlags(typeLiteralNode, 1024 & context.flags ? 0 : 1) } function typeReferenceToTypeNode(type) { var typeArguments = type.typeArguments || ts.emptyArray; if (type.target === globalArrayType) { if (2 & context.flags) { var typeArgumentNode = typeToTypeNodeHelper(typeArguments[0], context); return ts.createTypeReferenceNode("Array", [typeArgumentNode]) } var elementType = typeToTypeNodeHelper(typeArguments[0], context); return ts.createArrayTypeNode(elementType) } if (8 & type.target.objectFlags) { if (typeArguments.length > 0) { var tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, getTypeReferenceArity(type)), context); if (tupleConstituentNodes && tupleConstituentNodes.length > 0) return ts.createTupleTypeNode(tupleConstituentNodes) } return context.encounteredError || 524288 & context.flags ? ts.createTupleTypeNode([]) : void (context.encounteredError = !0) } if (2048 & context.flags && type.symbol.valueDeclaration && ts.isClassLike(type.symbol.valueDeclaration) && !isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) return createAnonymousTypeNode(type); var outerTypeParameters = type.target.outerTypeParameters, i = 0, resultType = void 0; if (outerTypeParameters) for (var length_1 = outerTypeParameters.length; i < length_1;) { var start = i, parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do i++; while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context), flags_2 = context.flags; context.flags |= 16; var ref = symbolToTypeNode(parent, context, 67901928, typeArgumentSlice); context.flags = flags_2, resultType = resultType ? appendReferenceToType(resultType, ref) : ref } } var typeArgumentNodes = void 0; if (typeArguments.length > 0) { var typeParameterCount = (type.target.typeParameters || ts.emptyArray).length; typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context) } var flags = context.flags; context.flags |= 16; var finalRef = symbolToTypeNode(type.symbol, context, 67901928, typeArgumentNodes); return context.flags = flags, resultType ? appendReferenceToType(resultType, finalRef) : finalRef } function appendReferenceToType(root, ref) { if (ts.isImportTypeNode(root)) { var innerParams = root.typeArguments; root.qualifier && ((ts.isIdentifier(root.qualifier) ? root.qualifier : root.qualifier.right).typeArguments = innerParams), root.typeArguments = ref.typeArguments; for (var ids = getAccessStack(ref), _i = 0, ids_1 = ids; _i < ids_1.length; _i++) { var id = ids_1[_i]; root.qualifier = root.qualifier ? ts.createQualifiedName(root.qualifier, id) : id } return root } var innerParams = root.typeArguments; (ts.isIdentifier(root.typeName) ? root.typeName : root.typeName.right).typeArguments = innerParams, root.typeArguments = ref.typeArguments; for (var ids = getAccessStack(ref), _a = 0, ids_2 = ids; _a < ids_2.length; _a++) { var id = ids_2[_a]; root.typeName = ts.createQualifiedName(root.typeName, id) } return root } function getAccessStack(ref) { for (var state = ref.typeName, ids = []; !ts.isIdentifier(state);)ids.unshift(state.right), state = state.left; return ids.unshift(state), ids } function createTypeNodesFromResolvedType(resolvedType) { for (var typeElements = [], _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; typeElements.push(signatureToSignatureDeclarationHelper(signature, 157, context)) } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; typeElements.push(signatureToSignatureDeclarationHelper(signature, 158, context)) } if (resolvedType.stringIndexInfo) { var indexInfo = 2048 & resolvedType.objectFlags ? createIndexInfo(anyType, resolvedType.stringIndexInfo.isReadonly, resolvedType.stringIndexInfo.declaration) : resolvedType.stringIndexInfo; typeElements.push(indexInfoToIndexSignatureDeclarationHelper(indexInfo, 0, context)) } resolvedType.numberIndexInfo && typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.numberIndexInfo, 1, context)); var properties = resolvedType.properties; if (!properties) return typeElements; for (var _d = 0, properties_1 = properties; _d < properties_1.length; _d++) { var propertySymbol = properties_1[_d]; if (2048 & context.flags) { if (4194304 & propertySymbol.flags) continue; 24 & ts.getDeclarationModifierFlagsFromSymbol(propertySymbol) && context.tracker.reportPrivateInBaseOfClassExpression && context.tracker.reportPrivateInBaseOfClassExpression(ts.unescapeLeadingUnderscores(propertySymbol.escapedName)) } var propertyType = 2048 & ts.getCheckFlags(propertySymbol) && 33554432 & context.flags ? anyType : getTypeOfSymbol(propertySymbol), saveEnclosingDeclaration = context.enclosingDeclaration; if (context.enclosingDeclaration = void 0, 1024 & ts.getCheckFlags(propertySymbol)) { var decl = ts.firstOrUndefined(propertySymbol.declarations); if (context.tracker.trackSymbol && hasLateBindableName(decl)) { var firstIdentifier = getFirstIdentifier(decl.name.expression), name = resolveName(firstIdentifier, firstIdentifier.escapedText, 68264895, void 0, void 0, !0); name && context.tracker.trackSymbol(name, saveEnclosingDeclaration, 67216319) } } var propertyName = symbolToName(propertySymbol, context, 67216319, !0); context.enclosingDeclaration = saveEnclosingDeclaration; var optionalToken = 16777216 & propertySymbol.flags ? ts.createToken(55) : void 0; if (8208 & propertySymbol.flags && !getPropertiesOfObjectType(propertyType).length) for (var signatures = getSignaturesOfType(propertyType, 0), _e = 0, signatures_1 = signatures; _e < signatures_1.length; _e++) { var signature = signatures_1[_e], methodDeclaration = signatureToSignatureDeclarationHelper(signature, 152, context); methodDeclaration.name = propertyName, methodDeclaration.questionToken = optionalToken, propertySymbol.valueDeclaration && ts.setCommentRange(methodDeclaration, propertySymbol.valueDeclaration), typeElements.push(methodDeclaration) } else { var savedFlags = context.flags; context.flags |= 2048 & ts.getCheckFlags(propertySymbol) ? 33554432 : 0; var propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(119); context.flags = savedFlags; var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(132)] : void 0, propertySignature = ts.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode, void 0); propertySymbol.valueDeclaration && ts.setCommentRange(propertySignature, propertySymbol.valueDeclaration), typeElements.push(propertySignature) } } return typeElements.length ? typeElements : void 0 } cancellationToken && cancellationToken.throwIfCancellationRequested && cancellationToken.throwIfCancellationRequested(); var inTypeAlias = 8388608 & context.flags; if (context.flags &= -8388609, !type) return void (context.encounteredError = !0); if (1 & type.flags) return ts.createKeywordTypeNode(119); if (2 & type.flags) return ts.createKeywordTypeNode(137); if (4 & type.flags) return ts.createKeywordTypeNode(134); if (8 & type.flags) return ts.createKeywordTypeNode(122); if (256 & type.flags && !(131072 & type.flags)) { var parentSymbol = getParentOfSymbol(type.symbol), parentName = symbolToName(parentSymbol, context, 67901928, !1), enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type ? parentName : ts.createQualifiedName(parentName, ts.symbolName(type.symbol)); return ts.createTypeReferenceNode(enumLiteralName, void 0) } if (272 & type.flags) { var name = symbolToName(type.symbol, context, 67901928, !1); return ts.createTypeReferenceNode(name, void 0) } if (32 & type.flags) return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216)); if (64 & type.flags) return ts.createLiteralTypeNode(ts.createLiteral(type.value)); if (128 & type.flags) return "true" === type.intrinsicName ? ts.createTrue() : ts.createFalse(); if (1024 & type.flags) { if (!(1048576 & context.flags)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) return symbolToTypeNode(type.symbol, context, 67216319); context.tracker.reportInaccessibleUniqueSymbolError && context.tracker.reportInaccessibleUniqueSymbolError() } return ts.createTypeOperatorNode(141, ts.createKeywordTypeNode(138)) } if (2048 & type.flags) return ts.createKeywordTypeNode(105); if (4096 & type.flags) return ts.createKeywordTypeNode(140); if (8192 & type.flags) return ts.createKeywordTypeNode(95); if (16384 & type.flags) return ts.createKeywordTypeNode(131); if (512 & type.flags) return ts.createKeywordTypeNode(138); if (134217728 & type.flags) return ts.createKeywordTypeNode(135); if (32768 & type.flags && type.isThisType) return 4194304 & context.flags && (context.encounteredError || 32768 & context.flags || (context.encounteredError = !0), context.tracker.reportInaccessibleThisError && context.tracker.reportInaccessibleThisError()), ts.createThis(); var objectFlags = ts.getObjectFlags(type); if (4 & objectFlags) return ts.Debug.assert(!!(65536 & type.flags)), typeReferenceToTypeNode(type); if (32768 & type.flags || 3 & objectFlags) return 32768 & type.flags && ts.contains(context.inferTypeParameters, type) ? ts.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, void 0)) : 4 & context.flags && 32768 & type.flags && ts.length(type.symbol.declarations) && ts.isTypeParameterDeclaration(type.symbol.declarations[0]) && typeParameterShadowsNameInScope(type, context) && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? ts.createTypeReferenceNode(ts.getGeneratedNameForNode(type.symbol.declarations[0].name, 24), void 0) : type.symbol ? symbolToTypeNode(type.symbol, context, 67901928) : ts.createTypeReferenceNode(ts.createIdentifier("?"), void 0); if (!inTypeAlias && type.aliasSymbol && (16384 & context.flags || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) { var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); return !isReservedMemberName(type.aliasSymbol.escapedName) || 32 & type.aliasSymbol.flags ? symbolToTypeNode(type.aliasSymbol, context, 67901928, typeArgumentNodes) : ts.createTypeReferenceNode(ts.createIdentifier(""), typeArgumentNodes) } if (393216 & type.flags) { var types = 131072 & type.flags ? formatUnionTypes(type.types) : type.types, typeNodes = mapToTypeNodes(types, context); if (typeNodes && typeNodes.length > 0) { var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(131072 & type.flags ? 168 : 169, typeNodes); return unionOrIntersectionTypeNode } return void (context.encounteredError || 262144 & context.flags || (context.encounteredError = !0)) } if (48 & objectFlags) return ts.Debug.assert(!!(65536 & type.flags)), createAnonymousTypeNode(type); if (524288 & type.flags) { var indexedType = type.type, indexTypeNode = typeToTypeNodeHelper(indexedType, context); return ts.createTypeOperatorNode(indexTypeNode) } if (1048576 & type.flags) { var objectTypeNode = typeToTypeNodeHelper(type.objectType, context), indexTypeNode = typeToTypeNodeHelper(type.indexType, context); return ts.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode) } if (2097152 & type.flags) { var checkTypeNode = typeToTypeNodeHelper(type.checkType, context), saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context); context.inferTypeParameters = saveInferTypeParameters; var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context), falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context); return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode) } return 4194304 & type.flags ? typeToTypeNodeHelper(type.typeVariable, context) : void ts.Debug.fail("Should be unreachable.") } function mapToTypeNodes(types, context) { if (ts.some(types)) { for (var result = [], _i = 0, types_1 = types; _i < types_1.length; _i++) { var type = types_1[_i], typeNode = typeToTypeNodeHelper(type, context); typeNode && result.push(typeNode) } return result } } function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) { var name = ts.getNameFromIndexInfo(indexInfo) || "x", indexerTypeNode = ts.createKeywordTypeNode(0 === kind ? 137 : 134), indexingParameter = ts.createParameter(void 0, void 0, void 0, name, void 0, indexerTypeNode, void 0), typeNode = indexInfo.type ? typeToTypeNodeHelper(indexInfo.type, context) : typeToTypeNodeHelper(anyType, context); return indexInfo.type || 2097152 & context.flags || (context.encounteredError = !0), ts.createIndexSignature(void 0, indexInfo.isReadonly ? [ts.createToken(132)] : void 0, [indexingParameter], typeNode) } function signatureToSignatureDeclarationHelper(signature, kind, context) { var typeParameters, typeArguments; 32 & context.flags && signature.target && signature.mapper && signature.target.typeParameters ? typeArguments = signature.target.typeParameters.map(function (parameter) { return typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context) }) : typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context) }); var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter, context, 154 === kind) }); if (signature.thisParameter) { var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter) } var returnTypeNode, typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var parameterName = 1 === typePredicate.kind ? ts.setEmitFlags(ts.createIdentifier(typePredicate.parameterName), 16777216) : ts.createThisTypeNode(), typeNode = typeToTypeNodeHelper(typePredicate.type, context); returnTypeNode = ts.createTypePredicateNode(parameterName, typeNode) } else { var returnType = getReturnTypeOfSignature(signature); returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context) } return 256 & context.flags ? returnTypeNode && 119 === returnTypeNode.kind && (returnTypeNode = void 0) : returnTypeNode || (returnTypeNode = ts.createKeywordTypeNode(119)), ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments) } function typeParameterShadowsNameInScope(type, context) { return !!resolveName(context.enclosingDeclaration, type.symbol.escapedName, 67901928, void 0, type.symbol.escapedName, !1) } function typeParameterToDeclarationWithConstraint(type, context, constraintNode) { var savedContextFlags = context.flags; context.flags &= -513; var shouldUseGeneratedName = 4 & context.flags && type.symbol.declarations[0] && ts.isTypeParameterDeclaration(type.symbol.declarations[0]) && typeParameterShadowsNameInScope(type, context), name = shouldUseGeneratedName ? ts.getGeneratedNameForNode(type.symbol.declarations[0].name, 24) : symbolToName(type.symbol, context, 67901928, !0), defaultParameter = getDefaultFromTypeParameter(type), defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context); return context.flags = savedContextFlags, ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode) } function typeParameterToDeclaration(type, context, constraint) { void 0 === constraint && (constraint = getConstraintFromTypeParameter(type)); var constraintNode = constraint && typeToTypeNodeHelper(constraint, context); return typeParameterToDeclarationWithConstraint(type, context, constraintNode) } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { function cloneBindingName(node) { function elideInitializerAndSetEmitFlags(node) { var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, void 0, elideInitializerAndSetEmitFlags), clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited); return 181 === clone.kind && (clone.initializer = void 0), ts.setEmitFlags(clone, 16777217) } return elideInitializerAndSetEmitFlags(node) } var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 148); parameterDeclaration || isTransientSymbol(parameterSymbol) || (parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 292)); var parameterType = getTypeOfSymbol(parameterSymbol); parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration) && (parameterType = getOptionalType(parameterType)); var parameterTypeNode = typeToTypeNodeHelper(parameterType, context), modifiers = !(8192 & context.flags) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(ts.getSynthesizedClone), isRest = parameterDeclaration ? ts.isRestParameter(parameterDeclaration) : parameterSymbol.isRestParameter, dotDotDotToken = isRest ? ts.createToken(24) : void 0, name = parameterDeclaration && parameterDeclaration.name ? 71 === parameterDeclaration.name.kind ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216) : 145 === parameterDeclaration.name.kind ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol), questionToken = parameterDeclaration && isOptionalParameter(parameterDeclaration) ? ts.createToken(55) : void 0, parameterNode = ts.createParameter(void 0, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode, void 0); return parameterNode } function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) { function getSymbolChain(symbol, meaning, endOfChain) { var parentSymbol, accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, !!(128 & context.flags)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, 1 === accessibleSymbolChain.length ? meaning : getQualifiedLeftMeaning(meaning))) { var parent = getContainerOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); if (parent) { var parentChain = getSymbolChain(parent, getQualifiedLeftMeaning(meaning), !1); parentChain && (parentSymbol = parent, accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [getAliasForSymbolInContainer(parent, symbol) || symbol])) } } return accessibleSymbolChain ? accessibleSymbolChain : !endOfChain && (!yieldModuleSymbol && !parentSymbol && ts.forEach(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol) || 6144 & symbol.flags) ? void 0 : [symbol] } context.tracker.trackSymbol(symbol, context.enclosingDeclaration, meaning); var chain, isTypeParameter = 262144 & symbol.flags; return !isTypeParameter && (context.enclosingDeclaration || 64 & context.flags) ? (chain = getSymbolChain(symbol, meaning, !0), ts.Debug.assert(chain && chain.length > 0)) : chain = [symbol], chain } function typeParametersToTypeParameterDeclarations(symbol, context) { var typeParameterNodes, targetSymbol = getTargetSymbol(symbol); return 524384 & targetSymbol.flags && (typeParameterNodes = ts.createNodeArray(ts.map(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), function (tp) { return typeParameterToDeclaration(tp, context) }))), typeParameterNodes } function lookupTypeParameterNodes(chain, index, context) { ts.Debug.assert(chain && 0 <= index && index < chain.length); var typeParameterNodes, symbol = chain[index]; if (512 & context.flags && index < chain.length - 1) { var parentSymbol = symbol, nextSymbol = chain[index + 1]; if (1 & ts.getCheckFlags(nextSymbol)) { var params = getTypeParametersOfClassOrInterface(2097152 & parentSymbol.flags ? resolveAlias(parentSymbol) : parentSymbol); typeParameterNodes = mapToTypeNodes(ts.map(params, nextSymbol.mapper), context) } else typeParameterNodes = typeParametersToTypeParameterDeclarations(symbol, context) } return typeParameterNodes } function getTopmostIndexedAccessType(top) { return ts.isIndexedAccessTypeNode(top.objectType) ? getTopmostIndexedAccessType(top.objectType) : top } function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) { function createAccessFromSymbolChain(chain, index, stopper) { var typeParameterNodes = index === chain.length - 1 ? overrideTypeArguments : lookupTypeParameterNodes(chain, index, context), symbol = chain[index]; 0 === index && (context.flags |= 16777216); var symbolName = getNameOfSymbolAsWritten(symbol, context); 0 === index && (context.flags ^= 16777216); var parent = chain[index - 1]; if (!(16 & context.flags) && parent && getMembersOfSymbol(parent) && getMembersOfSymbol(parent).get(symbol.escapedName) === symbol) { var LHS = createAccessFromSymbolChain(chain, index - 1, stopper); return ts.isIndexedAccessTypeNode(LHS) ? ts.createIndexedAccessTypeNode(LHS, ts.createLiteralTypeNode(ts.createLiteral(symbolName))) : ts.createIndexedAccessTypeNode(ts.createTypeReferenceNode(LHS, typeParameterNodes), ts.createLiteralTypeNode(ts.createLiteral(symbolName))) } var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216); if (identifier.symbol = symbol, index > stopper) { var LHS = createAccessFromSymbolChain(chain, index - 1, stopper); return ts.isEntityName(LHS) ? ts.createQualifiedName(LHS, identifier) : ts.Debug.fail("Impossible construct - an export of an indexed access cannot be reachable") } return identifier } var chain = lookupSymbolChain(symbol, context, meaning, !(16384 & context.flags)); context.flags |= 16777216; var rootName = getNameOfSymbolAsWritten(chain[0], context); context.flags ^= 16777216; var isTypeOf = 67216319 === meaning; if (ambientModuleSymbolRegex.test(rootName)) { var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : void 0, typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context), lit = ts.createLiteralTypeNode(ts.createLiteral(rootName.substring(1, rootName.length - 1))); if (!nonRootParts || ts.isEntityName(nonRootParts)) { if (nonRootParts) { var lastId = ts.isIdentifier(nonRootParts) ? nonRootParts : nonRootParts.right; lastId.typeArguments = void 0 } return ts.createImportTypeNode(lit, nonRootParts, typeParameterNodes, isTypeOf) } var splitNode = getTopmostIndexedAccessType(nonRootParts), qualifier = splitNode.objectType.typeName; return ts.createIndexedAccessTypeNode(ts.createImportTypeNode(lit, qualifier, typeParameterNodes, isTypeOf), splitNode.indexType) } var entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0); if (ts.isIndexedAccessTypeNode(entityName)) return entityName; if (isTypeOf) return ts.createTypeQueryNode(entityName); var lastId = ts.isIdentifier(entityName) ? entityName : entityName.right, lastTypeArgs = lastId.typeArguments; return lastId.typeArguments = void 0, ts.createTypeReferenceNode(entityName, lastTypeArgs) } function symbolToName(symbol, context, meaning, expectsIdentifier) { function createEntityNameFromSymbolChain(chain, index) { var typeParameterNodes = lookupTypeParameterNodes(chain, index, context), symbol = chain[index]; 0 === index && (context.flags |= 16777216); var symbolName = getNameOfSymbolAsWritten(symbol, context); 0 === index && (context.flags ^= 16777216); var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216); return identifier.symbol = symbol, index > 0 ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier } var chain = lookupSymbolChain(symbol, context, meaning); return !expectsIdentifier || 1 === chain.length || context.encounteredError || 65536 & context.flags || (context.encounteredError = !0), createEntityNameFromSymbolChain(chain, chain.length - 1) } function symbolToExpression(symbol, context, meaning) { function createExpressionFromSymbolChain(chain, index) { var typeParameterNodes = lookupTypeParameterNodes(chain, index, context), symbol = chain[index]; 0 === index && (context.flags |= 16777216); var symbolName = getNameOfSymbolAsWritten(symbol, context); 0 === index && (context.flags ^= 16777216); var firstChar = symbolName.charCodeAt(0), canUsePropertyAccess = ts.isIdentifierStart(firstChar, languageVersion); if (0 === index || canUsePropertyAccess) { var identifier = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216); return identifier.symbol = symbol, index > 0 ? ts.createPropertyAccess(createExpressionFromSymbolChain(chain, index - 1), identifier) : identifier } 91 === firstChar && (symbolName = symbolName.substring(1, symbolName.length - 1), firstChar = symbolName.charCodeAt(0)); var expression = void 0; return ts.isSingleOrDoubleQuote(firstChar) ? (expression = ts.createLiteral(symbolName.substring(1, symbolName.length - 1).replace(/\\./g, function (s) { return s.substring(1) })), expression.singleQuote = 39 === firstChar) : "" + +symbolName === symbolName && (expression = ts.createLiteral(+symbolName)), expression || (expression = ts.setEmitFlags(ts.createIdentifier(symbolName, typeParameterNodes), 16777216), expression.symbol = symbol), ts.createElementAccess(createExpressionFromSymbolChain(chain, index - 1), expression) } var chain = lookupSymbolChain(symbol, context, meaning); return createExpressionFromSymbolChain(chain, chain.length - 1) } return { typeToTypeNode: function (type, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = typeToTypeNodeHelper(type, context), result = context.encounteredError ? void 0 : resultingNode; return result }, indexInfoToIndexSignatureDeclaration: function (indexInfo, kind, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context), result = context.encounteredError ? void 0 : resultingNode; return result }, signatureToSignatureDeclaration: function (signature, kind, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = signatureToSignatureDeclarationHelper(signature, kind, context), result = context.encounteredError ? void 0 : resultingNode; return result }, symbolToEntityName: function (symbol, meaning, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = symbolToName(symbol, context, meaning, !1), result = context.encounteredError ? void 0 : resultingNode; return result }, symbolToExpression: function (symbol, meaning, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = symbolToExpression(symbol, context, meaning), result = context.encounteredError ? void 0 : resultingNode; return result }, symbolToTypeParameterDeclarations: function (symbol, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = typeParametersToTypeParameterDeclarations(symbol, context), result = context.encounteredError ? void 0 : resultingNode; return result }, symbolToParameterDeclaration: function (symbol, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = symbolToParameterDeclaration(symbol, context), result = context.encounteredError ? void 0 : resultingNode; return result }, typeParameterToDeclaration: function (parameter, enclosingDeclaration, flags, tracker) { ts.Debug.assert(void 0 === enclosingDeclaration || 0 === (8 & enclosingDeclaration.flags)); var context = createNodeBuilderContext(enclosingDeclaration, flags, tracker), resultingNode = typeParameterToDeclaration(parameter, context), result = context.encounteredError ? void 0 : resultingNode; return result } } } function typePredicateToString(typePredicate, enclosingDeclaration, flags, writer) { function typePredicateToStringWorker(writer) { var predicate = ts.createTypePredicateNode(1 === typePredicate.kind ? ts.createIdentifier(typePredicate.parameterName) : ts.createThisTypeNode(), nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, 3112960 | toNodeBuilderFlags(flags) | 512)), printer = ts.createPrinter({ removeComments: !0 }), sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); return printer.writeNode(4, predicate, sourceFile, writer), writer } return void 0 === flags && (flags = 16384), writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker) } function formatUnionTypes(types) { for (var result = [], flags = 0, i = 0; i < types.length; i++) { var t = types[i]; if (flags |= t.flags, !(12288 & t.flags)) { if (384 & t.flags) { var baseType = 128 & t.flags ? booleanType : getBaseTypeOfEnumLiteralType(t); if (131072 & baseType.flags) { var count = baseType.types.length; if (i + count <= types.length && types[i + count - 1] === baseType.types[count - 1]) { result.push(baseType), i += count - 1; continue } } } result.push(t) } } return 8192 & flags && result.push(nullType), 4096 & flags && result.push(undefinedType), result || types } function visibilityToString(flags) { return 8 === flags ? "private" : 16 === flags ? "protected" : "public" } function getTypeAliasForTypeLiteral(type) { if (type.symbol && 2048 & type.symbol.flags) { var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return 172 !== n.kind }); if (236 === node.kind) return getSymbolOfNode(node) } } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && 239 === node.parent.kind && ts.isExternalModuleAugmentation(node.parent.parent) } function isDefaultBindingContext(location) { return 273 === location.kind || ts.isAmbientModule(location) } function getNameOfSymbolAsWritten(symbol, context) { if (context && "default" === symbol.escapedName && !(16384 & context.flags) && (!(16777216 & context.flags) || !symbol.declarations || context.enclosingDeclaration && ts.findAncestor(symbol.declarations[0], isDefaultBindingContext) !== ts.findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) return "default"; if (symbol.declarations && symbol.declarations.length) { if (ts.some(symbol.declarations, hasExternalModuleSymbol) && context.enclosingDeclaration) { var file_3 = ts.getDeclarationOfKind(symbol, 273); if (file_3 && context.tracker.moduleResolverHost) { var contextFile = ts.getSourceFileOfNode(ts.getOriginalNode(context.enclosingDeclaration)); return '"' + (file_3.moduleName || ts.moduleSpecifiers.getModuleSpecifiers(symbol, compilerOptions, contextFile, context.tracker.moduleResolverHost, context.tracker.moduleResolverHost.getSourceFiles(), { importModuleSpecifierPreference: "non-relative" })[0]) + '"' } if (context.tracker.trackReferencedAmbientModule) { var ambientDecls = ts.filter(symbol.declarations, ts.isAmbientModule); if (ts.length(ambientDecls)) for (var _i = 0, ambientDecls_1 = ambientDecls; _i < ambientDecls_1.length; _i++) { var decl = ambientDecls_1[_i]; context.tracker.trackReferencedAmbientModule(decl) } } } var declaration = symbol.declarations[0], name = ts.getNameOfDeclaration(declaration); if (name) return ts.declarationNameToString(name); if (declaration.parent && 231 === declaration.parent.kind) return ts.declarationNameToString(declaration.parent.name); switch (!context || context.encounteredError || 131072 & context.flags || (context.encounteredError = !0), declaration.kind) { case 204: return "(Anonymous class)"; case 191: case 192: return "(Anonymous function)" } } var nameType = symbol.nameType; if (nameType) { if (32 & nameType.flags && !ts.isIdentifierText(nameType.value, compilerOptions.target)) return '"' + ts.escapeString(nameType.value, 34) + '"'; if (nameType && 1024 & nameType.flags) return "[" + getNameOfSymbolAsWritten(nameType.symbol, context) + "]" } return ts.symbolName(symbol) } function isDeclarationVisible(node) { function determineIfDeclarationIsVisible() { switch (node.kind) { case 291: case 296: return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); case 181: return isDeclarationVisible(node.parent.parent); case 231: if (ts.isBindingPattern(node.name) && !node.name.elements.length) return !1; case 238: case 234: case 235: case 236: case 233: case 237: case 242: if (ts.isExternalModuleAugmentation(node)) return !0; var parent = getDeclarationContainer(node); return 1 & ts.getCombinedModifierFlags(node) || 242 !== node.kind && 273 !== parent.kind && 4194304 & parent.flags ? isDeclarationVisible(parent) : isGlobalSourceFile(parent); case 151: case 150: case 155: case 156: case 153: case 152: if (ts.hasModifier(node, 24)) return !1; case 154: case 158: case 157: case 159: case 148: case 239: case 162: case 163: case 165: case 161: case 166: case 167: case 168: case 169: case 172: return isDeclarationVisible(node.parent); case 244: case 245: case 247: return !1; case 147: case 273: case 241: return !0; case 248: return !1; default: return !1 } } if (node) { var links = getNodeLinks(node); return void 0 === links.isVisible && (links.isVisible = !!determineIfDeclarationIsVisible()), links.isVisible } return !1 } function collectLinkedAliases(node, setVisibility) { function buildVisibleNodeList(declarations) { ts.forEach(declarations, function (declaration) { var resultNode = getAnyImportSyntax(declaration) || declaration; if (setVisibility ? getNodeLinks(declaration).isVisible = !0 : (result = result || [], ts.pushIfUnique(result, resultNode)), ts.isInternalModuleImportEqualsDeclaration(declaration)) { var internalModuleReference = declaration.moduleReference, firstIdentifier = getFirstIdentifier(internalModuleReference), importSymbol = resolveName(declaration, firstIdentifier.escapedText, 68009983, void 0, void 0, !1); importSymbol && buildVisibleNodeList(importSymbol.declarations) } }) } var exportSymbol; node.parent && 248 === node.parent.kind ? exportSymbol = resolveName(node, node.escapedText, 70107135, void 0, node, !1) : 251 === node.parent.kind && (exportSymbol = getTargetOfExportSpecifier(node.parent, 70107135)); var result; return exportSymbol && buildVisibleNodeList(exportSymbol.declarations), result } function pushTypeResolution(target, propertyName) { var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); if (resolutionCycleStartIndex >= 0) { for (var length_2 = resolutionTargets.length, i = resolutionCycleStartIndex; i < length_2; i++)resolutionResults[i] = !1; return !1 } return resolutionTargets.push(target), resolutionResults.push(!0), resolutionPropertyNames.push(propertyName), !0 } function findResolutionCycleStartIndex(target, propertyName) { for (var i = resolutionTargets.length - 1; i >= 0; i--) { if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) return -1; if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) return i } return -1 } function hasType(target, propertyName) { if (0 === propertyName) return getSymbolLinks(target).type; if (2 === propertyName) return getSymbolLinks(target).declaredType; if (1 === propertyName) return target.resolvedBaseConstructorType; if (3 === propertyName) return target.resolvedReturnType; if (4 === propertyName) { var bc = target.resolvedBaseConstraint; return bc && bc !== circularConstraintType } ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName) } function popTypeResolution() { return resolutionTargets.pop(), resolutionPropertyNames.pop(), resolutionResults.pop() } function getDeclarationContainer(node) { return node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { case 231: case 232: case 247: case 246: case 245: case 244: return !1; default: return !0 } }), node && node.parent } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType })) : classType } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); return prop ? getTypeOfSymbol(prop) : void 0 } function isTypeAny(type) { return type && 0 !== (1 & type.flags) } function getTypeForBindingElementParent(node) { var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, !1) } function isComputedNonLiteralName(name) { return 146 === name.kind && !ts.isStringOrNumericLiteral(name.expression) } function getRestType(source, properties, symbol) { if (source = filterType(source, function (t) { return !(12288 & t.flags) }), 16384 & source.flags) return emptyObjectType; if (131072 & source.flags) return mapType(source, function (t) { return getRestType(t, properties, symbol) }); for (var members = ts.createSymbolTable(), names = ts.createUnderscoreEscapedMap(), _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { var name = properties_2[_i]; names.set(ts.getTextOfPropertyName(name), !0) } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a], inNamesToRemove = names.has(prop.escapedName), isPrivate = 24 & ts.getDeclarationModifierFlagsFromSymbol(prop), isSetOnlyAccessor = 65536 & prop.flags && !(32768 & prop.flags); inNamesToRemove || isPrivate || isClassMethod(prop) || isSetOnlyAccessor || members.set(prop.escapedName, getNonReadonlySymbol(prop)) } var stringIndexInfo = getIndexInfoOfType(source, 0), numberIndexInfo = getIndexInfoOfType(source, 1); return createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, numberIndexInfo) } function getTypeForBindingElement(declaration) { var pattern = declaration.parent, parentType = getTypeForBindingElementParent(pattern.parent); if (parentType === unknownType) return unknownType; if (!parentType) return declaration.initializer ? checkDeclarationInitializer(declaration) : parentType; if (isTypeAny(parentType)) return parentType; var type; if (179 === pattern.kind) if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) return error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types), unknownType; for (var literalMembers = [], _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; element.dotDotDotToken || literalMembers.push(element.propertyName || element.name) } type = getRestType(parentType, literalMembers, declaration.symbol) } else { var name = declaration.propertyName || declaration.name, isLate = isLateBindableName(name), isWellKnown = ts.isComputedPropertyName(name) && ts.isWellKnownSymbolSyntactically(name.expression); if (!isLate && !isWellKnown && isComputedNonLiteralName(name)) { var exprType = checkExpression(name.expression); if (isTypeAssignableToKind(exprType, 1536)) return noImplicitAny && error(declaration, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(exprType), typeToString(parentType)), anyType; var indexerType = isTypeAssignableToKind(exprType, 84) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); return indexerType || !noImplicitAny || compilerOptions.suppressImplicitAnyIndexErrors || (getIndexTypeOfType(parentType, 1) ? error(declaration, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number) : error(declaration, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(parentType))), indexerType || anyType } var nameType = isLate && checkComputedPropertyName(name), text = isLate ? getLateBoundNameFromType(nameType) : isWellKnown ? ts.getPropertyNameForKnownSymbolName(ts.idText(name.expression.name)) : ts.getTextOfPropertyName(name); if (strictNullChecks && 4194304 & declaration.flags && ts.isParameterDeclaration(declaration) && (parentType = getNonNullableType(parentType)), isLate && nameType && !getPropertyOfType(parentType, text) && isTypeAssignableToKind(nameType, 1536)) return noImplicitAny && error(declaration, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(nameType), typeToString(parentType)), anyType; var declaredType = getConstraintForLocation(getTypeOfPropertyOfType(parentType, text), declaration.name); if (type = declaredType && getFlowTypeOfReference(declaration, declaredType) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0), !type) return error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)), unknownType } else { var elementType = checkIteratedTypeOrElementType(parentType, pattern, !1, !1); if (declaration.dotDotDotToken) type = createArrayType(elementType); else { var propName = "" + pattern.elements.indexOf(declaration); if (type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : elementType, !type) return isTupleType(parentType) ? error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), getTypeReferenceArity(parentType), pattern.elements.length) : error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName), unknownType } } return !strictNullChecks || !declaration.initializer || 4096 & getFalsyFlags(checkExpressionCached(declaration.initializer)) || (type = getTypeWithFacts(type, 131072)), declaration.initializer ? getUnionType([type, checkExpressionCached(declaration.initializer)], 2) : type } function getTypeForDeclarationFromJSDocComment(declaration) { var jsdocType = ts.getJSDocType(declaration); if (jsdocType) return getTypeFromTypeNode(jsdocType) } function isNullOrUndefined(node) { var expr = ts.skipParentheses(node); return 95 === expr.kind || 71 === expr.kind && getResolvedSymbol(expr) === undefinedSymbol } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); return 182 === expr.kind && 0 === expr.elements.length } function addOptionality(type, optional) { return void 0 === optional && (optional = !0), strictNullChecks && optional ? getOptionalType(type) : type } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { if (ts.isVariableDeclaration(declaration) && 220 === declaration.parent.parent.kind) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return 557056 & indexType.flags ? getExtractStringType(indexType) : stringType } if (ts.isVariableDeclaration(declaration) && 221 === declaration.parent.parent.kind) { var forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType } if (ts.isBindingPattern(declaration.parent)) return getTypeForBindingElement(declaration); var isOptional = includeOptionality && (ts.isParameter(declaration) && isJSDocOptionalParameter(declaration) || !ts.isBindingElement(declaration) && !ts.isVariableDeclaration(declaration) && !!declaration.questionToken), declaredType = tryGetTypeFromEffectiveTypeNode(declaration); if (declaredType) return addOptionality(declaredType, isOptional); if ((noImplicitAny || ts.isInJavaScriptFile(declaration)) && 231 === declaration.kind && !ts.isBindingPattern(declaration.name) && !(1 & ts.getCombinedModifierFlags(declaration)) && !(4194304 & declaration.flags)) { if (!(2 & ts.getCombinedNodeFlags(declaration)) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) return autoType; if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) return autoArrayType } if (148 === declaration.kind) { var func = declaration.parent; if (156 === func.kind && !hasNonBindableDynamicName(func)) { var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 155); if (getter) { var getterSignature = getSignatureFromDeclaration(getter), thisParameter = getAccessorThisParameter(func); return thisParameter && declaration === thisParameter ? (ts.Debug.assert(!thisParameter.type), getTypeOfSymbol(getterSignature.thisParameter)) : getReturnTypeOfSignature(getterSignature) } } var type = void 0; if (type = "this" === declaration.symbol.escapedName ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration)) return addOptionality(type, isOptional) } if (declaration.initializer) { var type = checkDeclarationInitializer(declaration); return addOptionality(type, isOptional) } return ts.isJsxAttribute(declaration) ? trueType : ts.isBindingPattern(declaration.name) ? getTypeFromBindingPattern(declaration.name, !1, !0) : void 0 } function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol) { var specialDeclaration = ts.getAssignedJavascriptInitializer(symbol.valueDeclaration); if (specialDeclaration) return getWidenedLiteralType(checkExpressionCached(specialDeclaration)); for (var constructorTypes, jsDocType, types = [], definedInConstructor = !1, definedInMethod = !1, _loop_3 = function (declaration) { var declarationInConstructor = !1, expression = 199 === declaration.kind ? declaration : 184 === declaration.kind ? ts.cast(declaration.parent, ts.isBinaryExpression) : void 0; if (!expression) return { value: unknownType }; var special = ts.getSpecialPropertyAssignmentKind(expression); if (4 === special) { var thisContainer = ts.getThisContainer(expression, !1); declarationInConstructor = 154 === thisContainer.kind || 233 === thisContainer.kind || 191 === thisContainer.kind && !ts.isPrototypePropertyAssignment(thisContainer.parent), declarationInConstructor ? definedInConstructor = !0 : definedInMethod = !0 } var type_1 = getTypeForDeclarationFromJSDocComment(expression.parent); if (type_1) { var declarationType = getWidenedType(type_1); jsDocType ? jsDocType === unknownType || declarationType === unknownType || isTypeIdenticalTo(jsDocType, declarationType) || 67108864 & symbol.flags || errorNextVariableOrPropertyDeclarationMustHaveSameType(jsDocType, declaration, declarationType) : jsDocType = declarationType } else if (!jsDocType) { var type_2 = getWidenedLiteralType(checkExpressionCached(expression.right)); if (16 & ts.getObjectFlags(type_2) && 2 === special && "export=" === symbol.escapedName) { var exportedType_1 = resolveStructuredTypeMembers(type_2), members_3 = ts.createSymbolTable(); ts.copyEntries(exportedType_1.members, members_3), symbol.exports.forEach(function (s, name) { if (members_3.has(name)) { var exportedMember = exportedType_1.members.get(name), union = createSymbol(s.flags | exportedMember.flags, name); union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]), members_3.set(name, union) } else members_3.set(name, s) }), type_2 = createAnonymousType(exportedType_1.symbol, members_3, exportedType_1.callSignatures, exportedType_1.constructSignatures, exportedType_1.stringIndexInfo, exportedType_1.numberIndexInfo) } var anyedType = type_2; isEmptyArrayLiteralType(type_2) && (anyedType = anyArrayType, noImplicitAny && reportImplicitAnyError(expression, anyArrayType)), types.push(anyedType), declarationInConstructor && (constructorTypes || (constructorTypes = [])).push(anyedType) } }, _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i], state_2 = _loop_3(declaration); if ("object" == typeof state_2) return state_2.value } var type = jsDocType; if (!type) { if (definedInMethod) { var propType = getTypeOfSpecialPropertyOfBaseType(symbol); propType && ((constructorTypes || (constructorTypes = [])).push(propType), definedInConstructor = !0) } var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & -16789505) }) ? constructorTypes : types; type = getUnionType(sourceTypes, 2) } var widened = getWidenedType(addOptionality(type, definedInMethod && !definedInConstructor)); return filterType(widened, function (t) { return !!(t.flags & -12289) }) === neverType ? (noImplicitAny && reportImplicitAnyError(symbol.valueDeclaration, anyType), anyType) : widened } function getTypeOfSpecialPropertyOfBaseType(specialProperty) { var parentDeclaration = ts.forEach(specialProperty.declarations, function (d) { var parent = ts.getThisContainer(d, !1).parent; return ts.isClassLike(parent) && parent }); if (parentDeclaration) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(parentDeclaration)), baseClassType = classType && getBaseTypes(classType)[0]; if (baseClassType) return getTypeOfPropertyOfType(baseClassType, specialProperty.escapedName) } } function getTypeFromBindingElement(element, includePatternInType, reportErrors) { return element.initializer ? checkDeclarationInitializer(element) : ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, includePatternInType, reportErrors) : (reportErrors && noImplicitAny && !declarationBelongsToPrivateAmbientMember(element) && reportImplicitAnyError(element, anyType), anyType) } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var stringIndexInfo, members = ts.createSymbolTable(), objectFlags = 128; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; if (isComputedNonLiteralName(name)) return void (objectFlags |= 512); if (e.dotDotDotToken) return void (stringIndexInfo = createIndexInfo(anyType, !1)); var text = ts.getTextOfPropertyName(name), flags = 4 | (e.initializer ? 16777216 : 0), symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors), symbol.bindingElement = e, members.set(symbol.escapedName, symbol) }); var result = createAnonymousType(void 0, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, void 0); return result.flags |= 33554432, result.objectFlags |= objectFlags, includePatternInType && (result.pattern = pattern), result } function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements, lastElement = ts.lastOrUndefined(elements); if (0 === elements.length || !ts.isOmittedExpression(lastElement) && lastElement.dotDotDotToken) return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; var elementTypes = ts.map(elements, function (e) { return ts.isOmittedExpression(e) ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors) }), result = createTupleType(elementTypes); return includePatternInType && (result = cloneTypeReference(result), result.pattern = pattern), result } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { return 179 === pattern.kind ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration, !0); return type ? (reportErrors && reportErrorsFromWidening(declaration, type), 1024 & type.flags && (ts.isBindingElement(declaration) || !declaration.type) && type.symbol !== getSymbolOfNode(declaration) && (type = esSymbolType), getWidenedType(type)) : (type = ts.isParameter(declaration) && declaration.dotDotDotToken ? anyArrayType : anyType, reportErrors && noImplicitAny && (declarationBelongsToPrivateAmbientMember(declaration) || reportImplicitAnyError(declaration, type)), type) } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration), memberDeclaration = 148 === root.kind ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration) } function tryGetTypeFromEffectiveTypeNode(declaration) { var typeNode = ts.getEffectiveTypeAnnotationNode(declaration); if (typeNode) return getTypeFromTypeNode(typeNode) } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { if (4194304 & symbol.flags) return links.type = getTypeOfPrototypeProperty(symbol); if (symbol === requireSymbol || symbol === moduleSymbol) return links.type = anyType; var declaration = symbol.valueDeclaration; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) return links.type = anyType; if (ts.isSourceFile(declaration)) { var jsonSourceFile = ts.cast(declaration, ts.isJsonSourceFile); return links.type = jsonSourceFile.statements.length ? checkExpression(jsonSourceFile.statements[0].expression) : emptyObjectType } if (248 === declaration.kind) return links.type = checkExpression(declaration.expression); if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) return links.type = getTypeFromTypeNode(declaration.typeExpression.type); if (!pushTypeResolution(symbol, 0)) return unknownType; var type = void 0; if (199 === declaration.kind || 184 === declaration.kind && 199 === declaration.parent.kind) type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); else if (ts.isJSDocPropertyLikeTag(declaration) || ts.isPropertyAccessExpression(declaration) || ts.isIdentifier(declaration) || ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration) || ts.isMethodSignature(declaration)) { if (9136 & symbol.flags) return getTypeOfFuncClassEnumModule(symbol); type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType } else ts.isPropertyAssignment(declaration) ? type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration) : ts.isJsxAttribute(declaration) ? type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration) : ts.isShorthandPropertyAssignment(declaration) ? type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation(declaration.name, 0) : ts.isObjectLiteralMethod(declaration) ? type = tryGetTypeFromEffectiveTypeNode(declaration) || checkObjectLiteralMethod(declaration, 0) : ts.isParameter(declaration) || ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration) || ts.isVariableDeclaration(declaration) || ts.isBindingElement(declaration) ? type = getWidenedTypeForVariableLikeDeclaration(declaration, !0) : ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration)); popTypeResolution() || (type = reportCircularityError(symbol)), links.type = type } return links.type } function getAnnotatedAccessorType(accessor) { if (accessor) { if (155 === accessor.kind) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); return getterTypeAnnotation && getTypeFromTypeNode(getterTypeAnnotation) } var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation) } } function getAnnotatedAccessorThisParameter(accessor) { var parameter = getAccessorThisParameter(accessor); return parameter && parameter.symbol } function getThisTypeOfDeclaration(declaration) { return getThisTypeOfSignature(getSignatureFromDeclaration(declaration)) } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { var getter = ts.getDeclarationOfKind(symbol, 155), setter = ts.getDeclarationOfKind(symbol, 156); if (getter && ts.isInJavaScriptFile(getter)) { var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) return links.type = jsDocType } if (!pushTypeResolution(symbol, 0)) return unknownType; var type = void 0, getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) type = getterReturnType; else { var setterParameterType = getAnnotatedAccessorType(setter); setterParameterType ? type = setterParameterType : getter && getter.body ? type = getReturnTypeFromBody(getter) : (noImplicitAny && (setter ? error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)) : (ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function"), error(getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)))), type = anyType) } if (!popTypeResolution() && (type = anyType, noImplicitAny)) { var getter_1 = ts.getDeclarationOfKind(symbol, 155); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)) } links.type = type } return links.type } function getBaseTypeVariableOfClass(symbol) { var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); return 1081344 & baseConstructorType.flags ? baseConstructorType : void 0 } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) if (1536 & symbol.flags && ts.isShorthandAmbientModuleSymbol(symbol)) links.type = anyType; else if (199 === symbol.valueDeclaration.kind || 184 === symbol.valueDeclaration.kind && 199 === symbol.valueDeclaration.parent.kind) links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); else { var type = createObjectType(16, symbol); if (32 & symbol.flags) { var baseTypeVariable = getBaseTypeVariableOfClass(symbol); links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type } else links.type = strictNullChecks && 16777216 & symbol.flags ? getOptionalType(type) : type } return links.type } function getTypeOfEnumMember(symbol) { var links = getSymbolLinks(symbol); return links.type || (links.type = getDeclaredTypeOfEnumMember(symbol)), links.type } function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { var targetSymbol = resolveAlias(symbol); links.type = 67216319 & targetSymbol.flags ? getTypeOfSymbol(targetSymbol) : unknownType } return links.type } function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) if (100 === symbolInstantiationDepth) error(symbol.valueDeclaration, ts.Diagnostics.Generic_type_instantiation_is_excessively_deep_and_possibly_infinite), links.type = unknownType; else { if (!pushTypeResolution(symbol, 0)) return unknownType; symbolInstantiationDepth++; var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); symbolInstantiationDepth-- , popTypeResolution() || (type = reportCircularityError(symbol)), links.type = type } return links.type } function reportCircularityError(symbol) { return ts.getEffectiveTypeAnnotationNode(symbol.valueDeclaration) ? (error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)), unknownType) : (noImplicitAny && error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)), anyType) } function getTypeOfSymbol(symbol) { return 1 & ts.getCheckFlags(symbol) ? getTypeOfInstantiatedSymbol(symbol) : 2048 & ts.getCheckFlags(symbol) ? getTypeOfReverseMappedSymbol(symbol) : 7 & symbol.flags ? getTypeOfVariableOrParameterOrProperty(symbol) : 9136 & symbol.flags ? getTypeOfFuncClassEnumModule(symbol) : 8 & symbol.flags ? getTypeOfEnumMember(symbol) : 98304 & symbol.flags ? getTypeOfAccessors(symbol) : 2097152 & symbol.flags ? getTypeOfAlias(symbol) : unknownType } function isReferenceToType(type, target) { return void 0 !== type && void 0 !== target && 0 !== (4 & ts.getObjectFlags(type)) && type.target === target } function getTargetType(type) { return 4 & ts.getObjectFlags(type) ? type.target : type } function hasBaseType(type, checkBase) { function check(type) { if (7 & ts.getObjectFlags(type)) { var target = getTargetType(type); return target === checkBase || ts.forEach(getBaseTypes(target), check) } if (262144 & type.flags) return ts.forEach(type.types, check) } return check(type) } function appendTypeParameters(typeParameters, declarations) { for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { var declaration = declarations_2[_i]; typeParameters = ts.appendIfUnique(typeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration))) } return typeParameters } function getOuterTypeParameters(node, includeThisTypes) { for (; ;) { if (node = node.parent, !node) return; switch (node.kind) { case 234: case 204: case 235: case 157: case 158: case 152: case 162: case 163: case 283: case 233: case 153: case 191: case 192: case 236: case 295: case 296: case 291: case 176: case 170: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); if (176 === node.kind) return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); if (170 === node.kind) return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)), thisType = includeThisTypes && (234 === node.kind || 204 === node.kind || 235 === node.kind) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters } } } function getOuterTypeParametersOfClassOrInterface(symbol) { var declaration = 32 & symbol.flags ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 235); return getOuterTypeParameters(declaration) } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { for (var result, _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; if (235 === node.kind || 234 === node.kind || 204 === node.kind || ts.isTypeAlias(node)) { var declaration = node; result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration)) } } return result } function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)) } function isMixinConstructorType(type) { var signatures = getSignaturesOfType(type, 1); if (1 === signatures.length) { var s = signatures[0]; return !s.typeParameters && 1 === s.parameters.length && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType } return !1 } function isConstructorType(type) { if (isValidBaseType(type) && getSignaturesOfType(type, 1).length > 0) return !0; if (1081344 & type.flags) { var constraint = getBaseConstraintOfType(type); return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint) } return !1 } function getBaseTypeNodeOfClass(type) { var decl = type.symbol.valueDeclaration; if (ts.isInJavaScriptFile(decl)) { var tag = ts.getJSDocAugmentsTag(decl); if (tag) return tag.class } return ts.getClassExtendsHeritageClauseElement(decl) } function getConstructorsForTypeArguments(type, typeArgumentNodes, location) { var typeArgCount = ts.length(typeArgumentNodes), isJavaScript = ts.isInJavaScriptFile(location); return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (isJavaScript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts.length(sig.typeParameters) }) } function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) { var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location), typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); return ts.sameMap(signatures, function (sig) { return ts.some(sig.typeParameters) ? getSignatureInstantiation(sig, typeArguments, ts.isInJavaScriptFile(location)) : sig }) } function getBaseConstructorTypeOfClass(type) { if (!type.resolvedBaseConstructorType) { var decl = type.symbol.valueDeclaration, extended = ts.getClassExtendsHeritageClauseElement(decl), baseTypeNode = getBaseTypeNodeOfClass(type); if (!baseTypeNode) return type.resolvedBaseConstructorType = undefinedType; if (!pushTypeResolution(type, 1)) return unknownType; var baseConstructorType = checkExpression(baseTypeNode.expression); if (extended && baseTypeNode !== extended && (ts.Debug.assert(!extended.typeArguments), checkExpression(extended.expression)), 327680 & baseConstructorType.flags && resolveStructuredTypeMembers(baseConstructorType), !popTypeResolution()) return error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)), type.resolvedBaseConstructorType = unknownType; if (!(1 & baseConstructorType.flags || baseConstructorType === nullWideningType || isConstructorType(baseConstructorType))) return error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)), type.resolvedBaseConstructorType = unknownType; type.resolvedBaseConstructorType = baseConstructorType } return type.resolvedBaseConstructorType } function getBaseTypes(type) { return type.resolvedBaseTypes || (8 & type.objectFlags ? type.resolvedBaseTypes = [createArrayType(getUnionType(type.typeParameters))] : 96 & type.symbol.flags ? (32 & type.symbol.flags && resolveBaseTypesOfClass(type), 64 & type.symbol.flags && resolveBaseTypesOfInterface(type)) : ts.Debug.fail("type must be class or interface")), type.resolvedBaseTypes } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = ts.resolvingEmptyArray; var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); if (!(327681 & baseConstructorType.flags)) return type.resolvedBaseTypes = ts.emptyArray; var baseType, baseTypeNode = getBaseTypeNodeOfClass(type), typeArgs = typeArgumentsFromTypeReferenceNode(baseTypeNode), originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : void 0; if (baseConstructorType.symbol && 32 & baseConstructorType.symbol.flags && areAllOuterTypeParametersApplied(originalBaseType)) baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol, typeArgs); else if (1 & baseConstructorType.flags) baseType = baseConstructorType; else { var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); if (!constructors.length) return error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments), type.resolvedBaseTypes = ts.emptyArray; baseType = getReturnTypeOfSignature(constructors[0]) } return baseType === unknownType ? type.resolvedBaseTypes = ts.emptyArray : isValidBaseType(baseType) ? type === baseType || hasBaseType(baseType, type) ? (error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, void 0, 2)), type.resolvedBaseTypes = ts.emptyArray) : (type.resolvedBaseTypes === ts.resolvingEmptyArray && (type.members = void 0), type.resolvedBaseTypes = [baseType]) : (error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)), type.resolvedBaseTypes = ts.emptyArray) } function areAllOuterTypeParametersApplied(type) { var outerTypeParameters = type.outerTypeParameters; if (outerTypeParameters) { var last_1 = outerTypeParameters.length - 1, typeArguments = type.typeArguments; return outerTypeParameters[last_1].symbol !== typeArguments[last_1].symbol } return !0 } function isValidBaseType(type) { return 134283265 & type.flags && !isGenericMappedType(type) || 262144 & type.flags && !ts.forEach(type.types, function (t) { return !isValidBaseType(t) }) } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (235 === declaration.kind && ts.getInterfaceBaseTypeNodes(declaration)) for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b], baseType = getTypeFromTypeNode(node); baseType !== unknownType && (isValidBaseType(baseType) ? type === baseType || hasBaseType(baseType, type) ? error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, void 0, 2)) : type.resolvedBaseTypes === ts.emptyArray ? type.resolvedBaseTypes = [baseType] : type.resolvedBaseTypes.push(baseType) : error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface)) } } } function isThislessInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (235 === declaration.kind) { if (64 & declaration.flags) return !1; var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); if (baseTypeNodes) for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) { var node = baseTypeNodes_1[_b]; if (ts.isEntityNameExpression(node.expression)) { var baseSymbol = resolveEntityName(node.expression, 67901928, !0); if (!baseSymbol || !(64 & baseSymbol.flags) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) return !1 } } } } return !0 } function getDeclaredTypeOfClassOrInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { var kind = 32 & symbol.flags ? 1 : 2, type = links.declaredType = createObjectType(kind, symbol), outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol), localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); (outerTypeParameters || localTypeParameters || 1 === kind || !isThislessInterface(symbol)) && (type.objectFlags |= 4, type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters), type.outerTypeParameters = outerTypeParameters, type.localTypeParameters = localTypeParameters, type.instantiations = ts.createMap(), type.instantiations.set(getTypeListId(type.typeParameters), type), type.target = type, type.typeArguments = type.typeParameters, type.thisType = createType(32768), type.thisType.isThisType = !0, type.thisType.symbol = symbol, type.thisType.constraint = type) } return links.declaredType } function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { if (!pushTypeResolution(symbol, 2)) return unknownType; var declaration = ts.find(symbol.declarations, function (d) { return ts.isJSDocTypeAlias(d) || 236 === d.kind }), typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type, type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); typeParameters && (links.typeParameters = typeParameters, links.instantiations = ts.createMap(), links.instantiations.set(getTypeListId(typeParameters), type)) } else type = unknownType, error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); links.declaredType = type } return links.declaredType } function isStringConcatExpression(expr) { return 9 === expr.kind || 199 === expr.kind && (isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right)) } function isLiteralEnumMember(member) { var expr = member.initializer; if (!expr) return !(4194304 & member.flags); switch (expr.kind) { case 9: case 8: return !0; case 197: return 38 === expr.operator && 8 === expr.operand.kind; case 71: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); case 199: return isStringConcatExpression(expr); default: return !1 } } function getEnumKind(symbol) { var links = getSymbolLinks(symbol); if (void 0 !== links.enumKind) return links.enumKind; for (var hasNonLiteralMember = !1, _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (237 === declaration.kind) for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && 9 === member.initializer.kind) return links.enumKind = 1; isLiteralEnumMember(member) || (hasNonLiteralMember = !0) } } return links.enumKind = hasNonLiteralMember ? 0 : 1 } function getBaseTypeOfEnumLiteralType(type) { return 256 & type.flags && !(131072 & type.flags) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type } function getDeclaredTypeOfEnum(symbol) { var links = getSymbolLinks(symbol); if (links.declaredType) return links.declaredType; if (1 === getEnumKind(symbol)) { enumCount++; for (var memberTypeList = [], _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (237 === declaration.kind) for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b], memberType = getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member)); getSymbolLinks(getSymbolOfNode(member)).declaredType = memberType, memberTypeList.push(memberType) } } if (memberTypeList.length) { var enumType_1 = getUnionType(memberTypeList, 1, symbol, void 0); return 131072 & enumType_1.flags && (enumType_1.flags |= 256, enumType_1.symbol = symbol), links.declaredType = enumType_1 } } var enumType = createType(16); return enumType.symbol = symbol, links.declaredType = enumType } function getDeclaredTypeOfEnumMember(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { var enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); links.declaredType || (links.declaredType = enumType) } return links.declaredType } function getDeclaredTypeOfTypeParameter(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { var type = createType(32768); type.symbol = symbol, links.declaredType = type } return links.declaredType } function getDeclaredTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); return links.declaredType || (links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol))), links.declaredType } function getDeclaredTypeOfSymbol(symbol) { return tryGetDeclaredTypeOfSymbol(symbol) || unknownType } function tryGetDeclaredTypeOfSymbol(symbol) { return 96 & symbol.flags ? getDeclaredTypeOfClassOrInterface(symbol) : 524288 & symbol.flags ? getDeclaredTypeOfTypeAlias(symbol) : 262144 & symbol.flags ? getDeclaredTypeOfTypeParameter(symbol) : 384 & symbol.flags ? getDeclaredTypeOfEnum(symbol) : 8 & symbol.flags ? getDeclaredTypeOfEnumMember(symbol) : 2097152 & symbol.flags ? getDeclaredTypeOfAlias(symbol) : void 0 } function isThislessType(node) { switch (node.kind) { case 119: case 137: case 134: case 122: case 138: case 135: case 105: case 140: case 95: case 131: case 177: return !0; case 166: return isThislessType(node.elementType); case 161: return !node.typeArguments || node.typeArguments.every(isThislessType) }return !1 } function isThislessTypeParameter(node) { return !node.constraint || isThislessType(node.constraint) } function isThislessVariableLikeDeclaration(node) { var typeNode = ts.getEffectiveTypeAnnotationNode(node); return typeNode ? isThislessType(typeNode) : !ts.hasInitializer(node) } function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node), typeParameters = ts.getEffectiveTypeParameterDeclarations(node); return (154 === node.kind || returnType && isThislessType(returnType)) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter) } function isThisless(symbol) { if (symbol.declarations && 1 === symbol.declarations.length) { var declaration = symbol.declarations[0]; if (declaration) switch (declaration.kind) { case 151: case 150: return isThislessVariableLikeDeclaration(declaration); case 153: case 152: case 154: return isThislessFunctionLikeDeclaration(declaration) } } return !1 } function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { for (var result = ts.createSymbolTable(), _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; result.set(symbol.escapedName, mappingThisOnly && isThisless(symbol) ? symbol : instantiateSymbol(symbol, mapper)) } return result } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; symbols.has(s.escapedName) || symbols.set(s.escapedName, s) } } function resolveDeclaredMembers(type) { if (!type.declaredProperties) { var symbol = type.symbol, members = getMembersOfSymbol(symbol); type.declaredProperties = getNamedMembers(members), type.declaredCallSignatures = ts.emptyArray, type.declaredConstructSignatures = ts.emptyArray, type.declaredCallSignatures = getSignaturesOfSymbol(members.get("__call")), type.declaredConstructSignatures = getSignaturesOfSymbol(members.get("__new")), type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0), type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1) } return type } function isTypeUsableAsLateBoundName(type) { return !!(1120 & type.flags) } function isLateBindableName(node) { return ts.isComputedPropertyName(node) && ts.isEntityNameExpression(node.expression) && isTypeUsableAsLateBoundName(checkComputedPropertyName(node)) } function hasLateBindableName(node) { var name = ts.getNameOfDeclaration(node); return name && isLateBindableName(name) } function hasNonBindableDynamicName(node) { return ts.hasDynamicName(node) && !hasLateBindableName(node) } function isNonBindableDynamicName(node) { return ts.isDynamicName(node) && !isLateBindableName(node) } function getLateBoundNameFromType(type) { return 1024 & type.flags ? "__@" + type.symbol.escapedName + "@" + getSymbolId(type.symbol) : 96 & type.flags ? ts.escapeLeadingUnderscores("" + type.value) : void 0 } function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) { if (ts.Debug.assert(!!(1024 & ts.getCheckFlags(symbol)), "Expected a late-bound symbol."), symbol.flags |= symbolFlags, getSymbolLinks(member.symbol).lateSymbol = symbol, symbol.declarations ? symbol.declarations.push(member) : symbol.declarations = [member], 67216319 & symbolFlags) { var valueDeclaration = symbol.valueDeclaration; valueDeclaration && valueDeclaration.kind === member.kind || (symbol.valueDeclaration = member) } } function lateBindMember(parent, earlySymbols, lateSymbols, decl) { ts.Debug.assert(!!decl.symbol, "The member is expected to have a symbol."); var links = getNodeLinks(decl); if (!links.resolvedSymbol) { links.resolvedSymbol = decl.symbol; var type = checkComputedPropertyName(decl.name); if (isTypeUsableAsLateBoundName(type)) { var memberName = getLateBoundNameFromType(type), symbolFlags = decl.symbol.flags, lateSymbol = lateSymbols.get(memberName); lateSymbol || lateSymbols.set(memberName, lateSymbol = createSymbol(0, memberName, 1024)); var earlySymbol = earlySymbols && earlySymbols.get(memberName); if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) { var declarations = earlySymbol ? ts.concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations, name_2 = ts.declarationNameToString(decl.name); ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_declaration_0, name_2) }), error(decl.name || decl, ts.Diagnostics.Duplicate_declaration_0, name_2), lateSymbol = createSymbol(0, memberName, 1024) } return lateSymbol.nameType = type, addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags), lateSymbol.parent ? ts.Debug.assert(lateSymbol.parent === parent, "Existing symbol parent should match new one") : lateSymbol.parent = parent, links.resolvedSymbol = lateSymbol } } return links.resolvedSymbol } function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) { var links = getSymbolLinks(symbol); if (!links[resolutionKind]) { var isStatic = "resolvedExports" === resolutionKind, earlySymbols = isStatic ? 1536 & symbol.flags ? getExportsOfModuleWorker(symbol) : symbol.exports : symbol.members; links[resolutionKind] = earlySymbols || emptySymbols; for (var lateSymbols = ts.createSymbolTable(), _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i], members = ts.getMembersOfDeclaration(decl); if (members) for (var _b = 0, members_4 = members; _b < members_4.length; _b++) { var member = members_4[_b]; isStatic === ts.hasStaticModifier(member) && hasLateBindableName(member) && lateBindMember(symbol, earlySymbols, lateSymbols, member) } } links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols } return links[resolutionKind] } function getMembersOfSymbol(symbol) { return 6240 & symbol.flags ? getResolvedMembersOrExportsOfSymbol(symbol, "resolvedMembers") : symbol.members || emptySymbols } function getLateBoundSymbol(symbol) { if (106500 & symbol.flags && "__computed" === symbol.escapedName) { var links = getSymbolLinks(symbol); return !links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName) && (ts.some(symbol.declarations, ts.hasStaticModifier) ? getExportsOfSymbol(symbol.parent) : getMembersOfSymbol(symbol.parent)), links.lateSymbol || (links.lateSymbol = symbol) } return symbol } function getTypeWithThisArgument(type, thisArgument, needApparentType) { if (4 & ts.getObjectFlags(type)) { var target = type.target, typeArguments = type.typeArguments; if (ts.length(target.typeParameters) === ts.length(typeArguments)) { var ref = createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); return needApparentType ? getApparentType(ref) : ref } } else if (262144 & type.flags) return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument, needApparentType) })); return needApparentType ? getApparentType(type) : type } function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { var mapper, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo; ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length) ? (mapper = identityMapper, members = source.symbol ? getMembersOfSymbol(source.symbol) : ts.createSymbolTable(source.declaredProperties), callSignatures = source.declaredCallSignatures, constructSignatures = source.declaredConstructSignatures, stringIndexInfo = source.declaredStringIndexInfo, numberIndexInfo = source.declaredNumberIndexInfo) : (mapper = createTypeMapper(typeParameters, typeArguments), members = createInstantiatedSymbolTable(source.declaredProperties, mapper, 1 === typeParameters.length), callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper), constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper), stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper), numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper)); var baseTypes = getBaseTypes(source); if (baseTypes.length) { source.symbol && members === getMembersOfSymbol(source.symbol) && (members = ts.createSymbolTable(source.declaredProperties)), setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); for (var thisArgument = ts.lastOrUndefined(typeArguments), _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i], instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)), callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)), constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)), stringIndexInfo || (stringIndexInfo = instantiatedBaseType === anyType ? createIndexInfo(anyType, !1) : getIndexInfoOfType(instantiatedBaseType, 0)), numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1) } } setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) } function resolveClassOrInterfaceMembers(type) { resolveObjectTypeMembers(type, resolveDeclaredMembers(type), ts.emptyArray, ts.emptyArray) } function resolveTypeReferenceMembers(type) { var source = resolveDeclaredMembers(type.target), typeParameters = ts.concatenate(source.typeParameters, [source.thisType]), typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ? type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments) } function createSignature(declaration, typeParameters, thisParameter, parameters, resolvedReturnType, resolvedTypePredicate, minArgumentCount, hasRestParameter, hasLiteralTypes) { var sig = new Signature(checker); return sig.declaration = declaration, sig.typeParameters = typeParameters, sig.parameters = parameters, sig.thisParameter = thisParameter, sig.resolvedReturnType = resolvedReturnType, sig.resolvedTypePredicate = resolvedTypePredicate, sig.minArgumentCount = minArgumentCount, sig.hasRestParameter = hasRestParameter, sig.hasLiteralTypes = hasLiteralTypes, sig.target = void 0, sig.mapper = void 0, sig } function cloneSignature(sig) { return createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, void 0, void 0, sig.minArgumentCount, sig.hasRestParameter, sig.hasLiteralTypes) } function getDefaultConstructSignatures(classType) { var baseConstructorType = getBaseConstructorTypeOfClass(classType), baseSignatures = getSignaturesOfType(baseConstructorType, 1); if (0 === baseSignatures.length) return [createSignature(void 0, classType.localTypeParameters, void 0, ts.emptyArray, classType, void 0, 0, !1, !1)]; for (var baseTypeNode = getBaseTypeNodeOfClass(classType), isJavaScript = ts.isInJavaScriptFile(baseTypeNode), typeArguments = typeArgumentsFromTypeReferenceNode(baseTypeNode), typeArgCount = ts.length(typeArguments), result = [], _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { var baseSig = baseSignatures_1[_i], minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters), typeParamCount = ts.length(baseSig.typeParameters); if (isJavaScript || typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount) { var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, isJavaScript)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters, sig.resolvedReturnType = classType, result.push(sig) } } return result } function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) return s } } function findMatchingSignatures(signatureLists, signature, listIndex) { if (signature.typeParameters) { if (listIndex > 0) return; for (var i = 1; i < signatureLists.length; i++)if (!findMatchingSignature(signatureLists[i], signature, !1, !1, !1)) return; return [signature] } for (var result, i = 0; i < signatureLists.length; i++) { var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, !0, !0, !0); if (!match) return; result = ts.appendIfUnique(result, match) } return result } function getUnionSignatures(types, kind) { for (var result, signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind) }), i = 0; i < signatureLists.length; i++)for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; if (!result || !findMatchingSignature(result, signature, !1, !0, !0)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; if (unionSignatures.length > 1) { var thisParameter = signature.thisParameter; if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter })) { var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType }), 2); thisParameter = createSymbolWithType(signature.thisParameter, thisType) } s = cloneSignature(signature), s.thisParameter = thisParameter, s.unionSignatures = unionSignatures } (result || (result = [])).push(s) } } } return result || ts.emptyArray } function getUnionIndexInfo(types, kind) { for (var indexTypes = [], isAnyReadonly = !1, _i = 0, types_2 = types; _i < types_2.length; _i++) { var type = types_2[_i], indexInfo = getIndexInfoOfType(type, kind); if (!indexInfo) return; indexTypes.push(indexInfo.type), isAnyReadonly = isAnyReadonly || indexInfo.isReadonly } return createIndexInfo(getUnionType(indexTypes, 2), isAnyReadonly) } function resolveUnionTypeMembers(type) { var callSignatures = getUnionSignatures(type.types, 0), constructSignatures = getUnionSignatures(type.types, 1), stringIndexInfo = getUnionIndexInfo(type.types, 0), numberIndexInfo = getUnionIndexInfo(type.types, 1); setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) } function intersectTypes(type1, type2) { return type1 ? type2 ? getIntersectionType([type1, type2]) : type1 : type2 } function intersectIndexInfos(info1, info2) { return info1 ? info2 ? createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly) : info1 : info2 } function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly) } function includeMixinType(type, types, index) { for (var mixedTypes = [], i = 0; i < types.length; i++)i === index ? mixedTypes.push(type) : isMixinConstructorType(types[i]) && mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0])); return getIntersectionType(mixedTypes) } function resolveIntersectionTypeMembers(type) { for (var stringIndexInfo, numberIndexInfo, callSignatures = ts.emptyArray, constructSignatures = ts.emptyArray, types = type.types, mixinCount = ts.countWhere(types, isMixinConstructorType), _loop_4 = function (i) { var t = type.types[i]; if (0 === mixinCount || mixinCount === types.length && 0 === i || !isMixinConstructorType(t)) { var signatures = getSignaturesOfType(t, 1); signatures.length && mixinCount > 0 && (signatures = ts.map(signatures, function (s) { var clone = cloneSignature(s); return clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i), clone })), constructSignatures = ts.concatenate(constructSignatures, signatures) } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)), stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)), numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)) }, i = 0; i < types.length; i++)_loop_4(i); setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (type.target) { var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, !1), callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0), type.mapper), constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1), type.mapper), stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0), type.mapper), numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1), type.mapper); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) } else if (2048 & symbol.flags) { var members = getMembersOfSymbol(symbol), callSignatures = getSignaturesOfSymbol(members.get("__call")), constructSignatures = getSignaturesOfSymbol(members.get("__new")), stringIndexInfo = getIndexInfoOfSymbol(symbol, 0), numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) } else { var members = emptySymbols, stringIndexInfo = void 0; if (symbol.exports && (members = getExportsOfSymbol(symbol)), setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, void 0, void 0), 32 & symbol.flags) { var classType = getDeclaredTypeOfClassOrInterface(symbol), baseConstructorType = getBaseConstructorTypeOfClass(classType); 1409024 & baseConstructorType.flags ? (members = ts.createSymbolTable(getNamedMembers(members)), addInheritedMembers(members, getPropertiesOfType(baseConstructorType))) : baseConstructorType === anyType && (stringIndexInfo = createIndexInfo(anyType, !1)) } var numberIndexInfo = 384 & symbol.flags ? enumNumberIndexInfo : void 0; if (setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, numberIndexInfo), 8208 & symbol.flags && (type.callSignatures = getSignaturesOfSymbol(symbol)), 32 & symbol.flags) { var classType = getDeclaredTypeOfClassOrInterface(symbol), constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); constructSignatures.length || (constructSignatures = getDefaultConstructSignatures(classType)), type.constructSignatures = constructSignatures } } } function resolveReverseMappedTypeMembers(type) { for (var indexInfo = getIndexInfoOfType(type.source, 0), modifiers = getMappedTypeModifiers(type.mappedType), readonlyMask = !(1 & modifiers), optionalMask = 4 & modifiers ? 0 : 16777216, stringIndexInfo = indexInfo && createIndexInfo(inferReverseMappedType(indexInfo.type, type.mappedType), readonlyMask && indexInfo.isReadonly), members = ts.createSymbolTable(), _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) { var prop = _a[_i], checkFlags = 2048 | (readonlyMask && isReadonlySymbol(prop) ? 8 : 0), inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.escapedName, checkFlags); inferredProp.declarations = prop.declarations, inferredProp.nameType = prop.nameType, inferredProp.propertyType = getTypeOfSymbol(prop), inferredProp.mappedType = type.mappedType, members.set(prop.escapedName, inferredProp) } setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, void 0) } function resolveMappedTypeMembers(type) { function addMemberForKeyType(t, _index, origin) { var templateMapper = combineTypeMappers(type.mapper, createTypeMapper([typeParameter], [t])), propType = instantiateType(templateType, templateMapper); if (1120 & t.flags) { var propName = getLateBoundNameFromType(t), modifiersProp = getPropertyOfType(modifiersType, propName), isOptional = !!(4 & templateModifiers || !(8 & templateModifiers) && modifiersProp && 16777216 & modifiersProp.flags), isReadonly = !!(1 & templateModifiers || !(2 & templateModifiers) && modifiersProp && isReadonlySymbol(modifiersProp)), prop = createSymbol(4 | (isOptional ? 16777216 : 0), propName, isReadonly ? 8 : 0); prop.type = strictNullChecks && isOptional && !isTypeAssignableTo(undefinedType, propType) ? getOptionalType(propType) : strictNullChecks && !isOptional && modifiersProp && 16777216 & modifiersProp.flags ? getTypeWithFacts(propType, 131072) : propType, origin && (prop.syntheticOrigin = origin, prop.declarations = origin.declarations), prop.nameType = t, members.set(propName, prop) } else 3 & t.flags ? stringIndexInfo = createIndexInfo(propType, !!(1 & templateModifiers)) : 4 & t.flags && (numberIndexInfo = createIndexInfo(propType, !!(1 & templateModifiers))) } var stringIndexInfo, numberIndexInfo, members = ts.createSymbolTable(); setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0); var typeParameter = getTypeParameterFromMappedType(type), constraintType = getConstraintTypeFromMappedType(type), templateType = getTemplateTypeFromMappedType(type.target || type), modifiersType = getApparentType(getModifiersTypeFromMappedType(type)), templateModifiers = getMappedTypeModifiers(type), include = keyofStringsOnly ? 32 : 1120; if (isMappedTypeWithKeyofConstraintDeclaration(type)) { for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { var prop = _a[_i]; addMemberForKeyType(getLiteralTypeFromPropertyName(prop, include), void 0, prop) } (1 & modifiersType.flags || getIndexInfoOfType(modifiersType, 0)) && addMemberForKeyType(stringType), !keyofStringsOnly && getIndexInfoOfType(modifiersType, 1) && addMemberForKeyType(numberType) } else { var keyType = 7372800 & constraintType.flags ? getApparentType(constraintType) : constraintType, iterationType = 524288 & keyType.flags ? getIndexType(getApparentType(keyType.type)) : keyType; forEachType(iterationType, addMemberForKeyType) } setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, numberIndexInfo) } function getTypeParameterFromMappedType(type) { return type.typeParameter || (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(type.declaration.typeParameter))) } function getConstraintTypeFromMappedType(type) { return type.constraintType || (type.constraintType = instantiateType(getConstraintOfTypeParameter(getTypeParameterFromMappedType(type)), type.mapper || identityMapper) || unknownType) } function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!(4 & getMappedTypeModifiers(type))), type.mapper || identityMapper) : unknownType) } function getConstraintDeclarationForMappedType(type) { return type.declaration.typeParameter.constraint } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); return 174 === constraintDeclaration.kind && 128 === constraintDeclaration.operator } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) if (isMappedTypeWithKeyofConstraintDeclaration(type)) type.modifiersType = instantiateType(getTypeFromTypeNode(getConstraintDeclarationForMappedType(type).type), type.mapper || identityMapper); else { var declaredType = getTypeFromMappedTypeNode(type.declaration), constraint = getConstraintTypeFromMappedType(declaredType), extendedConstraint = constraint && 32768 & constraint.flags ? getConstraintOfTypeParameter(constraint) : constraint; type.modifiersType = extendedConstraint && 524288 & extendedConstraint.flags ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType } return type.modifiersType } function getMappedTypeModifiers(type) { var declaration = type.declaration; return (declaration.readonlyToken ? 38 === declaration.readonlyToken.kind ? 2 : 1 : 0) | (declaration.questionToken ? 38 === declaration.questionToken.kind ? 8 : 4 : 0) } function getMappedTypeOptionality(type) { var modifiers = getMappedTypeModifiers(type); return 8 & modifiers ? -1 : 4 & modifiers ? 1 : 0 } function getCombinedMappedTypeOptionality(type) { var optionality = getMappedTypeOptionality(type), modifiersType = getModifiersTypeFromMappedType(type); return optionality || (isGenericMappedType(modifiersType) ? getMappedTypeOptionality(modifiersType) : 0) } function isPartialMappedType(type) { return !!(32 & ts.getObjectFlags(type) && 4 & getMappedTypeModifiers(type)) } function isGenericMappedType(type) { return 32 & ts.getObjectFlags(type) && isGenericIndexType(getConstraintTypeFromMappedType(type)) } function resolveStructuredTypeMembers(type) { return type.members || (65536 & type.flags ? 4 & type.objectFlags ? resolveTypeReferenceMembers(type) : 3 & type.objectFlags ? resolveClassOrInterfaceMembers(type) : 2048 & type.objectFlags ? resolveReverseMappedTypeMembers(type) : 16 & type.objectFlags ? resolveAnonymousTypeMembers(type) : 32 & type.objectFlags && resolveMappedTypeMembers(type) : 131072 & type.flags ? resolveUnionTypeMembers(type) : 262144 & type.flags && resolveIntersectionTypeMembers(type)), type } function getPropertiesOfObjectType(type) { return 65536 & type.flags ? resolveStructuredTypeMembers(type).properties : ts.emptyArray } function getPropertyOfObjectType(type, name) { if (65536 & type.flags) { var resolved = resolveStructuredTypeMembers(type), symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) return symbol } } function getPropertiesOfUnionOrIntersectionType(type) { if (!type.resolvedProperties) { for (var members = ts.createSymbolTable(), _i = 0, _a = type.types; _i < _a.length; _i++) { for (var current = _a[_i], _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { var prop = _c[_b]; if (!members.has(prop.escapedName)) { var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName); combinedProp && members.set(prop.escapedName, combinedProp) } } if (131072 & type.flags) break } type.resolvedProperties = getNamedMembers(members) } return type.resolvedProperties } function getPropertiesOfType(type) { return type = getApparentType(type), 393216 & type.flags ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type) } function getAllPossiblePropertiesOfTypes(types) { var unionType = getUnionType(types); if (!(131072 & unionType.flags)) return getAugmentedPropertiesOfType(unionType); for (var props = ts.createSymbolTable(), _i = 0, types_3 = types; _i < types_3.length; _i++)for (var memberType = types_3[_i], _a = 0, _b = getAugmentedPropertiesOfType(memberType); _a < _b.length; _a++) { var escapedName = _b[_a].escapedName; if (!props.has(escapedName)) { var prop = createUnionOrIntersectionProperty(unionType, escapedName); prop && props.set(escapedName, prop) } } return ts.arrayFrom(props.values()) } function getConstraintOfType(type) { return 32768 & type.flags ? getConstraintOfTypeParameter(type) : 1048576 & type.flags ? getConstraintOfIndexedAccess(type) : 2097152 & type.flags ? getConstraintOfConditionalType(type) : getBaseConstraintOfType(type) } function getConstraintOfTypeParameter(typeParameter) { return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0 } function getConstraintOfIndexedAccess(type) { var objectType = getBaseConstraintOfType(type.objectType) || type.objectType, indexType = getBaseConstraintOfType(type.indexType) || type.indexType, constraint = isGenericObjectType(objectType) || isGenericIndexType(indexType) ? void 0 : getIndexedAccessType(objectType, indexType); return constraint && constraint !== unknownType ? constraint : void 0 } function getDefaultConstraintOfConditionalType(type) { if (!type.resolvedDefaultConstraint) { var rootTrueType = type.root.trueType, rootTrueConstraint = 4194304 & rootTrueType.flags ? rootTrueType.substitute : rootTrueType; type.resolvedDefaultConstraint = getUnionType([instantiateType(rootTrueConstraint, type.combinedMapper || type.mapper), getFalseTypeFromConditionalType(type)]) } return type.resolvedDefaultConstraint } function getConstraintOfDistributiveConditionalType(type) { if (type.root.isDistributive) { var constraint = getConstraintOfType(getSimplifiedType(type.checkType)); if (constraint) { var mapper = makeUnaryTypeMapper(type.root.checkType, constraint), instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); if (!(16384 & instantiated.flags)) return instantiated } } } function getConstraintOfConditionalType(type) { return getConstraintOfDistributiveConditionalType(type) || getDefaultConstraintOfConditionalType(type) } function getUnionConstraintOfIntersection(type, targetIsUnion) { for (var constraints, hasDisjointDomainType = !1, _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; if (7897088 & t.flags) { for (var constraint = getConstraintOfType(t); constraint && 2654208 & constraint.flags;)constraint = getConstraintOfType(constraint); if (constraint) { if (!(131072 & constraint.flags)) return; constraints = ts.append(constraints, constraint) } } else 134233854 & t.flags && (hasDisjointDomainType = !0) } if (constraints && (targetIsUnion || hasDisjointDomainType)) { if (hasDisjointDomainType) for (var _b = 0, _c = type.types; _b < _c.length; _b++) { var t = _c[_b]; 134233854 & t.flags && (constraints = ts.append(constraints, t)) } return getIntersectionType(constraints) } } function getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type) { if (7766016 & type.flags) { var constraint = getResolvedBaseConstraint(type); if (constraint !== noConstraintType && constraint !== circularConstraintType) return constraint } } function getBaseConstraintOfType(type) { var constraint = getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type); return !constraint && 524288 & type.flags ? keyofConstraintType : constraint } function getBaseConstraintOrType(type) { return getBaseConstraintOfType(type) || type } function hasNonCircularBaseConstraint(type) { return getResolvedBaseConstraint(type) !== circularConstraintType } function getResolvedBaseConstraint(type) { function getBaseConstraint(t) { if (!pushTypeResolution(t, 4)) return void (circular = !0); var result = computeBaseConstraint(getSimplifiedType(t)); return popTypeResolution() ? result : void (circular = !0) } function computeBaseConstraint(t) { if (32768 & t.flags) { var constraint = getConstraintFromTypeParameter(t); return t.isThisType || !constraint ? constraint : getBaseConstraint(constraint) } if (393216 & t.flags) { for (var types = t.types, baseTypes = [], _i = 0, types_4 = types; _i < types_4.length; _i++) { var type_3 = types_4[_i], baseType = getBaseConstraint(type_3); baseType && baseTypes.push(baseType) } return 131072 & t.flags && baseTypes.length === types.length ? getUnionType(baseTypes) : 262144 & t.flags && baseTypes.length ? getIntersectionType(baseTypes) : void 0 } if (524288 & t.flags) return keyofConstraintType; if (1048576 & t.flags) { var baseObjectType = getBaseConstraint(t.objectType), baseIndexType = getBaseConstraint(t.indexType), baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : void 0; return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : void 0 } if (2097152 & t.flags) { var constraint = getConstraintOfConditionalType(t); return constraint && getBaseConstraint(constraint) } return 4194304 & t.flags ? getBaseConstraint(t.substitute) : isGenericMappedType(t) ? emptyObjectType : t } var circular; if (!type.resolvedBaseConstraint) { var constraint = getBaseConstraint(type); type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type) } return type.resolvedBaseConstraint } function getApparentTypeOfIntersectionType(type) { return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type, !0)) } function getResolvedTypeParameterDefault(typeParameter) { if (typeParameter.default) typeParameter.default === resolvingDefaultType && (typeParameter.default = circularConstraintType); else if (typeParameter.target) { var targetDefault = getResolvedTypeParameterDefault(typeParameter.target); typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType } else { typeParameter.default = resolvingDefaultType; var defaultDeclaration = typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameterDeclaration(decl) && decl.default }), defaultType = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; typeParameter.default === resolvingDefaultType && (typeParameter.default = defaultType) } return typeParameter.default } function getDefaultFromTypeParameter(typeParameter) { var defaultType = getResolvedTypeParameterDefault(typeParameter); return defaultType !== noConstraintType && defaultType !== circularConstraintType ? defaultType : void 0 } function hasNonCircularTypeParameterDefault(typeParameter) { return getResolvedTypeParameterDefault(typeParameter) !== circularConstraintType } function hasTypeParameterDefault(typeParameter) { return !(!typeParameter.symbol || !ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameterDeclaration(decl) && decl.default })) } function getApparentType(type) { var t = 7897088 & type.flags ? getBaseConstraintOfType(type) || emptyObjectType : type; return 262144 & t.flags ? getApparentTypeOfIntersectionType(t) : 34 & t.flags ? globalStringType : 84 & t.flags ? globalNumberType : 136 & t.flags ? globalBooleanType : 1536 & t.flags ? getGlobalESSymbolType(languageVersion >= 2) : 134217728 & t.flags ? emptyObjectType : 524288 & t.flags ? keyofConstraintType : t } function createUnionOrIntersectionProperty(containingType, name) { for (var props, isUnion = 131072 & containingType.flags, excludeModifiers = isUnion ? 24 : 0, commonFlags = isUnion ? 0 : 16777216, syntheticFlag = 4, checkFlags = 0, _i = 0, _a = containingType.types; _i < _a.length; _i++) { var current = _a[_i], type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name), modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; !prop || modifiers & excludeModifiers ? isUnion && (checkFlags |= 16) : (commonFlags &= prop.flags, props = ts.appendIfUnique(props, prop), checkFlags |= (isReadonlySymbol(prop) ? 8 : 0) | (24 & modifiers ? 0 : 64) | (16 & modifiers ? 128 : 0) | (8 & modifiers ? 256 : 0) | (32 & modifiers ? 512 : 0), isPrototypeProperty(prop) || (syntheticFlag = 2)) } } if (props) { if (1 === props.length && !(16 & checkFlags)) return props[0]; for (var declarations, commonType, nameType, commonValueDeclaration, propTypes = [], first = !0, hasNonUniformValueDeclaration = !1, _b = 0, props_1 = props; _b < props_1.length; _b++) { var prop = props_1[_b]; commonValueDeclaration ? prop.valueDeclaration !== commonValueDeclaration && (hasNonUniformValueDeclaration = !0) : commonValueDeclaration = prop.valueDeclaration, declarations = ts.addRange(declarations, prop.declarations); var type = getTypeOfSymbol(prop); first ? (commonType = type, nameType = prop.nameType, first = !1) : type !== commonType && (checkFlags |= 32), propTypes.push(type) } var result = createSymbol(4 | commonFlags, name, syntheticFlag | checkFlags); return result.containingType = containingType, !hasNonUniformValueDeclaration && commonValueDeclaration && (result.valueDeclaration = commonValueDeclaration), result.declarations = declarations, result.nameType = nameType, result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes), result } } function getUnionOrIntersectionProperty(type, name) { var properties = type.propertyCache || (type.propertyCache = ts.createSymbolTable()), property = properties.get(name); return property || (property = createUnionOrIntersectionProperty(type, name), property && properties.set(name, property)), property } function getPropertyOfUnionOrIntersectionType(type, name) { var property = getUnionOrIntersectionProperty(type, name); return !property || 16 & ts.getCheckFlags(property) ? void 0 : property } function getPropertyOfType(type, name) { if (type = getApparentType(type), 65536 & type.flags) { var resolved = resolveStructuredTypeMembers(type), symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) return symbol; if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { var symbol_1 = getPropertyOfObjectType(globalFunctionType, name); if (symbol_1) return symbol_1 } return getPropertyOfObjectType(globalObjectType, name) } if (393216 & type.flags) return getPropertyOfUnionOrIntersectionType(type, name) } function getSignaturesOfStructuredType(type, kind) { if (458752 & type.flags) { var resolved = resolveStructuredTypeMembers(type); return 0 === kind ? resolved.callSignatures : resolved.constructSignatures } return ts.emptyArray } function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind) } function getIndexInfoOfStructuredType(type, kind) { if (458752 & type.flags) { var resolved = resolveStructuredTypeMembers(type); return 0 === kind ? resolved.stringIndexInfo : resolved.numberIndexInfo } } function getIndexTypeOfStructuredType(type, kind) { var info = getIndexInfoOfStructuredType(type, kind); return info && info.type } function getIndexInfoOfType(type, kind) { return getIndexInfoOfStructuredType(getApparentType(type), kind) } function getIndexTypeOfType(type, kind) { return getIndexTypeOfStructuredType(getApparentType(type), kind) } function getImplicitIndexTypeOfType(type, kind) { if (isObjectTypeWithInferableIndex(type)) { for (var propTypes = [], _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { var prop = _a[_i]; (0 === kind || isNumericLiteralName(prop.escapedName)) && propTypes.push(getTypeOfSymbol(prop)) } if (propTypes.length) return getUnionType(propTypes, 2) } } function getTypeParametersFromDeclaration(declaration) { for (var result, _i = 0, _a = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _a.length; _i++) { var node = _a[_i]; result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol)) } return result } function symbolsToArray(symbols) { var result = []; return symbols.forEach(function (symbol, id) { isReservedMemberName(id) || result.push(symbol) }), result } function isJSDocOptionalParameter(node) { return ts.isInJavaScriptFile(node) && (node.type && 282 === node.type.kind || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; return isBracketed || !!typeExpression && 282 === typeExpression.type.kind })) } function tryFindAmbientModule(moduleName, withAugmentations) { if (!ts.isExternalModuleNameRelative(moduleName)) { var symbol = getSymbol(globals, '"' + moduleName + '"', 512); return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol } } function isOptionalParameter(node) { if (ts.hasQuestionToken(node) || isOptionalJSDocParameterTag(node) || isJSDocOptionalParameter(node)) return !0; if (node.initializer) { var signature = getSignatureFromDeclaration(node.parent), parameterIndex = node.parent.parameters.indexOf(node); return ts.Debug.assert(parameterIndex >= 0), parameterIndex >= signature.minArgumentCount } var iife = ts.getImmediatelyInvokedFunctionExpression(node.parent); return !!iife && (!node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= iife.arguments.length) } function isOptionalJSDocParameterTag(node) { if (!ts.isJSDocParameterTag(node)) return !1; var isBracketed = node.isBracketed, typeExpression = node.typeExpression; return isBracketed || !!typeExpression && 282 === typeExpression.type.kind } function createTypePredicateFromTypePredicateNode(node) { var parameterName = node.parameterName, type = getTypeFromTypeNode(node.type); return 71 === parameterName.kind ? createIdentifierTypePredicate(parameterName && parameterName.escapedText, parameterName && getTypePredicateParameterIndex(node.parent.parameters, parameterName), type) : createThisTypePredicate(type) } function createIdentifierTypePredicate(parameterName, parameterIndex, type) { return { kind: 1, parameterName: parameterName, parameterIndex: parameterIndex, type: type } } function createThisTypePredicate(type) { return { kind: 0, type: type } } function getMinTypeArgumentCount(typeParameters) { var minTypeArgumentCount = 0; if (typeParameters) for (var i = 0; i < typeParameters.length; i++)hasTypeParameterDefault(typeParameters[i]) || (minTypeArgumentCount = i + 1); return minTypeArgumentCount } function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, isJavaScriptImplicitAny) { var numTypeParameters = ts.length(typeParameters); if (numTypeParameters) { var numTypeArguments = ts.length(typeArguments); if (isJavaScriptImplicitAny || numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters) { typeArguments || (typeArguments = []); for (var i = numTypeArguments; i < numTypeParameters; i++)typeArguments[i] = getDefaultTypeArgumentType(isJavaScriptImplicitAny); for (var i = numTypeArguments; i < numTypeParameters; i++) { var mapper = createTypeMapper(typeParameters, typeArguments), defaultType = getDefaultFromTypeParameter(typeParameters[i]); isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType) && (defaultType = anyType), typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : getDefaultTypeArgumentType(isJavaScriptImplicitAny) } typeArguments.length = typeParameters.length } } return typeArguments } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { for (var parameters = [], hasLiteralTypes = !1, minArgumentCount = 0, thisParameter = void 0, hasThisParameter = void 0, iife = ts.getImmediatelyInvokedFunctionExpression(declaration), isJSConstructSignature = ts.isJSDocConstructSignature(declaration), isUntypedSignatureInJSFile = !iife && ts.isInJavaScriptFile(declaration) && ts.isValueSignatureDeclaration(declaration) && !ts.hasJSDocParameterTags(declaration) && !ts.getJSDocType(declaration), i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i], paramSymbol = param.symbol, type = ts.isJSDocParameterTag(param) ? param.typeExpression && param.typeExpression.type : param.type; if (paramSymbol && 4 & paramSymbol.flags && !ts.isBindingPattern(param.name)) { var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 67216319, void 0, void 0, !1); paramSymbol = resolvedSymbol } 0 === i && "this" === paramSymbol.escapedName ? (hasThisParameter = !0, thisParameter = param.symbol) : parameters.push(paramSymbol), type && 177 === type.kind && (hasLiteralTypes = !0); var isOptionalParameter_1 = isOptionalJSDocParameterTag(param) || param.initializer || param.questionToken || param.dotDotDotToken || iife && parameters.length > iife.arguments.length && !type || isUntypedSignatureInJSFile || isJSDocOptionalParameter(param); isOptionalParameter_1 || (minArgumentCount = parameters.length) } if (!(155 !== declaration.kind && 156 !== declaration.kind || hasNonBindableDynamicName(declaration) || hasThisParameter && thisParameter)) { var otherKind = 155 === declaration.kind ? 156 : 155, other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); other && (thisParameter = getAnnotatedAccessorThisParameter(other)) } var classType = 154 === declaration.kind ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0, typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration), returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType), hasRestLikeParameter = ts.hasRestParameter(declaration) || ts.isInJavaScriptFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters); links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, void 0, minArgumentCount, hasRestLikeParameter, hasLiteralTypes) } return links.resolvedSignature } function maybeAddJsSyntheticRestParameter(declaration, parameters) { if (ts.isJSDocSignature(declaration) || !containsArgumentsReference(declaration)) return !1; var lastParam = ts.lastOrUndefined(declaration.parameters), lastParamTags = lastParam ? ts.getJSDocParameterTags(lastParam) : ts.getJSDocTags(declaration).filter(ts.isJSDocParameterTag), lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) { return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : void 0 }), syntheticArgsSymbol = createSymbol(3, "args"); return syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType, syntheticArgsSymbol.isRestParameter = !0, lastParamVariadicType && parameters.pop(), parameters.push(syntheticArgsSymbol), !0 } function getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType) { if (isJSConstructSignature) return getTypeFromTypeNode(declaration.parameters[0].type); if (classType) return classType; var typeNode = ts.getEffectiveReturnTypeNode(declaration); if (typeNode) return getTypeFromTypeNode(typeNode); if (155 === declaration.kind && !hasNonBindableDynamicName(declaration)) { var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 156); return getAnnotatedAccessorType(setter) } return ts.nodeIsMissing(declaration.body) ? anyType : void 0 } function containsArgumentsReference(declaration) { function traverse(node) { if (!node) return !1; switch (node.kind) { case 71: return "arguments" === node.escapedText && ts.isExpressionNode(node); case 151: case 153: case 155: case 156: return 146 === node.name.kind && traverse(node.name); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && ts.forEachChild(node, traverse) } } var links = getNodeLinks(declaration); return void 0 === links.containsArgumentsReference && (8192 & links.flags ? links.containsArgumentsReference = !0 : links.containsArgumentsReference = traverse(declaration.body)), links.containsArgumentsReference } function getSignaturesOfSymbol(symbol) { if (!symbol) return ts.emptyArray; for (var result = [], i = 0; i < symbol.declarations.length; i++) { var decl = symbol.declarations[i], node = ts.isPropertyAccessExpression(decl) ? ts.getAssignedJavascriptInitializer(decl) : decl; if (ts.isFunctionLike(node)) { if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) continue } result.push(getSignatureFromDeclaration(node)) } } return result } function resolveExternalModuleTypeByLiteral(name) { var moduleSym = resolveExternalModuleName(name, name); if (moduleSym) { var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); if (resolvedModuleSymbol) return getTypeOfSymbol(resolvedModuleSymbol) } return anyType } function getThisTypeOfSignature(signature) { if (signature.thisParameter) return getTypeOfSymbol(signature.thisParameter) } function signatureHasTypePredicate(signature) { return void 0 !== getTypePredicateOfSignature(signature) } function getTypePredicateOfSignature(signature) { if (!signature.resolvedTypePredicate) { if (signature.target) { var targetTypePredicate = getTypePredicateOfSignature(signature.target); signature.resolvedTypePredicate = targetTypePredicate ? instantiateTypePredicate(targetTypePredicate, signature.mapper) : noTypePredicate } else if (signature.unionSignatures) signature.resolvedTypePredicate = getUnionTypePredicate(signature.unionSignatures) || noTypePredicate; else { var declaration = signature.declaration; signature.resolvedTypePredicate = declaration && declaration.type && 160 === declaration.type.kind ? createTypePredicateFromTypePredicateNode(declaration.type) : noTypePredicate } ts.Debug.assert(!!signature.resolvedTypePredicate) } return signature.resolvedTypePredicate === noTypePredicate ? void 0 : signature.resolvedTypePredicate } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, 3)) return unknownType; var type = void 0; if (type = signature.target ? instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper) : signature.unionSignatures ? getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature), 2) : getReturnTypeFromBody(signature.declaration), !popTypeResolution() && (type = anyType, noImplicitAny)) { var declaration = signature.declaration, name = ts.getNameOfDeclaration(declaration); name ? error(name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(name)) : error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions) } signature.resolvedReturnType = type } return signature.resolvedReturnType } function isResolvingReturnTypeOfSignature(signature) { return !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, 3) >= 0 } function getRestTypeOfSignature(signature) { if (signature.hasRestParameter) { var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters)); if (4 & ts.getObjectFlags(type) && type.target === globalArrayType) return type.typeArguments[0] } return anyType } function getSignatureInstantiation(signature, typeArguments, isJavascript) { typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript); var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()), id = getTypeListId(typeArguments), instantiation = instantiations.get(id); return instantiation || instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)), instantiation } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createSignatureTypeMapper(signature, typeArguments), !0) } function createSignatureTypeMapper(signature, typeArguments) { return createTypeMapper(signature.typeParameters, typeArguments) } function getErasedSignature(signature) { return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature } function createErasedSignature(signature) { return instantiateSignature(signature, createTypeEraser(signature.typeParameters), !0) } function getCanonicalSignature(signature) { return signature.typeParameters ? signature.canonicalSignatureCache || (signature.canonicalSignatureCache = createCanonicalSignature(signature)) : signature } function createCanonicalSignature(signature) { return getSignatureInstantiation(signature, ts.map(signature.typeParameters, function (tp) { return tp.target && !getConstraintOfTypeParameter(tp.target) ? tp.target : tp }), ts.isInJavaScriptFile(signature.declaration)) } function getBaseSignature(signature) { var typeParameters = signature.typeParameters; if (typeParameters) { var typeEraser_1 = createTypeEraser(typeParameters), baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType }); return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), !0) } return signature } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { var isConstructor = 154 === signature.declaration.kind || 158 === signature.declaration.kind, type = createObjectType(16); type.members = emptySymbols, type.properties = ts.emptyArray, type.callSignatures = isConstructor ? ts.emptyArray : [signature], type.constructSignatures = isConstructor ? [signature] : ts.emptyArray, signature.isolatedSignatureType = type } return signature.isolatedSignatureType } function getIndexSymbol(symbol) { return symbol.members.get("__index") } function getIndexDeclarationOfSymbol(symbol, kind) { var syntaxKind = 1 === kind ? 134 : 137, indexSymbol = getIndexSymbol(symbol); if (indexSymbol) for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i], node = ts.cast(decl, ts.isIndexSignatureDeclaration); if (1 === node.parameters.length) { var parameter = node.parameters[0]; if (parameter.type && parameter.type.kind === syntaxKind) return node } } } function createIndexInfo(type, isReadonly, declaration) { return { type: type, isReadonly: isReadonly, declaration: declaration } } function getIndexInfoOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); if (declaration) return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasModifier(declaration, 64), declaration) } function getConstraintDeclaration(type) { var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 147); return decl && decl.constraint } function getInferredTypeParameterConstraint(typeParameter) { var inferences; if (typeParameter.symbol) for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (171 === declaration.parent.kind && 161 === declaration.parent.parent.kind) { var typeReference = declaration.parent.parent, typeParameters = getTypeParametersForTypeReference(typeReference); if (typeParameters) { var index = typeReference.typeArguments.indexOf(declaration.parent); if (index < typeParameters.length) { var declaredConstraint = getConstraintOfTypeParameter(typeParameters[index]); if (declaredConstraint) { var mapper = createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReference, typeParameters)), constraint = instantiateType(declaredConstraint, mapper); constraint !== typeParameter && (inferences = ts.append(inferences, constraint)) } } } } } return inferences && getIntersectionType(inferences) } function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : getInferredTypeParameterConstraint(typeParameter) || noConstraintType } return typeParameter.constraint === noConstraintType ? void 0 : typeParameter.constraint } function getParentSymbolOfTypeParameter(typeParameter) { return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 147).parent) } function getTypeListId(types) { var result = ""; if (types) for (var length_3 = types.length, i = 0; i < length_3;) { for (var startId = types[i].id, count = 1; i + count < length_3 && types[i + count].id === startId + count;)count++; result.length && (result += ","), result += startId, count > 1 && (result += ":" + count), i += count } return result } function getPropagatingFlagsOfTypes(types, excludeKinds) { for (var result = 0, _i = 0, types_5 = types; _i < types_5.length; _i++) { var type = types_5[_i]; type.flags & excludeKinds || (result |= type.flags) } return 117440512 & result } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments), type = target.instantiations.get(id); return type || (type = createObjectType(4, target.symbol), target.instantiations.set(id, type), type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0, type.target = target, type.typeArguments = typeArguments), type } function cloneTypeReference(source) { var type = createType(source.flags); return type.symbol = source.symbol, type.objectFlags = source.objectFlags, type.target = source.target, type.typeArguments = source.typeArguments, type } function getTypeReferenceArity(type) { return ts.length(type.target.typeParameters) } function getTypeFromClassOrInterfaceReference(node, symbol, typeArgs) { var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)), typeParameters = type.localTypeParameters; if (typeParameters) { var numTypeArguments = ts.length(node.typeArguments), minTypeArgumentCount = getMinTypeArgumentCount(typeParameters), isJs = ts.isInJavaScriptFile(node), isJsImplicitAny = !noImplicitAny && isJs; if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { var missingAugmentsTag = isJs && 289 !== node.parent.kind, diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag ? ts.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag : ts.Diagnostics.Generic_type_0_requires_1_type_argument_s : missingAugmentsTag ? ts.Diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, typeStr = typeToString(type, void 0, 2); if (error(node, diag, typeStr, minTypeArgumentCount, typeParameters.length), !isJs) return unknownType } var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(typeArgs, typeParameters, minTypeArgumentCount, isJs)); return createTypeReference(type, typeArguments) } return checkNoTypeArguments(node, symbol) ? type : unknownType } function getTypeAliasInstantiation(symbol, typeArguments) { var type = getDeclaredTypeOfSymbol(symbol), links = getSymbolLinks(symbol), typeParameters = links.typeParameters, id = getTypeListId(typeArguments), instantiation = links.instantiations.get(id); return instantiation || links.instantiations.set(id, instantiation = instantiateType(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJavaScriptFile(symbol.valueDeclaration))))), instantiation } function getTypeFromTypeAliasReference(node, symbol, typeArguments) { var type = getDeclaredTypeOfSymbol(symbol), typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { var numTypeArguments = ts.length(node.typeArguments), minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); return numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length ? (error(node, minTypeArgumentCount === typeParameters.length ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length), unknownType) : getTypeAliasInstantiation(symbol, typeArguments) } return checkNoTypeArguments(node, symbol) ? type : unknownType } function getTypeReferenceName(node) { switch (node.kind) { case 161: return node.typeName; case 206: var expr = node.expression; if (ts.isEntityNameExpression(expr)) return expr } } function resolveTypeReferenceName(typeReferenceName, meaning) { return typeReferenceName ? resolveEntityName(typeReferenceName, meaning) || unknownSymbol : unknownSymbol } function getTypeReferenceType(node, symbol) { var typeArguments = typeArgumentsFromTypeReferenceNode(node); if (symbol === unknownSymbol) return unknownType; var type = getTypeReferenceTypeWorker(node, symbol, typeArguments); if (type) return type; var res = tryGetDeclaredTypeOfSymbol(symbol); if (res) return checkNoTypeArguments(node, symbol) ? 32768 & res.flags ? getConstrainedTypeVariable(res, node) : res : unknownType; if (!(67216319 & symbol.flags && isJSDocTypeReference(node))) return unknownType; var jsdocType = getJSDocTypeReference(node, symbol, typeArguments); return jsdocType ? jsdocType : (resolveTypeReferenceName(getTypeReferenceName(node), 67901928), getTypeOfSymbol(symbol)) } function getJSDocTypeReference(node, symbol, typeArguments) { var assignedType = getAssignedClassType(symbol), valueType = getTypeOfSymbol(symbol), referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments); if (referenceType || assignedType) return referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType } function getTypeReferenceTypeWorker(node, symbol, typeArguments) { if (96 & symbol.flags) { if (symbol.valueDeclaration && ts.isBinaryExpression(symbol.valueDeclaration.parent)) { var jsdocType = getJSDocTypeReference(node, symbol, typeArguments); if (jsdocType) return jsdocType } return getTypeFromClassOrInterfaceReference(node, symbol, typeArguments) } return 524288 & symbol.flags ? getTypeFromTypeAliasReference(node, symbol, typeArguments) : 16 & symbol.flags && isJSDocTypeReference(node) && (symbol.members || ts.getJSDocClassTag(symbol.valueDeclaration)) ? getInferredClassType(symbol) : void 0 } function getSubstitutionType(typeVariable, substitute) { var result = createType(4194304); return result.typeVariable = typeVariable, result.substitute = substitute, result } function isUnaryTupleTypeNode(node) { return 167 === node.kind && 1 === node.elementTypes.length } function getImpliedConstraint(typeVariable, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) : getActualTypeVariable(getTypeFromTypeNode(checkNode)) === typeVariable ? getTypeFromTypeNode(extendsNode) : void 0 } function getConstrainedTypeVariable(typeVariable, node) { for (var constraints; node && !ts.isStatement(node) && 285 !== node.kind;) { var parent = node.parent; if (170 === parent.kind && node === parent.trueType) { var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType); constraint && (constraints = ts.append(constraints, constraint)) } node = parent } return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable } function isJSDocTypeReference(node) { return 2097152 & node.flags && 161 === node.kind } function checkNoTypeArguments(node, symbol) { return !node.typeArguments || (error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts.declarationNameToString(node.typeName) : "(anonymous)"), !1) } function getIntendedTypeFromJSDocTypeReference(node) { if (ts.isIdentifier(node.typeName)) { var typeArgs = node.typeArguments; switch (node.typeName.escapedText) { case "String": return checkNoTypeArguments(node), stringType; case "Number": return checkNoTypeArguments(node), numberType; case "Boolean": return checkNoTypeArguments(node), booleanType; case "Void": return checkNoTypeArguments(node), voidType; case "Undefined": return checkNoTypeArguments(node), undefinedType; case "Null": return checkNoTypeArguments(node), nullType; case "Function": case "function": return checkNoTypeArguments(node), globalFunctionType; case "Array": case "array": return typeArgs && typeArgs.length ? void 0 : anyArrayType; case "Promise": case "promise": return typeArgs && typeArgs.length ? void 0 : createPromiseType(anyType); case "Object": if (typeArgs && 2 === typeArgs.length) { if (ts.isJSDocIndexSignature(node)) { var indexed = getTypeFromTypeNode(typeArgs[0]), target = getTypeFromTypeNode(typeArgs[1]), index = createIndexInfo(target, !1); return createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, indexed === stringType && index, indexed === numberType && index) } return anyType } return checkNoTypeArguments(node), anyType } } } function getTypeFromJSDocNullableTypeNode(node) { var type = getTypeFromTypeNode(node.type); return strictNullChecks ? getNullableType(type, 8192) : type } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = void 0, type = void 0, meaning = 67901928; isJSDocTypeReference(node) && (type = getIntendedTypeFromJSDocTypeReference(node), meaning |= 67216319), type || (symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning), type = getTypeReferenceType(node, symbol)), links.resolvedSymbol = symbol, links.resolvedType = type } return links.resolvedType } function typeArgumentsFromTypeReferenceNode(node) { return ts.map(node.typeArguments, getTypeFromTypeNode) } function getTypeFromTypeQueryNode(node) { var links = getNodeLinks(node); return links.resolvedType || (links.resolvedType = getWidenedType(checkExpression(node.exprName))), links.resolvedType } function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { for (var declarations = symbol.declarations, _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { case 234: case 235: case 237: return declaration } } } if (!symbol) return arity ? emptyGenericType : emptyObjectType; var type = getDeclaredTypeOfSymbol(symbol); return 65536 & type.flags ? ts.length(type.typeParameters) !== arity ? (error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, ts.symbolName(symbol), arity), arity ? emptyGenericType : emptyObjectType) : type : (error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, ts.symbolName(symbol)), arity ? emptyGenericType : emptyObjectType) } function getGlobalValueSymbol(name, reportErrors) { return getGlobalSymbol(name, 67216319, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : void 0) } function getGlobalTypeSymbol(name, reportErrors) { return getGlobalSymbol(name, 67901928, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : void 0) } function getGlobalSymbol(name, meaning, diagnostic) { return resolveName(void 0, name, meaning, diagnostic, name, !1) } function getGlobalType(name, arity, reportErrors) { var symbol = getGlobalTypeSymbol(name, reportErrors); return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : void 0 } function getGlobalTypedPropertyDescriptorType() { return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", 1, !0)) || emptyGenericType } function getGlobalTemplateStringsArrayType() { return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", 0, !0)) || emptyObjectType } function getGlobalImportMetaType() { return deferredGlobalImportMetaType || (deferredGlobalImportMetaType = getGlobalType("ImportMeta", 0, !0)) || emptyObjectType } function getGlobalESSymbolConstructorSymbol(reportErrors) { return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)) } function getGlobalESSymbolType(reportErrors) { return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", 0, reportErrors)) || emptyObjectType } function getGlobalPromiseType(reportErrors) { return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", 1, reportErrors)) || emptyGenericType } function getGlobalPromiseConstructorSymbol(reportErrors) { return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)) } function getGlobalPromiseConstructorLikeType(reportErrors) { return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", 0, reportErrors)) || emptyObjectType } function getGlobalAsyncIterableType(reportErrors) { return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", 1, reportErrors)) || emptyGenericType } function getGlobalAsyncIteratorType(reportErrors) { return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", 1, reportErrors)) || emptyGenericType } function getGlobalAsyncIterableIteratorType(reportErrors) { return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", 1, reportErrors)) || emptyGenericType } function getGlobalIterableType(reportErrors) { return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", 1, reportErrors)) || emptyGenericType } function getGlobalIteratorType(reportErrors) { return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", 1, reportErrors)) || emptyGenericType } function getGlobalIterableIteratorType(reportErrors) { return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", 1, reportErrors)) || emptyGenericType } function getGlobalTypeOrUndefined(name, arity) { void 0 === arity && (arity = 0); var symbol = getGlobalSymbol(name, 67901928, void 0); return symbol && getTypeOfGlobalSymbol(symbol, arity) } function getGlobalExtractSymbol() { return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288, ts.Diagnostics.Cannot_find_global_type_0)) } function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType } function createTypedPropertyDescriptorType(propertyType) { return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]) } function createAsyncIterableType(iteratedType) { return createTypeFromGenericGlobalType(getGlobalAsyncIterableType(!0), [iteratedType]) } function createAsyncIterableIteratorType(iteratedType) { return createTypeFromGenericGlobalType(getGlobalAsyncIterableIteratorType(!0), [iteratedType]) } function createIterableType(iteratedType) { return createTypeFromGenericGlobalType(getGlobalIterableType(!0), [iteratedType]) } function createIterableIteratorType(iteratedType) { return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(!0), [iteratedType]) } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]) } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); return links.resolvedType || (links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType))), links.resolvedType } function createTupleTypeOfArity(arity) { for (var typeParameters = [], properties = [], i = 0; i < arity; i++) { var typeParameter = createType(32768); typeParameters.push(typeParameter); var property = createSymbol(4, "" + i); property.type = typeParameter, properties.push(property) } var lengthSymbol = createSymbol(4, "length"); lengthSymbol.type = getLiteralType(arity), properties.push(lengthSymbol); var type = createObjectType(12); return type.typeParameters = typeParameters, type.outerTypeParameters = void 0, type.localTypeParameters = typeParameters, type.instantiations = ts.createMap(), type.instantiations.set(getTypeListId(type.typeParameters), type), type.target = type, type.typeArguments = type.typeParameters, type.thisType = createType(32768), type.thisType.isThisType = !0, type.thisType.constraint = type, type.declaredProperties = properties, type.declaredCallSignatures = ts.emptyArray, type.declaredConstructSignatures = ts.emptyArray, type.declaredStringIndexInfo = void 0, type.declaredNumberIndexInfo = void 0, type } function getTupleTypeOfArity(arity) { return tupleTypes[arity] || (tupleTypes[arity] = createTupleTypeOfArity(arity)) } function createTupleType(elementTypes) { return createTypeReference(getTupleTypeOfArity(elementTypes.length), elementTypes) } function getTypeFromTupleTypeNode(node) { var links = getNodeLinks(node); return links.resolvedType || (links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode))), links.resolvedType } function getTypeId(type) { return type.id } function containsType(types, type) { return ts.binarySearch(types, type, getTypeId, ts.compareValues) >= 0 } function isEmptyIntersectionType(type) { for (var combined = 0, _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; if (13536 & t.flags && 13536 & combined) return !0; if (combined |= t.flags, 12288 & combined && 134283264 & combined || 134217728 & combined && 16126 & combined || 34 & combined && 134233820 & combined || 84 & combined && 134233770 & combined || 1536 & combined && 134232318 & combined || 6144 & combined && 134227710 & combined) return !0 } return !1 } function addTypeToUnion(typeSet, includes, type) { var flags = type.flags; if (131072 & flags) return addTypesToUnion(typeSet, includes, type.types); if (!(16384 & flags || 262144 & flags && isEmptyIntersectionType(type))) if (includes |= flags & -117440513, 1 & flags) type === wildcardType && (includes |= 33554432); else if (!strictNullChecks && 12288 & flags) 16777216 & flags || (includes |= 16777216); else { var len = typeSet.length, index = len && type.id > typeSet[len - 1].id ? ~len : ts.binarySearch(typeSet, type, getTypeId, ts.compareValues); index < 0 && (65536 & flags && 16 & type.objectFlags && type.symbol && 8208 & type.symbol.flags && containsIdenticalType(typeSet, type) || typeSet.splice(~index, 0, type)) } return includes } function addTypesToUnion(typeSet, includes, types) { for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { var type = types_6[_i]; includes = addTypeToUnion(typeSet, includes, type) } return includes } function containsIdenticalType(types, type) { for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { var t = types_7[_i]; if (isTypeIdenticalTo(t, type)) return !0 } return !1 } function isSubtypeOfAny(source, targets) { for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) { var target = targets_1[_i]; if (source !== target && isTypeSubtypeOf(source, target) && (!(1 & ts.getObjectFlags(getTargetType(source))) || !(1 & ts.getObjectFlags(getTargetType(target))) || isTypeDerivedFrom(source, target))) return !0 } return !1 } function isSetOfLiteralsFromSameEnum(types) { var first = types[0]; if (256 & first.flags) { for (var firstEnum = getParentOfSymbol(first.symbol), i = 1; i < types.length; i++) { var other = types[i]; if (!(256 & other.flags) || firstEnum !== getParentOfSymbol(other.symbol)) return !1 } return !0 } return !1 } function removeSubtypes(types) { if (0 !== types.length && !isSetOfLiteralsFromSameEnum(types)) for (var i = types.length; i > 0;)i-- , isSubtypeOfAny(types[i], types) && ts.orderedRemoveItemAt(types, i) } function removeRedundantLiteralTypes(types, includes) { for (var i = types.length; i > 0;) { i--; var t = types[i], remove = 32 & t.flags && 2 & includes || 64 & t.flags && 4 & includes || 1024 & t.flags && 512 & includes || 96 & t.flags && 8388608 & t.flags && containsType(types, t.regularType); remove && ts.orderedRemoveItemAt(types, i) } } function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments) { if (void 0 === unionReduction && (unionReduction = 1), 0 === types.length) return neverType; if (1 === types.length) return types[0]; var typeSet = [], includes = addTypesToUnion(typeSet, 0, types); if (1 & includes) return 33554432 & includes ? wildcardType : anyType; switch (unionReduction) { case 1: 1120 & includes && removeRedundantLiteralTypes(typeSet, includes); break; case 2: removeSubtypes(typeSet) }return 0 === typeSet.length ? 8192 & includes ? 16777216 & includes ? nullType : nullWideningType : 4096 & includes ? 16777216 & includes ? undefinedType : undefinedWideningType : neverType : getUnionTypeFromSortedList(typeSet, 8374815 & includes ? 0 : 268435456, aliasSymbol, aliasTypeArguments) } function getUnionTypePredicate(signatures) { for (var first, types = [], _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i], pred = getTypePredicateOfSignature(sig); if (pred) { if (first) { if (!typePredicateKindsMatch(first, pred)) return } else first = pred; types.push(pred.type) } } if (first) { var unionType = getUnionType(types); return ts.isIdentifierTypePredicate(first) ? createIdentifierTypePredicate(first.parameterName, first.parameterIndex, unionType) : createThisTypePredicate(unionType) } } function typePredicateKindsMatch(a, b) { return ts.isIdentifierTypePredicate(a) ? ts.isIdentifierTypePredicate(b) && a.parameterIndex === b.parameterIndex : !ts.isIdentifierTypePredicate(b) } function getUnionTypeFromSortedList(types, unionOfUnitTypes, aliasSymbol, aliasTypeArguments) { if (0 === types.length) return neverType; if (1 === types.length) return types[0]; var id = getTypeListId(types), type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, 12288); type = createType(131072 | propagatedFlags | unionOfUnitTypes), unionTypes.set(id, type), type.types = types, type.aliasSymbol = aliasSymbol, type.aliasTypeArguments = aliasTypeArguments } return type } function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)) } return links.resolvedType } function addTypeToIntersection(typeSet, includes, type) { var flags = type.flags; return 262144 & flags ? addTypesToIntersection(typeSet, includes, type.types) : (16 & ts.getObjectFlags(type) && isEmptyObjectType(type) ? includes |= 67108864 : (includes |= flags & -117440513, 1 & flags ? type === wildcardType && (includes |= 33554432) : !strictNullChecks && 12288 & flags || ts.contains(typeSet, type) || 65536 & flags && 16 & type.objectFlags && type.symbol && 8208 & type.symbol.flags && containsIdenticalType(typeSet, type) || typeSet.push(type)), includes) } function addTypesToIntersection(typeSet, includes, types) { for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { var type = types_8[_i]; includes = addTypeToIntersection(typeSet, includes, getRegularTypeOfLiteralType(type)) } return includes } function removeRedundantPrimitiveTypes(types, includes) { for (var i = types.length; i > 0;) { i--; var t = types[i], remove = 2 & t.flags && 32 & includes || 4 & t.flags && 64 & includes || 512 & t.flags && 1024 & includes; remove && ts.orderedRemoveItemAt(types, i) } } function intersectUnionsOfUnitTypes(types) { for (var unionIndex = ts.findIndex(types, function (t) { return 0 !== (268435456 & t.flags) }), unionType = types[unionIndex], intersection = unionType.types, i = types.length - 1, _loop_5 = function () { var t = types[i]; 268435456 & t.flags && (intersection = ts.filter(intersection, function (u) { return containsType(t.types, u) }), ts.orderedRemoveItemAt(types, i)), i-- }; i > unionIndex;)_loop_5(); return intersection !== unionType.types && (types[unionIndex] = getUnionTypeFromSortedList(intersection, 268435456 & unionType.flags), !0) } function getIntersectionType(types, aliasSymbol, aliasTypeArguments) { if (0 === types.length) return emptyObjectType; var typeSet = [], includes = addTypesToIntersection(typeSet, 0, types); if (16384 & includes) return neverType; if (1 & includes) return 33554432 & includes ? wildcardType : anyType; if ((2 & includes && 32 & includes || 4 & includes && 64 & includes || 512 & includes && 1024 & includes) && removeRedundantPrimitiveTypes(typeSet, includes), 67108864 & includes && !(65536 & includes) && typeSet.push(emptyObjectType), 1 === typeSet.length) return typeSet[0]; if (131072 & includes) { if (268435456 & includes && intersectUnionsOfUnitTypes(typeSet)) return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); var unionIndex_1 = ts.findIndex(typeSet, function (t) { return 0 !== (131072 & t.flags) }), unionType = typeSet[unionIndex_1]; return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)) }), 1, aliasSymbol, aliasTypeArguments) } var id = getTypeListId(typeSet), type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 12288); type = createType(262144 | propagatedFlags), intersectionTypes.set(id, type), type.types = typeSet, type.aliasSymbol = aliasSymbol, type.aliasTypeArguments = aliasTypeArguments } return type } function getTypeFromIntersectionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)) } return links.resolvedType } function createIndexType(type, stringsOnly) { var result = createType(524288); return result.type = type, result.stringsOnly = stringsOnly, result } function getIndexTypeForGenericType(type, stringsOnly) { return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, !0)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, !1)) } function getLiteralTypeFromPropertyName(prop, include) { if (!(24 & ts.getDeclarationModifierFlagsFromSymbol(prop))) { var type = getLateBoundSymbol(prop).nameType; if (!type && !ts.isKnownSymbol(prop)) { var name = ts.getNameOfDeclaration(prop.valueDeclaration); type = getLiteralType(name && ts.isNumericLiteral(name) ? +name.text : name && 146 === name.kind && ts.isNumericLiteral(name.expression) ? +name.expression.text : ts.symbolName(prop)) } if (type && type.flags & include) return type } return neverType } function getLiteralTypeFromPropertyNames(type, include) { return getUnionType(ts.map(getPropertiesOfType(type), function (t) { return getLiteralTypeFromPropertyName(t, include) })) } function getNonEnumNumberIndexInfo(type) { var numberIndexInfo = getIndexInfoOfType(type, 1); return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : void 0 } function getIndexType(type, stringsOnly) { return void 0 === stringsOnly && (stringsOnly = keyofStringsOnly), 131072 & type.flags ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly) })) : 262144 & type.flags ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly) })) : maybeTypeOfKind(type, 7372800) ? getIndexTypeForGenericType(type, stringsOnly) : 32 & ts.getObjectFlags(type) ? getConstraintTypeFromMappedType(type) : type === wildcardType ? wildcardType : 1 & type.flags ? keyofConstraintType : stringsOnly ? getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromPropertyNames(type, 32) : getIndexInfoOfType(type, 0) ? getUnionType([stringType, numberType, getLiteralTypeFromPropertyNames(type, 1024)]) : getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type, 1056)]) : getLiteralTypeFromPropertyNames(type, 1120) } function getExtractStringType(type) { if (keyofStringsOnly) return type; var extractTypeAlias = getGlobalExtractSymbol(); return extractTypeAlias ? getTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType } function getIndexTypeOrString(type) { var indexType = getExtractStringType(getIndexType(type)); return 16384 & indexType.flags ? stringType : indexType } function getTypeFromTypeOperatorNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) switch (node.operator) { case 128: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; case 141: links.resolvedType = 138 === node.type.kind ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : unknownType }return links.resolvedType } function createIndexedAccessType(objectType, indexType) { var type = createType(1048576); return type.objectType = objectType, type.indexType = indexType, type } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { var accessExpression = accessNode && 185 === accessNode.kind ? accessNode : void 0, propName = isTypeUsableAsLateBoundName(indexType) ? getLateBoundNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, !1) ? ts.getPropertyNameForKnownSymbolName(ts.idText(accessExpression.argumentExpression.name)) : void 0; if (void 0 !== propName) { var prop = getPropertyOfType(objectType, propName); if (prop) { if (accessExpression) { if (markPropertyAsReferenced(prop, accessExpression, 99 === accessExpression.expression.kind), ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) return error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop)), unknownType; cacheSymbol && (getNodeLinks(accessNode).resolvedSymbol = prop) } return getTypeOfSymbol(prop) } } if (!(12288 & indexType.flags) && isTypeAssignableToKind(indexType, 1654)) { if (isTypeAny(objectType)) return objectType; var indexInfo = isTypeAssignableToKind(indexType, 84) && getIndexInfoOfType(objectType, 1) || getIndexInfoOfType(objectType, 0) || void 0; if (indexInfo) { if (accessNode && !isTypeAssignableToKind(indexType, 6)) { var indexNode = 185 === accessNode.kind ? accessNode.argumentExpression : accessNode.indexType; error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)) } else accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression)) && error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return indexInfo.type } if (16384 & indexType.flags) return neverType; if (accessExpression && !isConstEnumObjectType(objectType)) return noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && (getIndexTypeOfType(objectType, 1) ? error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number) : error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType))), anyType } if (accessNode) { var indexNode = 185 === accessNode.kind ? accessNode.argumentExpression : accessNode.indexType; 96 & indexType.flags ? error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)) : 6 & indexType.flags ? error(indexNode, ts.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)) : error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)) } return unknownType } function isGenericObjectType(type) { return maybeTypeOfKind(type, 544243712) } function isGenericIndexType(type) { return maybeTypeOfKind(type, 7897088) } function isStringIndexOnlyType(type) { if (65536 & type.flags && !isGenericMappedType(type)) { var t = resolveStructuredTypeMembers(type); return 0 === t.properties.length && 0 === t.callSignatures.length && 0 === t.constructSignatures.length && t.stringIndexInfo && !t.numberIndexInfo } return !1 } function isMappedTypeToNever(type) { return 32 & ts.getObjectFlags(type) && getTemplateTypeFromMappedType(type) === neverType } function getSimplifiedType(type) { return 1048576 & type.flags ? getSimplifiedIndexedAccessType(type) : type } function getSimplifiedIndexedAccessType(type) { if (type.simplified) return type.simplified === circularConstraintType ? type : type.simplified; type.simplified = circularConstraintType; var objectType = type.objectType; if (262144 & objectType.flags && isGenericObjectType(objectType)) { if (ts.some(objectType.types, isStringIndexOnlyType)) { for (var regularTypes = [], stringIndexTypes = [], _i = 0, _a = objectType.types; _i < _a.length; _i++) { var t = _a[_i]; isStringIndexOnlyType(t) ? stringIndexTypes.push(getIndexTypeOfType(t, 0)) : regularTypes.push(t) } return type.simplified = getUnionType([getSimplifiedType(getIndexedAccessType(getIntersectionType(regularTypes), type.indexType)), getIntersectionType(stringIndexTypes)]) } if (ts.some(objectType.types, isMappedTypeToNever)) { var nonNeverTypes = ts.filter(objectType.types, function (t) { return !isMappedTypeToNever(t) }); return type.simplified = getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType)) } } if (isGenericMappedType(objectType)) return type.simplified = substituteIndexedMappedType(objectType, type); if (32768 & objectType.flags) { var constraint = getConstraintFromTypeParameter(objectType); if (constraint && isGenericMappedType(constraint)) return type.simplified = substituteIndexedMappedType(constraint, type) } return type.simplified = type } function substituteIndexedMappedType(objectType, type) { var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [type.indexType]), templateMapper = combineTypeMappers(objectType.mapper, mapper); return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper) } function getIndexedAccessType(objectType, indexType, accessNode) { if (objectType === wildcardType || indexType === wildcardType) return wildcardType; if (isGenericIndexType(indexType) || (!accessNode || 185 !== accessNode.kind) && isGenericObjectType(objectType)) { if (1 & objectType.flags) return objectType; var id = objectType.id + "," + indexType.id, type = indexedAccessTypes.get(id); return type || indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)), type } var apparentObjectType = getApparentType(objectType); if (131072 & indexType.flags && !(8 & indexType.flags)) { for (var propTypes = [], _i = 0, _a = indexType.types; _i < _a.length; _i++) { var t = _a[_i], propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, !1); if (propType === unknownType) return unknownType; propTypes.push(propType) } return getUnionType(propTypes) } return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, !0) } function getTypeFromIndexedAccessTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var objectType = getTypeFromTypeNode(node.objectType), indexType = getTypeFromTypeNode(node.indexType), resolved = getIndexedAccessType(objectType, indexType, node); links.resolvedType = 1048576 & resolved.flags && resolved.objectType === objectType && resolved.indexType === indexType ? getConstrainedTypeVariable(resolved, node) : resolved } return links.resolvedType } function getTypeFromMappedTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var type = createObjectType(32, node.symbol); type.declaration = node, type.aliasSymbol = getAliasSymbolForTypeNode(node), type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(type.aliasSymbol), links.resolvedType = type, getConstraintTypeFromMappedType(type) } return links.resolvedType } function getActualTypeVariable(type) { return 4194304 & type.flags ? type.typeVariable : type } function getConditionalType(root, mapper) { var checkType = instantiateType(root.checkType, mapper), extendsType = instantiateType(root.extendsType, mapper); if (checkType === wildcardType || extendsType === wildcardType) return wildcardType; var combinedMapper, isDeferred = root.isDistributive && maybeTypeOfKind(checkType, 7897088); if (root.inferTypeParameters) { var context_1 = createInferenceContext(root.inferTypeParameters, void 0, 0); isDeferred || inferTypes(context_1.inferences, checkType, extendsType, 96), combinedMapper = combineTypeMappers(mapper, context_1) } if (!isDeferred) { if (1 & checkType.flags) return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]); var inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType; if (!isTypeAssignableTo(getWildcardInstantiation(checkType), getWildcardInstantiation(inferredExtendsType))) return instantiateType(root.falseType, mapper); if (checkTypeRelatedTo(checkType, inferredExtendsType, definitelyAssignableRelation, void 0)) return instantiateType(root.trueType, combinedMapper || mapper) } var erasedCheckType = getActualTypeVariable(checkType), result = createType(2097152); return result.root = root, result.checkType = erasedCheckType, result.extendsType = extendsType, result.mapper = mapper, result.combinedMapper = combinedMapper, result.aliasSymbol = root.aliasSymbol, result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper), result } function getTrueTypeFromConditionalType(type) { return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper)) } function getFalseTypeFromConditionalType(type) { return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); } function getInferTypeParameters(node) { var result; return node.locals && node.locals.forEach(function (symbol) { 262144 & symbol.flags && (result = ts.append(result, getDeclaredTypeOfSymbol(symbol))) }), result } function isPossiblyReferencedInConditionalType(tp, node) { if (isTypeParameterPossiblyReferenced(tp, node)) return !0; for (; node;) { if (170 === node.kind && isTypeParameterPossiblyReferenced(tp, node.extendsType)) return !0; node = node.parent } return !1 } function getTypeFromConditionalTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var checkType = getTypeFromTypeNode(node.checkType), aliasSymbol = getAliasSymbolForTypeNode(node), aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol), allOuterTypeParameters = getOuterTypeParameters(node, !0), outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node) }), root = { node: node, checkType: checkType, extendsType: getTypeFromTypeNode(node.extendsType), trueType: getTypeFromTypeNode(node.trueType), falseType: getTypeFromTypeNode(node.falseType), isDistributive: !!(32768 & checkType.flags), inferTypeParameters: getInferTypeParameters(node), outerTypeParameters: outerTypeParameters, instantiations: void 0, aliasSymbol: aliasSymbol, aliasTypeArguments: aliasTypeArguments }; links.resolvedType = getConditionalType(root, void 0), outerTypeParameters && (root.instantiations = ts.createMap(), root.instantiations.set(getTypeListId(outerTypeParameters), links.resolvedType)) } return links.resolvedType } function getTypeFromInferTypeNode(node) { var links = getNodeLinks(node); return links.resolvedType || (links.resolvedType = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))), links.resolvedType } function getIdentifierChain(node) { return ts.isIdentifier(node) ? [node] : ts.append(getIdentifierChain(node.left), node.right) } function getTypeFromImportTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { if (node.isTypeOf && node.typeArguments) return error(node, ts.Diagnostics.Type_arguments_cannot_be_used_here), links.resolvedSymbol = unknownSymbol, links.resolvedType = unknownType; if (!ts.isLiteralImportTypeNode(node)) return error(node.argument, ts.Diagnostics.String_literal_expected), links.resolvedSymbol = unknownSymbol, links.resolvedType = unknownType; var argumentType = getTypeFromTypeNode(node.argument), targetMeaning = node.isTypeOf ? 67216319 : 67901928, moduleName = argumentType.value, innerModuleSymbol = resolveExternalModule(node, moduleName, ts.Diagnostics.Cannot_find_module_0, node, !1); if (!innerModuleSymbol) return links.resolvedSymbol = unknownSymbol, links.resolvedType = unknownType; var moduleSymbol_1 = resolveExternalModuleSymbol(innerModuleSymbol, !1); if (ts.nodeIsMissing(node.qualifier)) moduleSymbol_1.flags & targetMeaning ? resolveImportSymbolType(node, links, moduleSymbol_1, targetMeaning) : (error(node, 67216319 === targetMeaning ? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here, moduleName), links.resolvedSymbol = unknownSymbol, links.resolvedType = unknownType); else { for (var nameStack = getIdentifierChain(node.qualifier), currentNamespace = moduleSymbol_1, current = void 0; current = nameStack.shift();) { var meaning = nameStack.length ? 1920 : targetMeaning, next = getSymbol(getExportsOfSymbol(getMergedSymbol(resolveSymbol(currentNamespace))), current.escapedText, meaning); if (!next) return error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current)), links.resolvedType = unknownType; getNodeLinks(current).resolvedSymbol = next, getNodeLinks(current.parent).resolvedSymbol = next, currentNamespace = next } resolveImportSymbolType(node, links, currentNamespace, targetMeaning) } } return links.resolvedType } function resolveImportSymbolType(node, links, symbol, meaning) { var resolvedSymbol = resolveSymbol(symbol); return links.resolvedSymbol = resolvedSymbol, 67216319 === meaning ? links.resolvedType = getTypeOfSymbol(symbol) : links.resolvedType = getTypeReferenceType(node, resolvedSymbol) } function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); if (0 !== getMembersOfSymbol(node.symbol).size || aliasSymbol) { var type = createObjectType(16, node.symbol); type.aliasSymbol = aliasSymbol, type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol), ts.isJSDocTypeLiteral(node) && node.isArrayType && (type = createArrayType(type)), links.resolvedType = type } else links.resolvedType = emptyTypeLiteralType } return links.resolvedType } function getAliasSymbolForTypeNode(node) { return ts.isTypeAlias(node.parent) ? getSymbolOfNode(node.parent) : void 0 } function getTypeArgumentsForAliasSymbol(symbol) { return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : void 0 } function getSpreadType(left, right, symbol, typeFlags, objectFlags) { if (1 & left.flags || 1 & right.flags) return anyType; if (16384 & left.flags) return right; if (16384 & right.flags) return left; if (131072 & left.flags) return mapType(left, function (t) { return getSpreadType(t, right, symbol, typeFlags, objectFlags) }); if (131072 & right.flags) return mapType(right, function (t) { return getSpreadType(left, t, symbol, typeFlags, objectFlags) }); if (134742526 & right.flags) return left; var stringIndexInfo, numberIndexInfo, members = ts.createSymbolTable(), skippedPrivateMembers = ts.createUnderscoreEscapedMap(); left === emptyObjectType ? (stringIndexInfo = getIndexInfoOfType(right, 0), numberIndexInfo = getIndexInfoOfType(right, 1)) : (stringIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 0), getIndexInfoOfType(right, 0)), numberIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 1), getIndexInfoOfType(right, 1))); for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i], isSetterWithoutGetter = 65536 & rightProp.flags && !(32768 & rightProp.flags); 24 & ts.getDeclarationModifierFlagsFromSymbol(rightProp) ? skippedPrivateMembers.set(rightProp.escapedName, !0) : isClassMethod(rightProp) || isSetterWithoutGetter || members.set(rightProp.escapedName, getNonReadonlySymbol(rightProp)) } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (!(65536 & leftProp.flags && !(32768 & leftProp.flags) || skippedPrivateMembers.has(leftProp.escapedName) || isClassMethod(leftProp))) if (members.has(leftProp.escapedName)) { var rightProp = members.get(leftProp.escapedName), rightType = getTypeOfSymbol(rightProp); if (16777216 & rightProp.flags) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations), flags = 4 | 16777216 & leftProp.flags, result = createSymbol(flags, leftProp.escapedName); result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072)]), result.leftSpread = leftProp, result.rightSpread = rightProp, result.declarations = declarations, result.nameType = leftProp.nameType, members.set(leftProp.escapedName, result) } } else members.set(leftProp.escapedName, getNonReadonlySymbol(leftProp)) } var spread = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getNonReadonlyIndexSignature(stringIndexInfo), getNonReadonlyIndexSignature(numberIndexInfo)); return spread.flags |= 33554432 | typeFlags, spread.objectFlags |= 1152 | objectFlags, spread } function getNonReadonlySymbol(prop) { if (!isReadonlySymbol(prop)) return prop; var flags = 4 | 16777216 & prop.flags, result = createSymbol(flags, prop.escapedName); return result.type = getTypeOfSymbol(prop), result.declarations = prop.declarations, result.nameType = prop.nameType, result.syntheticOrigin = prop, result } function getNonReadonlyIndexSignature(index) { return index && index.isReadonly ? createIndexInfo(index.type, !1, index.declaration) : index } function isClassMethod(prop) { return 8192 & prop.flags && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent) }) } function createLiteralType(flags, value, symbol) { var type = createType(flags); return type.symbol = symbol, type.value = value, type } function getFreshTypeOfLiteralType(type) { if (96 & type.flags && !(8388608 & type.flags)) { if (!type.freshType) { var freshType = createLiteralType(8388608 | type.flags, type.value, type.symbol); freshType.regularType = type, type.freshType = freshType } return type.freshType } return type } function getRegularTypeOfLiteralType(type) { return 96 & type.flags && 8388608 & type.flags ? type.regularType : 131072 & type.flags ? getUnionType(ts.sameMap(type.types, getRegularTypeOfLiteralType)) : type } function getLiteralType(value, enumId, symbol) { var qualifier = "number" == typeof value ? "#" : "@", key = enumId ? enumId + qualifier + value : qualifier + value, type = literalTypes.get(key); if (!type) { var flags = ("number" == typeof value ? 64 : 32) | (enumId ? 256 : 0); literalTypes.set(key, type = createLiteralType(flags, value, symbol)) } return type } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); return links.resolvedType || (links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal))), links.resolvedType } function createUniqueESSymbolType(symbol) { var type = createType(1024); return type.symbol = symbol, type } function getESSymbolLikeTypeForNode(node) { if (ts.isValidESSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node), links = getSymbolLinks(symbol); return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol)) } return esSymbolType } function getThisType(node) { var container = ts.getThisContainer(node, !1), parent = container && container.parent; return !parent || !ts.isClassLike(parent) && 235 !== parent.kind || ts.hasModifier(container, 32) || 154 === container.kind && !ts.isNodeDescendantOf(node, container.body) ? (error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface), unknownType) : getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType } function getTypeFromThisTypeNode(node) { var links = getNodeLinks(node); return links.resolvedType || (links.resolvedType = getThisType(node)), links.resolvedType } function getTypeFromTypeNode(node) { switch (node.kind) { case 119: case 278: case 279: return anyType; case 137: return stringType; case 134: return numberType; case 122: return booleanType; case 138: return esSymbolType; case 105: return voidType; case 140: return undefinedType; case 95: return nullType; case 131: return neverType; case 135: return 65536 & node.flags ? anyType : nonPrimitiveType; case 173: case 99: return getTypeFromThisTypeNode(node); case 177: return getTypeFromLiteralTypeNode(node); case 161: return getTypeFromTypeReference(node); case 160: return booleanType; case 206: return getTypeFromTypeReference(node); case 164: return getTypeFromTypeQueryNode(node); case 166: return getTypeFromArrayTypeNode(node); case 167: return getTypeFromTupleTypeNode(node); case 168: return getTypeFromUnionTypeNode(node); case 169: return getTypeFromIntersectionTypeNode(node); case 280: return getTypeFromJSDocNullableTypeNode(node); case 282: return addOptionality(getTypeFromTypeNode(node.type)); case 172: case 281: case 277: return getTypeFromTypeNode(node.type); case 284: return getTypeFromJSDocVariadicType(node); case 162: case 163: case 165: case 286: case 283: case 287: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 174: return getTypeFromTypeOperatorNode(node); case 175: return getTypeFromIndexedAccessTypeNode(node); case 176: return getTypeFromMappedTypeNode(node); case 170: return getTypeFromConditionalTypeNode(node); case 171: return getTypeFromInferTypeNode(node); case 178: return getTypeFromImportTypeNode(node); case 71: case 145: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType } } function instantiateList(items, mapper, instantiator) { if (items && items.length) for (var i = 0; i < items.length; i++) { var item = items[i], mapped = instantiator(item, mapper); if (item !== mapped) { var result = 0 === i ? [] : items.slice(0, i); for (result.push(mapped), i++; i < items.length; i++)result.push(instantiator(items[i], mapper)); return result } } return items } function instantiateTypes(types, mapper) { return instantiateList(types, mapper, instantiateType) } function instantiateSignatures(signatures, mapper) { return instantiateList(signatures, mapper, instantiateSignature) } function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t } } function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t } } function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++)if (t === sources[i]) return targets ? targets[i] : anyType; return t } } function createTypeMapper(sources, targets) { return ts.Debug.assert(void 0 === targets || sources.length === targets.length), 1 === sources.length ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : 2 === sources.length ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : makeArrayTypeMapper(sources, targets) } function createTypeEraser(sources) { return createTypeMapper(sources, void 0) } function createBackreferenceMapper(typeParameters, index) { return function (t) { return typeParameters.indexOf(t) >= index ? emptyObjectType : t } } function isInferenceContext(mapper) { return !!mapper.typeParameters } function cloneTypeMapper(mapper) { return mapper && isInferenceContext(mapper) ? createInferenceContext(mapper.typeParameters, mapper.signature, 2 | mapper.flags, mapper.compareTypes, mapper.inferences) : mapper } function combineTypeMappers(mapper1, mapper2) { return mapper1 ? mapper2 ? function (t) { return instantiateType(mapper1(t), mapper2) } : mapper1 : mapper2 } function createReplacementMapper(source, target, baseMapper) { return function (t) { return t === source ? target : baseMapper(t) } } function wildcardMapper(type) { return 32768 & type.flags ? wildcardType : type } function cloneTypeParameter(typeParameter) { var result = createType(32768); return result.symbol = typeParameter.symbol, result.target = typeParameter, result } function instantiateTypePredicate(predicate, mapper) { return ts.isIdentifierTypePredicate(predicate) ? { kind: 1, parameterName: predicate.parameterName, parameterIndex: predicate.parameterIndex, type: instantiateType(predicate.type, mapper) } : { kind: 0, type: instantiateType(predicate.type, mapper) } } function instantiateSignature(signature, mapper, eraseTypeParameters) { var freshTypeParameters; if (signature.typeParameters && !eraseTypeParameters) { freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter), mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) { var tp = freshTypeParameters_1[_i]; tp.mapper = mapper } } var result = createSignature(signature.declaration, freshTypeParameters, signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), void 0, void 0, signature.minArgumentCount, signature.hasRestParameter, signature.hasLiteralTypes); return result.target = signature, result.mapper = mapper, result } function instantiateSymbol(symbol, mapper) { var links = getSymbolLinks(symbol); if (links.type && !maybeTypeOfKind(links.type, 7962624)) return symbol; 1 & ts.getCheckFlags(symbol) && (symbol = links.target, mapper = combineTypeMappers(links.mapper, mapper)); var result = createSymbol(symbol.flags, symbol.escapedName, 1 | 1024 & ts.getCheckFlags(symbol)); return result.declarations = symbol.declarations, result.parent = symbol.parent, result.target = symbol, result.mapper = mapper, symbol.valueDeclaration && (result.valueDeclaration = symbol.valueDeclaration), symbol.nameType && (result.nameType = symbol.nameType), isTransientSymbol(symbol) && symbol.isRestParameter && (result.isRestParameter = symbol.isRestParameter), result } function getAnonymousTypeInstantiation(type, mapper) { var target = 64 & type.objectFlags ? type.target : type, symbol = target.symbol, links = getSymbolLinks(symbol), typeParameters = links.outerTypeParameters; if (!typeParameters) { var declaration_1 = symbol.declarations[0]; if (ts.isInJavaScriptFile(declaration_1)) { var paramTag = ts.findAncestor(declaration_1, ts.isJSDocParameterTag); if (paramTag) { var paramSymbol = ts.getParameterSymbolFromJSDoc(paramTag); paramSymbol && (declaration_1 = paramSymbol.valueDeclaration) } } var outerTypeParameters = getOuterTypeParameters(declaration_1, !0); if (isJavaScriptConstructor(declaration_1)) { var templateTagParameters = getTypeParametersFromDeclaration(declaration_1); outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters) } typeParameters = outerTypeParameters || ts.emptyArray, typeParameters = 2048 & symbol.flags && !target.aliasTypeArguments ? ts.filter(typeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, declaration_1) }) : typeParameters, links.outerTypeParameters = typeParameters, typeParameters.length && (links.instantiations = ts.createMap(), links.instantiations.set(getTypeListId(typeParameters), target)) } if (typeParameters.length) { var combinedMapper = 64 & type.objectFlags ? combineTypeMappers(type.mapper, mapper) : mapper, typeArguments = ts.map(typeParameters, combinedMapper), id = getTypeListId(typeArguments), result = links.instantiations.get(id); if (!result) { var newMapper = createTypeMapper(typeParameters, typeArguments); result = 32 & target.objectFlags ? instantiateMappedType(target, newMapper) : instantiateAnonymousType(target, newMapper), links.instantiations.set(id, result) } return result } return type } function maybeTypeParameterReference(node) { return !(145 === node.kind || 161 === node.parent.kind && node.parent.typeArguments && node === node.parent.typeName) } function isTypeParameterPossiblyReferenced(tp, node) { function containsReference(node) { switch (node.kind) { case 173: return tp.isThisType; case 71: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNode(node) === tp; case 164: return !0 }return ts.forEachChild(node, containsReference) } if (tp.symbol && tp.symbol.declarations && 1 === tp.symbol.declarations.length) { var container_3 = tp.symbol.declarations[0].parent; if (ts.findAncestor(node, function (n) { return 212 === n.kind ? "quit" : n === container_3 })) return ts.forEachChild(node, containsReference) } return !0 } function instantiateMappedType(type, mapper) { var constraintType = getConstraintTypeFromMappedType(type); if (524288 & constraintType.flags) { var typeVariable_1 = constraintType.type; if (32768 & typeVariable_1.flags) { var mappedTypeVariable = instantiateType(typeVariable_1, mapper); if (typeVariable_1 !== mappedTypeVariable) return mapType(mappedTypeVariable, function (t) { return isMappableType(t) ? instantiateAnonymousType(type, createReplacementMapper(typeVariable_1, t, mapper)) : t }) } } return instantiateAnonymousType(type, mapper) } function isMappableType(type) { return 7700481 & type.flags } function instantiateAnonymousType(type, mapper) { var result = createObjectType(64 | type.objectFlags, type.symbol); return 32 & type.objectFlags && (result.declaration = type.declaration), result.target = type, result.mapper = mapper, result.aliasSymbol = type.aliasSymbol, result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper), result } function getConditionalTypeInstantiation(type, mapper) { var root = type.root; if (root.outerTypeParameters) { var typeArguments = ts.map(root.outerTypeParameters, mapper), id = getTypeListId(typeArguments), result = root.instantiations.get(id); if (!result) { var newMapper = createTypeMapper(root.outerTypeParameters, typeArguments); result = instantiateConditionalType(root, newMapper), root.instantiations.set(id, result) } return result } return type } function instantiateConditionalType(root, mapper) { if (root.isDistributive) { var checkType_1 = root.checkType, instantiatedType = mapper(checkType_1); if (checkType_1 !== instantiatedType && 147456 & instantiatedType.flags) return mapType(instantiatedType, function (t) { return getConditionalType(root, createReplacementMapper(checkType_1, t, mapper)) }) } return getConditionalType(root, mapper) } function instantiateType(type, mapper) { if (type && mapper && mapper !== identityMapper) { if (32768 & type.flags) return mapper(type); if (65536 & type.flags) { if (16 & type.objectFlags) return type.symbol && 14384 & type.symbol.flags && type.symbol.declarations ? getAnonymousTypeInstantiation(type, mapper) : type; if (32 & type.objectFlags) return getAnonymousTypeInstantiation(type, mapper); if (4 & type.objectFlags) { var typeArguments = type.typeArguments, newTypeArguments = instantiateTypes(typeArguments, mapper); return newTypeArguments !== typeArguments ? createTypeReference(type.target, newTypeArguments) : type } } if (131072 & type.flags && !(16382 & type.flags)) { var types = type.types, newTypes = instantiateTypes(types, mapper); return newTypes !== types ? getUnionType(newTypes, 1, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type } if (262144 & type.flags) { var types = type.types, newTypes = instantiateTypes(types, mapper); return newTypes !== types ? getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type } if (524288 & type.flags) return getIndexType(instantiateType(type.type, mapper)); if (1048576 & type.flags) return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper)); if (2097152 & type.flags) return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper)); if (4194304 & type.flags) return instantiateType(type.typeVariable, mapper) } return type } function getWildcardInstantiation(type) { return 32767 & type.flags ? type : type.wildcardInstantiation || (type.wildcardInstantiation = instantiateType(type, wildcardMapper)) } function instantiateIndexInfo(info, mapper) { return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration) } function isContextSensitive(node) { switch (ts.Debug.assert(153 !== node.kind || ts.isObjectLiteralMethod(node)), node.kind) { case 191: case 192: case 153: return isContextSensitiveFunctionLikeDeclaration(node); case 183: return ts.forEach(node.properties, isContextSensitive); case 182: return ts.forEach(node.elements, isContextSensitive); case 200: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); case 199: return 54 === node.operatorToken.kind && (isContextSensitive(node.left) || isContextSensitive(node.right)); case 269: return isContextSensitive(node.initializer); case 190: return isContextSensitive(node.expression); case 262: return ts.forEach(node.properties, isContextSensitive); case 261: return node.initializer && isContextSensitive(node.initializer); case 264: return node.expression && isContextSensitive(node.expression) }return !1 } function isContextSensitiveFunctionLikeDeclaration(node) { if (node.typeParameters) return !1; if (ts.forEach(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p) })) return !0; if (192 !== node.kind) { var parameter = ts.firstOrUndefined(node.parameters); if (!parameter || !ts.parameterIsThisKeyword(parameter)) return !0 } return 212 !== node.body.kind && isContextSensitive(node.body) } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (ts.isInJavaScriptFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func) } function getTypeWithoutSignatures(type) { if (65536 & type.flags) { var resolved = resolveStructuredTypeMembers(type); if (resolved.constructSignatures.length) { var result = createObjectType(16, type.symbol); return result.members = resolved.members, result.properties = resolved.properties, result.callSignatures = ts.emptyArray, result.constructSignatures = ts.emptyArray, result } } else if (262144 & type.flags) return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); return type } function isTypeIdenticalTo(source, target) { return isTypeRelatedTo(source, target, identityRelation) } function compareTypesIdentical(source, target) { return isTypeRelatedTo(source, target, identityRelation) ? -1 : 0 } function compareTypesAssignable(source, target) { return isTypeRelatedTo(source, target, assignableRelation) ? -1 : 0 } function isTypeSubtypeOf(source, target) { return isTypeRelatedTo(source, target, subtypeRelation) } function isTypeAssignableTo(source, target) { return isTypeRelatedTo(source, target, assignableRelation) } function isTypeDerivedFrom(source, target) { return 131072 & source.flags ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target) }) : 131072 & target.flags ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t) }) : 7372800 & source.flags ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) : target === globalObjectType || target === globalFunctionType ? isTypeSubtypeOf(source, target) : hasBaseType(source, getTargetType(target)) } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation) } function areTypesComparable(type1, type2) { return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1) } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain) } function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain) } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { return 0 !== compareSignaturesRelated(source, target, 0, ignoreReturnTypes, !1, void 0, compareTypesAssignable) } function compareSignaturesRelated(source, target, callbackCheck, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { if (source === target) return -1; if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) return 0; source.typeParameters && source.typeParameters !== target.typeParameters && (target = getCanonicalSignature(target), source = instantiateSignatureInContextOf(source, target, void 0, compareTypes)); var kind = target.declaration ? target.declaration.kind : 0, strictVariance = !callbackCheck && strictFunctionTypes && 153 !== kind && 152 !== kind && 154 !== kind, result = -1, sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { var targetThisType = getThisTypeOfSignature(target); if (targetThisType) { var related = !strictVariance && compareTypes(sourceThisType, targetThisType, !1) || compareTypes(targetThisType, sourceThisType, reportErrors); if (!related) return reportErrors && errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible), 0; result &= related } } for (var sourceMax = getNumNonRestParameters(source), targetMax = getNumNonRestParameters(target), checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax), sourceParams = source.parameters, targetParams = target.parameters, i = 0; i < checkCount; i++) { var sourceType = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source), targetType = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target), sourceSig = callbackCheck ? void 0 : getSingleCallSignature(getNonNullableType(sourceType)), targetSig = callbackCheck ? void 0 : getSingleCallSignature(getNonNullableType(targetType)), callbacks = sourceSig && targetSig && !signatureHasTypePredicate(sourceSig) && !signatureHasTypePredicate(targetSig) && (12288 & getFalsyFlags(sourceType)) === (12288 & getFalsyFlags(targetType)), related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, strictVariance ? 2 : 1, !1, reportErrors, errorReporter, compareTypes) : !callbackCheck && !strictVariance && compareTypes(sourceType, targetType, !1) || compareTypes(targetType, sourceType, reportErrors); if (!related) return reportErrors && errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, ts.symbolName(sourceParams[i < sourceMax ? i : sourceMax]), ts.symbolName(targetParams[i < targetMax ? i : targetMax])), 0; result &= related } if (!ignoreReturnTypes) { var targetReturnType = getReturnTypeOfSignature(target); if (targetReturnType === voidType) return result; var sourceReturnType = getReturnTypeOfSignature(source), targetTypePredicate = getTypePredicateOfSignature(target); if (targetTypePredicate) { var sourceTypePredicate = getTypePredicateOfSignature(source); if (sourceTypePredicate) result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, source.declaration, target.declaration, reportErrors, errorReporter, compareTypes); else if (ts.isIdentifierTypePredicate(targetTypePredicate)) return reportErrors && errorReporter(ts.Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source)), 0 } else result &= 1 === callbackCheck && compareTypes(targetReturnType, sourceReturnType, !1) || compareTypes(sourceReturnType, targetReturnType, reportErrors) } return result } function compareTypePredicateRelatedTo(source, target, sourceDeclaration, targetDeclaration, reportErrors, errorReporter, compareTypes) { if (source.kind !== target.kind) return reportErrors && (errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard), errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target))), 0; if (1 === source.kind) { var targetPredicate = target, sourceIndex = source.parameterIndex - (ts.getThisParameter(sourceDeclaration) ? 1 : 0), targetIndex = targetPredicate.parameterIndex - (ts.getThisParameter(targetDeclaration) ? 1 : 0); if (sourceIndex !== targetIndex) return reportErrors && (errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, targetPredicate.parameterName), errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target))), 0 } var related = compareTypes(source.type, target.type, reportErrors); return 0 === related && reportErrors && errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)), related } function isImplementationCompatibleWithOverload(implementation, overload) { var erasedSource = getErasedSignature(implementation), erasedTarget = getErasedSignature(overload), sourceReturnType = getReturnTypeOfSignature(erasedSource), targetReturnType = getReturnTypeOfSignature(erasedTarget); return !(targetReturnType !== voidType && !isTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation) && !isTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation)) && isSignatureAssignableTo(erasedSource, erasedTarget, !0) } function getNumNonRestParameters(signature) { var numParams = signature.parameters.length; return signature.hasRestParameter ? numParams - 1 : numParams } function getNumParametersToCheckForSignatureRelatability(source, sourceNonRestParamCount, target, targetNonRestParamCount) { return source.hasRestParameter === target.hasRestParameter ? source.hasRestParameter ? Math.max(sourceNonRestParamCount, targetNonRestParamCount) + 1 : Math.min(sourceNonRestParamCount, targetNonRestParamCount) : source.hasRestParameter ? targetNonRestParamCount : sourceNonRestParamCount } function isEmptyResolvedType(t) { return 0 === t.properties.length && 0 === t.callSignatures.length && 0 === t.constructSignatures.length && !t.stringIndexInfo && !t.numberIndexInfo } function isEmptyObjectType(type) { return 65536 & type.flags ? isEmptyResolvedType(resolveStructuredTypeMembers(type)) : !!(134217728 & type.flags) || (131072 & type.flags ? ts.forEach(type.types, isEmptyObjectType) : !!(262144 & type.flags) && !ts.forEach(type.types, function (t) { return !isEmptyObjectType(t) })) } function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) { if (sourceSymbol === targetSymbol) return !0; var id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol), relation = enumRelation.get(id); if (void 0 !== relation) return relation; if (!(sourceSymbol.escapedName === targetSymbol.escapedName && 256 & sourceSymbol.flags && 256 & targetSymbol.flags)) return enumRelation.set(id, !1), !1; for (var targetEnumType = getTypeOfSymbol(targetSymbol), _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(sourceSymbol)); _i < _a.length; _i++) { var property = _a[_i]; if (8 & property.flags) { var targetProperty = getPropertyOfType(targetEnumType, property.escapedName); if (!(targetProperty && 8 & targetProperty.flags)) return errorReporter && errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, ts.symbolName(property), typeToString(getDeclaredTypeOfSymbol(targetSymbol), void 0, 64)), enumRelation.set(id, !1), !1 } } return enumRelation.set(id, !0), !0 } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { var s = source.flags, t = target.flags; if (1 & t || 16384 & s || source === wildcardType) return !0; if (16384 & t) return !1; if (34 & s && 2 & t) return !0; if (32 & s && 256 & s && 32 & t && !(256 & t) && source.value === target.value) return !0; if (84 & s && 4 & t) return !0; if (64 & s && 256 & s && 64 & t && !(256 & t) && source.value === target.value) return !0; if (136 & s && 8 & t) return !0; if (1536 & s && 512 & t) return !0; if (16 & s && 16 & t && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return !0; if (256 & s && 256 & t) { if (131072 & s && 131072 & t && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return !0; if (224 & s && 224 & t && source.value === target.value && isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter)) return !0 } if (4096 & s && (!strictNullChecks || 6144 & t)) return !0; if (8192 & s && (!strictNullChecks || 8192 & t)) return !0; if (65536 & s && 134217728 & t) return !0; if (1024 & s || 1024 & t) return !1; if (relation === assignableRelation || relation === definitelyAssignableRelation || relation === comparableRelation) { if (1 & s) return !0; if (68 & s && !(256 & s) && (16 & t || 64 & t && 256 & t)) return !0 } return !1 } function isTypeRelatedTo(source, target, relation) { if (96 & source.flags && 8388608 & source.flags && (source = source.regularType), 96 & target.flags && 8388608 & target.flags && (target = target.regularType), source === target || relation === comparableRelation && !(16384 & target.flags) && isSimpleTypeRelatedTo(target, source, relation) || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) return !0; if (65536 & source.flags && 65536 & target.flags) { var related = relation.get(getRelationKey(source, target, relation)); if (void 0 !== related) return 1 === related } return !!(8355840 & source.flags || 8355840 & target.flags) && checkTypeRelatedTo(source, target, relation, void 0) } function isIgnoredJsxProperty(source, sourceProp, targetMemberType) { return 4096 & ts.getObjectFlags(source) && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType) } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { function reportError(message, arg0, arg1, arg2) { ts.Debug.assert(!!errorNode), errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2) } function reportRelationError(message, source, target) { var sourceType = typeToString(source), targetType = typeToString(target); sourceType === targetType && (sourceType = typeToString(source, void 0, 64), targetType = typeToString(target, void 0, 64)), message || (message = relation === comparableRelation ? ts.Diagnostics.Type_0_is_not_comparable_to_type_1 : sourceType === targetType ? ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated : ts.Diagnostics.Type_0_is_not_assignable_to_type_1), reportError(message, sourceType, targetType) } function tryElaborateErrorsForPrimitivesAndObjects(source, target) { var sourceType = typeToString(source), targetType = typeToString(target); (globalStringType === source && stringType === target || globalNumberType === source && numberType === target || globalBooleanType === source && booleanType === target || getGlobalESSymbolType(!1) === source && esSymbolType === target) && reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType) } function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { if (!(393216 & type.flags)) return !1; for (var seenNonNullable = !1, _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; if (!(12288 & t.flags)) { if (seenNonNullable) return !0; seenNonNullable = !0 } } return !1 } function isRelatedTo(source, target, reportErrors, headMessage) { if (96 & source.flags && 8388608 & source.flags && (source = source.regularType), 96 & target.flags && 8388608 & target.flags && (target = target.regularType), 4194304 & source.flags && (source = relation === definitelyAssignableRelation ? source.typeVariable : source.substitute), 4194304 & target.flags && (target = target.typeVariable), 1048576 & source.flags && (source = getSimplifiedType(source)), 1048576 & target.flags && (target = getSimplifiedType(target)), source === target) return -1; if (relation === identityRelation) return isIdenticalTo(source, target); if (relation === comparableRelation && !(16384 & target.flags) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : void 0)) return -1; if (isObjectLiteralType(source) && 8388608 & source.flags) { var discriminantType = 131072 & target.flags ? findMatchingDiscriminantType(source, target) : void 0; if (hasExcessProperties(source, target, discriminantType, reportErrors)) return reportErrors && reportRelationError(headMessage, source, target), 0; isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType && (source = getRegularTypeOfObjectLiteral(source)) } if (relation !== comparableRelation && !(393216 & source.flags) && !(131072 & target.flags) && !isIntersectionConstituent && source !== globalObjectType && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)) && isWeakType(target) && !hasCommonProperties(source, target)) { if (reportErrors) { var calls = getSignaturesOfType(source, 0), constructs = getSignaturesOfType(source, 1); calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, !1) || constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, !1) ? reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, typeToString(source), typeToString(target)) : reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, typeToString(source), typeToString(target)) } return 0 } var result = 0, saveErrorInfo = errorInfo, saveIsIntersectionConstituent = isIntersectionConstituent; if (isIntersectionConstituent = !1, 131072 & source.flags ? result = relation === comparableRelation ? someTypeRelatedToType(source, target, reportErrors && !(16382 & source.flags)) : eachTypeRelatedToType(source, target, reportErrors && !(16382 & source.flags)) : (131072 & target.flags ? result = typeRelatedToSomeType(source, target, reportErrors && !(16382 & source.flags) && !(16382 & target.flags)) : 262144 & target.flags ? (isIntersectionConstituent = !0, result = typeRelatedToEachType(source, target, reportErrors)) : 262144 & source.flags && (result = someTypeRelatedToType(source, target, !1)), !result && (8355840 & source.flags || 8355840 & target.flags) && (result = recursiveTypeRelatedTo(source, target, reportErrors)) && (errorInfo = saveErrorInfo)), !result && 262144 & source.flags) { var constraint = getUnionConstraintOfIntersection(source, !!(131072 & target.flags)); constraint && (result = isRelatedTo(constraint, target, reportErrors)) && (errorInfo = saveErrorInfo) } return isIntersectionConstituent = saveIsIntersectionConstituent, !result && reportErrors && (65536 & source.flags && 16382 & target.flags ? tryElaborateErrorsForPrimitivesAndObjects(source, target) : source.symbol && 65536 & source.flags && globalObjectType === source && reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead), reportRelationError(headMessage, source, target)), result } function isIdenticalTo(source, target) { var result, flags = source.flags & target.flags; return 65536 & flags ? recursiveTypeRelatedTo(source, target, !1) : 393216 & flags && (result = eachTypeRelatedToSomeType(source, target)) && (result &= eachTypeRelatedToSomeType(target, source)) ? result : 524288 & flags ? isRelatedTo(source.type, target.type, !1) : 1048576 & flags && (result = isRelatedTo(source.objectType, target.objectType, !1)) && (result &= isRelatedTo(source.indexType, target.indexType, !1)) ? result : 2097152 & flags && source.root.isDistributive === target.root.isDistributive && (result = isRelatedTo(source.checkType, target.checkType, !1)) && (result &= isRelatedTo(source.extendsType, target.extendsType, !1)) && (result &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), !1)) && (result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), !1)) ? result : 4194304 & flags ? isRelatedTo(source.substitute, target.substitute, !1) : 0 } function hasExcessProperties(source, target, discriminant, reportErrors) { if (maybeTypeOfKind(target, 65536) && !(512 & ts.getObjectFlags(target))) { var isComparingJsxAttributes = !!(4096 & ts.getObjectFlags(source)); if ((relation === assignableRelation || relation === definitelyAssignableRelation || relation === comparableRelation) && (isTypeSubsetOf(globalObjectType, target) || !isComparingJsxAttributes && isEmptyObjectType(target))) return !1; if (discriminant) return hasExcessProperties(source, discriminant, void 0, reportErrors); for (var _loop_6 = function (prop) { if (!isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) if (ts.Debug.assert(!!errorNode), ts.isJsxAttributes(errorNode) || ts.isJsxOpeningLikeElement(errorNode)) reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target)); else { var objectLiteralDeclaration_1 = source.symbol && ts.firstOrUndefined(source.symbol.declarations), suggestion = void 0; if (prop.valueDeclaration && ts.findAncestor(prop.valueDeclaration, function (d) { return d === objectLiteralDeclaration_1 })) { var propDeclaration = prop.valueDeclaration; ts.Debug.assertNode(propDeclaration, ts.isObjectLiteralElementLike), errorNode = propDeclaration, ts.isIdentifier(propDeclaration.name) && (suggestion = getSuggestionForNonexistentProperty(propDeclaration.name, target)) } void 0 !== suggestion ? reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(target), suggestion) : reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)) } return { value: !0 } } }, _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i], state_3 = _loop_6(prop); if ("object" == typeof state_3) return state_3.value } } return !1 } function eachTypeRelatedToSomeType(source, target) { for (var result = -1, sourceTypes = source.types, _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { var sourceType = sourceTypes_1[_i], related = typeRelatedToSomeType(sourceType, target, !1); if (!related) return 0; result &= related } return result } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; if (131072 & target.flags && containsType(targetTypes, source)) return -1; for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { var type = targetTypes_1[_i], related = isRelatedTo(source, type, !1); if (related) return related } if (reportErrors) { var discriminantType = findMatchingDiscriminantType(source, target); isRelatedTo(source, discriminantType || targetTypes[targetTypes.length - 1], !0) } return 0 } function findMatchingDiscriminantType(source, target) { var match, sourceProperties = getPropertiesOfObjectType(source); if (sourceProperties) { var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target); if (sourcePropertiesFiltered) for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++)for (var sourceProperty = sourcePropertiesFiltered_1[_i], sourceType = getTypeOfSymbol(sourceProperty), _a = 0, _b = target.types; _a < _b.length; _a++) { var type = _b[_a], targetType = getTypeOfPropertyOfType(type, sourceProperty.escapedName); if (targetType && isRelatedTo(sourceType, targetType)) { if (type === match) continue; if (match) return; match = type } } } return match } function typeRelatedToEachType(source, target, reportErrors) { for (var result = -1, targetTypes = target.types, _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { var targetType = targetTypes_2[_i], related = isRelatedTo(source, targetType, reportErrors); if (!related) return 0; result &= related } return result } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; if (131072 & source.flags && containsType(sourceTypes, target)) return -1; for (var len = sourceTypes.length, i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) return related } return 0 } function eachTypeRelatedToType(source, target, reportErrors) { for (var result = -1, sourceTypes = source.types, _i = 0, sourceTypes_2 = sourceTypes; _i < sourceTypes_2.length; _i++) { var sourceType = sourceTypes_2[_i], related = isRelatedTo(sourceType, target, reportErrors); if (!related) return 0; result &= related } return result } function typeArgumentsRelatedTo(source, target, variances, reportErrors) { var sources = source.typeArguments || ts.emptyArray, targets = target.typeArguments || ts.emptyArray; if (sources.length !== targets.length && relation === identityRelation) return 0; for (var length = sources.length <= targets.length ? sources.length : targets.length, result = -1, i = 0; i < length; i++) { var variance = i < variances.length ? variances[i] : 1; if (4 !== variance) { var s = sources[i], t = targets[i], related = -1; if (1 === variance ? related = isRelatedTo(s, t, reportErrors) : 2 === variance ? related = isRelatedTo(t, s, reportErrors) : 3 === variance ? (related = isRelatedTo(t, s, !1), related || (related = isRelatedTo(s, t, reportErrors))) : (related = isRelatedTo(s, t, reportErrors), related && (related &= isRelatedTo(t, s, reportErrors))), !related) return 0; result &= related } } return result } function recursiveTypeRelatedTo(source, target, reportErrors) { if (overflow) return 0; var id = getRelationKey(source, target, relation), related = relation.get(id); if (void 0 !== related) { if (!reportErrors || 2 !== related) return 1 === related ? -1 : 0; relation.set(id, 3) } if (maybeKeys) { for (var i = 0; i < maybeCount; i++)if (id === maybeKeys[i]) return 1; if (100 === depth) return overflow = !0, 0 } else maybeKeys = [], sourceStack = [], targetStack = []; var maybeStart = maybeCount; maybeKeys[maybeCount] = id, maybeCount++ , sourceStack[depth] = source, targetStack[depth] = target, depth++; var saveExpandingFlags = expandingFlags; 1 & expandingFlags || !isDeeplyNestedType(source, sourceStack, depth) || (expandingFlags |= 1), 2 & expandingFlags || !isDeeplyNestedType(target, targetStack, depth) || (expandingFlags |= 2); var result = 3 !== expandingFlags ? structuredTypeRelatedTo(source, target, reportErrors) : 1; if (expandingFlags = saveExpandingFlags, depth-- , result) { if (result === -1 || 0 === depth) { for (var i = maybeStart; i < maybeCount; i++)relation.set(maybeKeys[i], 1); maybeCount = maybeStart } } else relation.set(id, reportErrors ? 3 : 2), maybeCount = maybeStart; return result } function getConstraintForRelation(type) { return relation === definitelyAssignableRelation ? void 0 : getConstraintOfType(type) } function structuredTypeRelatedTo(source, target, reportErrors) { var result, originalErrorInfo, saveErrorInfo = errorInfo; if (32768 & target.flags) { if (32 & ts.getObjectFlags(source) && getConstraintTypeFromMappedType(source) === getIndexType(target) && !(4 & getMappedTypeModifiers(source))) { var templateType = getTemplateTypeFromMappedType(source), indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) return result } } else if (524288 & target.flags) { if (524288 & source.flags && (result = isRelatedTo(target.type, source.type, !1))) return result; if (relation !== definitelyAssignableRelation) { var simplified = getSimplifiedType(target.type), constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type); if (constraint && (result = isRelatedTo(source, getIndexType(constraint, target.stringsOnly), reportErrors))) return result } } else if (1048576 & target.flags) { var constraint = getConstraintForRelation(target); if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) return errorInfo = saveErrorInfo, result } else if (isGenericMappedType(target)) { var template = getTemplateTypeFromMappedType(target), modifiers = getMappedTypeModifiers(target); if (!(8 & modifiers)) { if (1048576 & template.flags && template.objectType === source && template.indexType === getTypeParameterFromMappedType(target)) return -1; if (!isGenericMappedType(source) && getConstraintTypeFromMappedType(target) === getIndexType(source)) { var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)), templateType = getTemplateTypeFromMappedType(target); if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) return errorInfo = saveErrorInfo, result } } } if (1081344 & source.flags) { if (1048576 & source.flags && 1048576 & target.flags && ((result = isRelatedTo(source.objectType, target.objectType, reportErrors)) && (result &= isRelatedTo(source.indexType, target.indexType, reportErrors)), result)) return errorInfo = saveErrorInfo, result; var constraint = getConstraintForRelation(source); if (!constraint || 32768 & source.flags && 1 & constraint.flags) { if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, -134217729))) return errorInfo = saveErrorInfo, result } else { var instantiated = getTypeWithThisArgument(constraint, source); if (result = isRelatedTo(instantiated, target, reportErrors)) return errorInfo = saveErrorInfo, result } } else if (524288 & source.flags) { if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) return errorInfo = saveErrorInfo, result } else if (2097152 & source.flags) { if (2097152 & target.flags) { if (isTypeIdenticalTo(source.extendsType, target.extendsType) && (isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType)) && ((result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) && (result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors)), result)) return errorInfo = saveErrorInfo, result } else if (relation !== definitelyAssignableRelation) { var distributiveConstraint = getConstraintOfDistributiveConditionalType(source); if (distributiveConstraint && (result = isRelatedTo(distributiveConstraint, target, reportErrors))) return errorInfo = saveErrorInfo, result; var defaultConstraint = getDefaultConstraintOfConditionalType(source); if (defaultConstraint && (result = isRelatedTo(defaultConstraint, target, reportErrors))) return errorInfo = saveErrorInfo, result } } else { if (4 & ts.getObjectFlags(source) && 4 & ts.getObjectFlags(target) && source.target === target.target && !(8192 & ts.getObjectFlags(source) || 8192 & ts.getObjectFlags(target))) { var variances = getVariances(source.target); if (result = typeArgumentsRelatedTo(source, target, variances, reportErrors)) return result; if (variances !== ts.emptyArray && !hasCovariantVoidArgument(target, variances)) { if (!reportErrors || !ts.some(variances, function (v) { return 0 === v })) return 0; originalErrorInfo = errorInfo, errorInfo = saveErrorInfo } } var sourceIsPrimitive = !!(16382 & source.flags); if (relation !== identityRelation && (source = getApparentType(source)), 327680 & source.flags && 65536 & target.flags) { var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; if (isPartialMappedType(target) && !isGenericMappedType(source) && isEmptyObjectType(source) ? result = -1 : isGenericMappedType(target) ? result = isGenericMappedType(source) ? mappedTypeRelatedTo(source, target, reportStructuralErrors) : 0 : (result = propertiesRelatedTo(source, target, reportStructuralErrors), result && (result &= signaturesRelatedTo(source, target, 0, reportStructuralErrors), result && (result &= signaturesRelatedTo(source, target, 1, reportStructuralErrors), result && (result &= indexTypesRelatedTo(source, target, 0, sourceIsPrimitive, reportStructuralErrors), result && (result &= indexTypesRelatedTo(source, target, 1, sourceIsPrimitive, reportStructuralErrors)))))), result) { if (!originalErrorInfo) return errorInfo = saveErrorInfo, result; errorInfo = originalErrorInfo } } } return 0 } function mappedTypeRelatedTo(source, target, reportErrors) { var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) : getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target)); if (modifiersRelated) { var result_2; if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors) } } return 0 } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) return propertiesIdenticalTo(source, target); var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source), unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties); if (unmatchedProperty) return reportErrors && reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(unmatchedProperty), typeToString(source)), 0; if (isObjectLiteralType(target)) for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { var sourceProp = _a[_i]; if (!getPropertyOfObjectType(target, sourceProp.escapedName)) { var sourceType = getTypeOfSymbol(sourceProp); if (sourceType !== undefinedType && sourceType !== undefinedWideningType) return reportErrors && reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target)), 0 } } for (var result = -1, properties = getPropertiesOfObjectType(target), _b = 0, properties_3 = properties; _b < properties_3.length; _b++) { var targetProp = properties_3[_b]; if (!(4194304 & targetProp.flags)) { var sourceProp = getPropertyOfType(source, targetProp.escapedName); if (sourceProp && sourceProp !== targetProp) { if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) continue; var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp), targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp); if (8 & sourcePropFlags || 8 & targetPropFlags) { var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration; if (256 & ts.getCheckFlags(sourceProp) && hasDifferingDeclarations) return reportErrors && reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)), 0; if (hasDifferingDeclarations) return reportErrors && (8 & sourcePropFlags && 8 & targetPropFlags ? reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)) : reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(8 & sourcePropFlags ? source : target), typeToString(8 & sourcePropFlags ? target : source))), 0 } else if (16 & targetPropFlags) { if (!isValidOverrideOf(sourceProp, targetProp)) return reportErrors && reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)), 0 } else if (16 & sourcePropFlags) return reportErrors && reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)), 0; var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); if (!related) return reportErrors && reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)), 0; if (result &= related, relation !== comparableRelation && 16777216 & sourceProp.flags && !(16777216 & targetProp.flags)) return reportErrors && reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)), 0 } } } return result } function isWeakType(type) { if (65536 & type.flags) { var resolved = resolveStructuredTypeMembers(type); return 0 === resolved.callSignatures.length && 0 === resolved.constructSignatures.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo && resolved.properties.length > 0 && ts.every(resolved.properties, function (p) { return !!(16777216 & p.flags) }) } return !!(262144 & type.flags) && ts.every(type.types, isWeakType) } function hasCommonProperties(source, target) { for (var isComparingJsxAttributes = !!(4096 & ts.getObjectFlags(source)), _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) return !0 } return !1 } function propertiesIdenticalTo(source, target) { if (!(65536 & source.flags && 65536 & target.flags)) return 0; var sourceProperties = getPropertiesOfObjectType(source), targetProperties = getPropertiesOfObjectType(target); if (sourceProperties.length !== targetProperties.length) return 0; for (var result = -1, _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { var sourceProp = sourceProperties_1[_i], targetProp = getPropertyOfObjectType(target, sourceProp.escapedName); if (!targetProp) return 0; var related = compareProperties(sourceProp, targetProp, isRelatedTo); if (!related) return 0; result &= related } return result } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) return signaturesIdenticalTo(source, target, kind); if (target === anyFunctionType || source === anyFunctionType) return -1; var sourceSignatures = getSignaturesOfType(source, kind), targetSignatures = getSignaturesOfType(target, kind); if (1 === kind && sourceSignatures.length && targetSignatures.length) { if (ts.isAbstractConstructorType(source) && !ts.isAbstractConstructorType(target)) return reportErrors && reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type), 0; if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) return 0 } var result = -1, saveErrorInfo = errorInfo; if (64 & ts.getObjectFlags(source) && 64 & ts.getObjectFlags(target) && source.symbol === target.symbol) for (var i = 0; i < targetSignatures.length; i++) { var related = signatureRelatedTo(sourceSignatures[i], targetSignatures[i], !0, reportErrors); if (!related) return 0; result &= related } else if (1 === sourceSignatures.length && 1 === targetSignatures.length) { var eraseGenerics = relation === comparableRelation || compilerOptions.noStrictGenericChecks; result = signatureRelatedTo(sourceSignatures[0], targetSignatures[0], eraseGenerics, reportErrors) } else outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { for (var t = targetSignatures_1[_i], shouldElaborateErrors = reportErrors, _a = 0, sourceSignatures_1 = sourceSignatures; _a < sourceSignatures_1.length; _a++) { var s = sourceSignatures_1[_a], related = signatureRelatedTo(s, t, !0, shouldElaborateErrors); if (related) { result &= related, errorInfo = saveErrorInfo; continue outer } shouldElaborateErrors = !1 } return shouldElaborateErrors && reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, void 0, void 0, kind)), 0 } return result } function signatureRelatedTo(source, target, erase, reportErrors) { return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, 0, !1, reportErrors, reportError, isRelatedTo) } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind), targetSignatures = getSignaturesOfType(target, kind); if (sourceSignatures.length !== targetSignatures.length) return 0; for (var result = -1, i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], !1, !1, !1, isRelatedTo); if (!related) return 0; result &= related } return result } function eachPropertyRelatedTo(source, target, kind, reportErrors) { for (var result = -1, _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isIgnoredJsxProperty(source, prop, void 0) && !(prop.nameType && 1024 & prop.nameType.flags) && (0 === kind || isNumericLiteralName(prop.escapedName))) { var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); if (!related) return reportErrors && reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)), 0; result &= related } } return result } function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) { var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors); return !related && reportErrors && reportError(ts.Diagnostics.Index_signatures_are_incompatible), related } function indexTypesRelatedTo(source, target, kind, sourceIsPrimitive, reportErrors) { if (relation === identityRelation) return indexTypesIdenticalTo(source, target, kind); var targetInfo = getIndexInfoOfType(target, kind); if (!targetInfo || 1 & targetInfo.type.flags && !sourceIsPrimitive) return -1; var sourceInfo = getIndexInfoOfType(source, kind) || 1 === kind && getIndexInfoOfType(source, 0); if (sourceInfo) return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); if (isGenericMappedType(source)) return 0 === kind && isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, reportErrors); if (isObjectTypeWithInferableIndex(source)) { var related = -1; if (0 === kind) { var sourceNumberInfo = getIndexInfoOfType(source, 1); sourceNumberInfo && (related = indexInfoRelatedTo(sourceNumberInfo, targetInfo, reportErrors)) } return related && (related &= eachPropertyRelatedTo(source, targetInfo.type, kind, reportErrors)), related } return reportErrors && reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)), 0 } function indexTypesIdenticalTo(source, target, indexKind) { var targetInfo = getIndexInfoOfType(target, indexKind), sourceInfo = getIndexInfoOfType(source, indexKind); return sourceInfo || targetInfo ? sourceInfo && targetInfo && sourceInfo.isReadonly === targetInfo.isReadonly ? isRelatedTo(sourceInfo.type, targetInfo.type) : 0 : -1 } function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) { if (!sourceSignature.declaration || !targetSignature.declaration) return !0; var sourceAccessibility = ts.getSelectedModifierFlags(sourceSignature.declaration, 24), targetAccessibility = ts.getSelectedModifierFlags(targetSignature.declaration, 24); return 8 === targetAccessibility || (16 === targetAccessibility && 8 !== sourceAccessibility || (16 !== targetAccessibility && !sourceAccessibility || (reportErrors && reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)), !1))) } var errorInfo, maybeKeys, sourceStack, targetStack, maybeCount = 0, depth = 0, expandingFlags = 0, overflow = !1, isIntersectionConstituent = !1; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); var result = isRelatedTo(source, target, !!errorNode, headMessage); if (overflow) error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); else if (errorInfo) { if (containingMessageChain) { var chain_1 = containingMessageChain(); chain_1 && (errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo)) } diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo)) } if (headMessage && errorNode && !result && source.symbol) { var links = getSymbolLinks(source.symbol); if (links.originatingImport && !ts.isImportCall(links.originatingImport)) { var helpfulRetry = checkTypeRelatedTo(getTypeOfSymbol(links.target), target, relation, void 0); helpfulRetry && diagnostics.add(ts.createDiagnosticForNode(links.originatingImport, ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime)) } } return 0 !== result } function getMarkerTypeReference(type, source, target) { var result = createTypeReference(type, ts.map(type.typeParameters, function (t) { return t === source ? target : t })); return result.objectFlags |= 8192, result } function getVariances(type) { if (!strictFunctionTypes) return ts.emptyArray; var typeParameters = type.typeParameters || ts.emptyArray, variances = type.variances; if (!variances) { if (type === globalArrayType || type === globalReadonlyArrayType) variances = [1]; else { type.variances = ts.emptyArray, variances = []; for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { var tp = typeParameters_1[_i], typeWithSuper = getMarkerTypeReference(type, tp, markerSuperType), typeWithSub = getMarkerTypeReference(type, tp, markerSubType), variance = (isTypeAssignableTo(typeWithSub, typeWithSuper) ? 1 : 0) | (isTypeAssignableTo(typeWithSuper, typeWithSub) ? 2 : 0); 3 === variance && isTypeAssignableTo(getMarkerTypeReference(type, tp, markerOtherType), typeWithSuper) && (variance = 4), variances.push(variance) } } type.variances = variances } return variances } function hasCovariantVoidArgument(type, variances) { for (var i = 0; i < variances.length; i++)if (1 === variances[i] && 2048 & type.typeArguments[i].flags) return !0; return !1 } function isUnconstrainedTypeParameter(type) { return 32768 & type.flags && !getConstraintFromTypeParameter(type) } function isTypeReferenceWithGenericArguments(type) { return 4 & ts.getObjectFlags(type) && ts.some(type.typeArguments, function (t) { return isUnconstrainedTypeParameter(t) || isTypeReferenceWithGenericArguments(t) }) } function getTypeReferenceId(type, typeParameters, depth) { void 0 === depth && (depth = 0); for (var result = "" + type.target.id, _i = 0, _a = type.typeArguments; _i < _a.length; _i++) { var t = _a[_i]; if (isUnconstrainedTypeParameter(t)) { var index = typeParameters.indexOf(t); index < 0 && (index = typeParameters.length, typeParameters.push(t)), result += "=" + index } else result += depth < 4 && isTypeReferenceWithGenericArguments(t) ? "<" + getTypeReferenceId(t, typeParameters, depth + 1) + ">" : "-" + t.id } return result } function getRelationKey(source, target, relation) { if (relation === identityRelation && source.id > target.id) { var temp = source; source = target, target = temp } if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) { var typeParameters = []; return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) } return source.id + "," + target.id } function forEachProperty(prop, callback) { if (!(6 & ts.getCheckFlags(prop))) return callback(prop); for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { var t = _a[_i], p = getPropertyOfType(t, prop.escapedName), result = p && forEachProperty(p, callback); if (result) return result } } function getDeclaringClass(prop) { return prop.parent && 32 & prop.parent.flags ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : void 0 } function isPropertyInClassDerivedFrom(prop, baseClass) { return forEachProperty(prop, function (sp) { var sourceClass = getDeclaringClass(sp); return !!sourceClass && hasBaseType(sourceClass, baseClass) }) } function isValidOverrideOf(sourceProp, targetProp) { return !forEachProperty(targetProp, function (tp) { return !!(16 & ts.getDeclarationModifierFlagsFromSymbol(tp)) && !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) }) } function isClassDerivedFromDeclaringClasses(checkClass, prop) { return forEachProperty(prop, function (p) { return !!(16 & ts.getDeclarationModifierFlagsFromSymbol(p)) && !hasBaseType(checkClass, getDeclaringClass(p)) }) ? void 0 : checkClass } function isDeeplyNestedType(type, stack, depth) { if (depth >= 5 && 65536 & type.flags) { var symbol = type.symbol; if (symbol) for (var count = 0, i = 0; i < depth; i++) { var t = stack[i]; if (65536 & t.flags && t.symbol === symbol && (count++ , count >= 5)) return !0 } } return !1 } function isPropertyIdenticalTo(sourceProp, targetProp) { return 0 !== compareProperties(sourceProp, targetProp, compareTypesIdentical) } function compareProperties(sourceProp, targetProp, compareTypes) { if (sourceProp === targetProp) return -1; var sourcePropAccessibility = 24 & ts.getDeclarationModifierFlagsFromSymbol(sourceProp), targetPropAccessibility = 24 & ts.getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropAccessibility !== targetPropAccessibility) return 0; if (sourcePropAccessibility) { if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) return 0 } else if ((16777216 & sourceProp.flags) !== (16777216 & targetProp.flags)) return 0; return isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp) ? 0 : compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)) } function isMatchingSignature(source, target, partialMatch) { if (source.parameters.length === target.parameters.length && source.minArgumentCount === target.minArgumentCount && source.hasRestParameter === target.hasRestParameter) return !0; var sourceRestCount = source.hasRestParameter ? 1 : 0, targetRestCount = target.hasRestParameter ? 1 : 0; return !!(partialMatch && source.minArgumentCount <= target.minArgumentCount && (sourceRestCount > targetRestCount || sourceRestCount === targetRestCount && source.parameters.length >= target.parameters.length)) } function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { if (source === target) return -1; if (!isMatchingSignature(source, target, partialMatch)) return 0; if (ts.length(source.typeParameters) !== ts.length(target.typeParameters)) return 0; source = getErasedSignature(source), target = getErasedSignature(target); var result = -1; if (!ignoreThisTypes) { var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType) { var targetThisType = getThisTypeOfSignature(target); if (targetThisType) { var related = compareTypes(sourceThisType, targetThisType); if (!related) return 0; result &= related } } } for (var targetLen = target.parameters.length, i = 0; i < targetLen; i++) { var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]), t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]), related = compareTypes(s, t); if (!related) return 0; result &= related } if (!ignoreReturnTypes) { var sourceTypePredicate = getTypePredicateOfSignature(source), targetTypePredicate = getTypePredicateOfSignature(target); result &= void 0 !== sourceTypePredicate || void 0 !== targetTypePredicate ? compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes) : compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)) } return result } function compareTypePredicatesIdentical(source, target, compareTypes) { return void 0 !== source && void 0 !== target && typePredicateKindsMatch(source, target) ? compareTypes(source.type, target.type) : 0 } function isRestParameterIndex(signature, parameterIndex) { return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1 } function literalTypesWithSameBaseType(types) { for (var commonBaseType, _i = 0, types_9 = types; _i < types_9.length; _i++) { var t = types_9[_i], baseType = getBaseTypeOfLiteralType(t); if (commonBaseType || (commonBaseType = baseType), baseType === t || baseType !== commonBaseType) return !1 } return !0 } function getSupertypeOrUnion(types) { return literalTypesWithSameBaseType(types) ? getUnionType(types) : ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s }) } function getCommonSupertype(types) { if (!strictNullChecks) return getSupertypeOrUnion(types); var primaryTypes = ts.filter(types, function (t) { return !(12288 & t.flags) }); return primaryTypes.length ? getNullableType(getSupertypeOrUnion(primaryTypes), 12288 & getFalsyFlagsOfTypes(types)) : getUnionType(types, 2) } function getCommonSubtype(types) { return ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(t, s) ? t : s }) } function isArrayType(type) { return 4 & ts.getObjectFlags(type) && type.target === globalArrayType } function isArrayLikeType(type) { return 4 & ts.getObjectFlags(type) && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || !(12288 & type.flags) && isTypeAssignableTo(type, anyReadonlyArrayType) } function isEmptyArrayLiteralType(type) { var elementType = isArrayType(type) ? type.typeArguments[0] : void 0; return elementType === undefinedWideningType || elementType === implicitNeverType } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0") } function isNeitherUnitTypeNorNever(type) { return !(29920 & type.flags) } function isUnitType(type) { return !!(13536 & type.flags) } function isLiteralType(type) { return !!(8 & type.flags) || (131072 & type.flags ? !!(256 & type.flags) || !ts.forEach(type.types, function (t) { return !isUnitType(t) }) : isUnitType(type)) } function getBaseTypeOfLiteralType(type) { return 256 & type.flags ? getBaseTypeOfEnumLiteralType(type) : 32 & type.flags ? stringType : 64 & type.flags ? numberType : 128 & type.flags ? booleanType : 131072 & type.flags ? getUnionType(ts.sameMap(type.types, getBaseTypeOfLiteralType)) : type } function getWidenedLiteralType(type) { return 256 & type.flags ? getBaseTypeOfEnumLiteralType(type) : 32 & type.flags && 8388608 & type.flags ? stringType : 64 & type.flags && 8388608 & type.flags ? numberType : 128 & type.flags ? booleanType : 131072 & type.flags ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) : type } function getWidenedUniqueESSymbolType(type) { return 1024 & type.flags ? esSymbolType : 131072 & type.flags ? getUnionType(ts.sameMap(type.types, getWidenedUniqueESSymbolType)) : type } function getWidenedLiteralLikeTypeForContextualType(type, contextualType) { return isLiteralOfContextualType(type, contextualType) || (type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type))), type } function isTupleType(type) { return !!(4 & ts.getObjectFlags(type) && 8 & type.target.objectFlags) } function getFalsyFlagsOfTypes(types) { for (var result = 0, _i = 0, types_10 = types; _i < types_10.length; _i++) { var t = types_10[_i]; result |= getFalsyFlags(t) } return result } function getFalsyFlags(type) { return 131072 & type.flags ? getFalsyFlagsOfTypes(type.types) : 32 & type.flags ? "" === type.value ? 32 : 0 : 64 & type.flags ? 0 === type.value ? 64 : 0 : 128 & type.flags ? type === falseType ? 128 : 0 : 14574 & type.flags } function removeDefinitelyFalsyTypes(type) { return 14560 & getFalsyFlags(type) ? filterType(type, function (t) { return !(14560 & getFalsyFlags(t)) }) : type } function extractDefinitelyFalsyTypes(type) { return mapType(type, getDefinitelyFalsyPartOfType) } function getDefinitelyFalsyPartOfType(type) { return 2 & type.flags ? emptyStringType : 4 & type.flags ? zeroType : 8 & type.flags || type === falseType ? falseType : 14336 & type.flags || 32 & type.flags && "" === type.value || 64 & type.flags && 0 === type.value ? type : neverType } function getNullableType(type, flags) { var missing = flags & ~type.flags & 12288; return 0 === missing ? type : getUnionType(4096 === missing ? [type, undefinedType] : 8192 === missing ? [type, nullType] : [type, undefinedType, nullType]) } function getOptionalType(type) { return ts.Debug.assert(strictNullChecks), 4096 & type.flags ? type : getUnionType([type, undefinedType]) } function getGlobalNonNullableTypeInstantiation(type) { return deferredGlobalNonNullableTypeAlias || (deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288, void 0) || unknownSymbol), deferredGlobalNonNullableTypeAlias !== unknownSymbol ? getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) : getTypeWithFacts(type, 524288) } function getNonNullableType(type) { return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type } function isObjectTypeWithInferableIndex(type) { return type.symbol && 0 !== (6656 & type.symbol.flags) && !typeHasCallOrConstructSignatures(type) } function createSymbolWithType(source, type) { var symbol = createSymbol(source.flags, source.escapedName); return symbol.declarations = source.declarations, symbol.parent = source.parent, symbol.type = type, symbol.target = source, source.valueDeclaration && (symbol.valueDeclaration = source.valueDeclaration), source.nameType && (symbol.nameType = source.nameType), symbol } function transformTypeOfMembers(type, f) { for (var members = ts.createSymbolTable(), _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { var property = _a[_i], original = getTypeOfSymbol(property), updated = f(original); members.set(property.escapedName, updated === original ? property : createSymbolWithType(property, updated)) } return members } function getRegularTypeOfObjectLiteral(type) { if (!(isObjectLiteralType(type) && 8388608 & type.flags)) return type; var regularType = type.regularType; if (regularType) return regularType; var resolved = type, members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral), regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.stringIndexInfo, resolved.numberIndexInfo); return regularNew.flags = resolved.flags & -8388609, regularNew.objectFlags |= 128, type.regularType = regularNew, regularNew } function createWideningContext(parent, propertyName, siblings) { return { parent: parent, propertyName: propertyName, siblings: siblings, resolvedProperties: void 0 } } function getSiblingsOfContext(context) { if (!context.siblings) { for (var siblings_1 = [], _i = 0, _a = getSiblingsOfContext(context.parent); _i < _a.length; _i++) { var type = _a[_i]; if (isObjectLiteralType(type)) { var prop = getPropertyOfObjectType(type, context.propertyName); prop && forEachType(getTypeOfSymbol(prop), function (t) { siblings_1.push(t) }) } } context.siblings = siblings_1 } return context.siblings } function getPropertiesOfContext(context) { if (!context.resolvedProperties) { for (var names = ts.createMap(), _i = 0, _a = getSiblingsOfContext(context); _i < _a.length; _i++) { var t = _a[_i]; if (isObjectLiteralType(t) && !(1024 & ts.getObjectFlags(t))) for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) { var prop = _c[_b]; names.set(prop.escapedName, prop) } } context.resolvedProperties = ts.arrayFrom(names.values()) } return context.resolvedProperties } function getWidenedProperty(prop, context) { var original = getTypeOfSymbol(prop), propContext = context && createWideningContext(context, prop.escapedName, void 0), widened = getWidenedTypeWithContext(original, propContext); return widened === original ? prop : createSymbolWithType(prop, widened) } function getUndefinedProperty(prop) { var cached = undefinedProperties.get(prop.escapedName); if (cached) return cached; var result = createSymbolWithType(prop, undefinedType); return result.flags |= 16777216, undefinedProperties.set(prop.escapedName, result), result } function getWidenedTypeOfObjectLiteral(type, context) { for (var members = ts.createSymbolTable(), _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { var prop = _a[_i]; members.set(prop.escapedName, 4 & prop.flags ? getWidenedProperty(prop, context) : prop) } if (context) for (var _b = 0, _c = getPropertiesOfContext(context); _b < _c.length; _b++) { var prop = _c[_b]; members.has(prop.escapedName) || members.set(prop.escapedName, getUndefinedProperty(prop)) } var stringIndexInfo = getIndexInfoOfType(type, 0), numberIndexInfo = getIndexInfoOfType(type, 1); return createAnonymousType(type.symbol, members, ts.emptyArray, ts.emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)) } function getWidenedType(type) { return getWidenedTypeWithContext(type, void 0) } function getWidenedTypeWithContext(type, context) { if (50331648 & type.flags) { if (12288 & type.flags) return anyType; if (isObjectLiteralType(type)) return getWidenedTypeOfObjectLiteral(type, context); if (131072 & type.flags) { var unionContext_1 = context || createWideningContext(void 0, void 0, type.types), widenedTypes = ts.sameMap(type.types, function (t) { return 12288 & t.flags ? t : getWidenedTypeWithContext(t, unionContext_1) }); return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 : 1) } if (isArrayType(type) || isTupleType(type)) return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType)) } return type } function reportWideningErrorsInType(type) { var errorReported = !1; if (16777216 & type.flags) { if (131072 & type.flags) if (ts.some(type.types, isEmptyObjectType)) errorReported = !0; else for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; reportWideningErrorsInType(t) && (errorReported = !0) } if (isArrayType(type) || isTupleType(type)) for (var _b = 0, _c = type.typeArguments; _b < _c.length; _b++) { var t = _c[_b]; reportWideningErrorsInType(t) && (errorReported = !0) } if (isObjectLiteralType(type)) for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { var p = _e[_d], t = getTypeOfSymbol(p); 16777216 & t.flags && (reportWideningErrorsInType(t) || error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t))), errorReported = !0) } } return errorReported } function reportImplicitAnyError(declaration, type) { var diagnostic, typeAsString = typeToString(getWidenedType(type)); switch (declaration.kind) { case 199: case 151: case 150: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 148: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 181: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; case 233: case 153: case 152: case 155: case 156: case 191: case 192: if (!declaration.name) return void error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; case 176: return void error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); default: diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type }error(declaration, diagnostic, ts.declarationNameToString(ts.getNameOfDeclaration(declaration)), typeAsString) } function reportErrorsFromWidening(declaration, type) { produceDiagnostics && noImplicitAny && 16777216 & type.flags && (reportWideningErrorsInType(type) || reportImplicitAnyError(declaration, type)) } function forEachMatchingParameterType(source, target, callback) { var count, sourceMax = source.parameters.length, targetMax = target.parameters.length; count = source.hasRestParameter && target.hasRestParameter ? Math.max(sourceMax, targetMax) : source.hasRestParameter ? targetMax : target.hasRestParameter ? sourceMax : Math.min(sourceMax, targetMax); for (var i = 0; i < count; i++)callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)) } function createInferenceContext(typeParameters, signature, flags, compareTypes, baseInferences) { function mapper(t) { for (var i = 0; i < inferences.length; i++)if (t === inferences[i].typeParameter) return inferences[i].isFixed = !0, getInferredType(context, i); return t } var inferences = baseInferences ? baseInferences.map(cloneInferenceInfo) : typeParameters.map(createInferenceInfo), context = mapper; return context.typeParameters = typeParameters, context.signature = signature, context.inferences = inferences, context.flags = flags, context.compareTypes = compareTypes || compareTypesAssignable, context } function createInferenceInfo(typeParameter) { return { typeParameter: typeParameter, candidates: void 0, contraCandidates: void 0, inferredType: void 0, priority: void 0, topLevel: !0, isFixed: !1 } } function cloneInferenceInfo(inference) { return { typeParameter: inference.typeParameter, candidates: inference.candidates && inference.candidates.slice(), contraCandidates: inference.contraCandidates && inference.contraCandidates.slice(), inferredType: inference.inferredType, priority: inference.priority, topLevel: inference.topLevel, isFixed: inference.isFixed } } function couldContainTypeVariables(type) { var objectFlags = ts.getObjectFlags(type); return !!(7897088 & type.flags || 4 & objectFlags && ts.forEach(type.typeArguments, couldContainTypeVariables) || 16 & objectFlags && type.symbol && 10288 & type.symbol.flags || 32 & objectFlags || 393216 & type.flags && couldUnionOrIntersectionContainTypeVariables(type)) } function couldUnionOrIntersectionContainTypeVariables(type) { return void 0 === type.couldContainTypeVariables && (type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables)), type.couldContainTypeVariables } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || 393216 & type.flags && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter) }) } function createEmptyObjectTypeFromStringLiteral(type) { var members = ts.createSymbolTable(); forEachType(type, function (t) { if (32 & t.flags) { var name = ts.escapeLeadingUnderscores(t.value), literalProp = createSymbol(4, name); literalProp.type = anyType, t.symbol && (literalProp.declarations = t.symbol.declarations, literalProp.valueDeclaration = t.symbol.valueDeclaration), members.set(name, literalProp) } }); var indexInfo = 2 & type.flags ? createIndexInfo(emptyObjectType, !1) : void 0; return createAnonymousType(void 0, members, ts.emptyArray, ts.emptyArray, indexInfo, void 0) } function inferTypeForHomomorphicMappedType(source, target) { var key = source.id + "," + target.id; if (reverseMappedCache.has(key)) return reverseMappedCache.get(key); reverseMappedCache.set(key, void 0); var type = createReverseMappedType(source, target); return reverseMappedCache.set(key, type), type } function createReverseMappedType(source, target) { var properties = getPropertiesOfType(source); if (0 !== properties.length || getIndexInfoOfType(source, 0)) { for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { var prop = properties_4[_i]; if (67108864 & getTypeOfSymbol(prop).flags) return } var reversed = createObjectType(2064, void 0); return reversed.source = source, reversed.mappedType = target, reversed } } function getTypeOfReverseMappedSymbol(symbol) { return inferReverseMappedType(symbol.propertyType, symbol.mappedType) } function inferReverseMappedType(sourceType, target) { var typeParameter = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)), templateType = getTemplateTypeFromMappedType(target), inference = createInferenceInfo(typeParameter); return inferTypes([inference], sourceType, templateType), getTypeFromInference(inference) } function getUnmatchedProperty(source, target, requireOptionalProperties) { for (var properties = 262144 & target.flags ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target), _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { var targetProp = properties_5[_i]; if (requireOptionalProperties || !(16777216 & targetProp.flags)) { var sourceProp = getPropertyOfType(source, targetProp.escapedName); if (!sourceProp) return targetProp } } } function typesDefinitelyUnrelated(source, target) { return isTupleType(source) && isTupleType(target) && getTypeReferenceArity(source) !== getTypeReferenceArity(target) || !!getUnmatchedProperty(source, target, !1) && !!getUnmatchedProperty(target, source, !1) } function getTypeFromInference(inference) { return inference.candidates ? getUnionType(inference.candidates, 2) : inference.contraCandidates ? getIntersectionType(inference.contraCandidates) : emptyObjectType } function inferTypes(inferences, originalSource, originalTarget, priority) { function inferFromTypes(source, target) { if (couldContainTypeVariables(target)) { if (source === wildcardType) { var savePropagationType = propagationType; return propagationType = source, inferFromTypes(target, target), void (propagationType = savePropagationType) } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) for (var sourceTypes = source.aliasTypeArguments, targetTypes = target.aliasTypeArguments, i = 0; i < sourceTypes.length; i++)inferFromTypes(sourceTypes[i], targetTypes[i]); else { if (131072 & source.flags && 131072 & target.flags && !(256 & source.flags && 256 & target.flags) || 262144 & source.flags && 262144 & target.flags) { if (source === target) { for (var _i = 0, _a = source.types; _i < _a.length; _i++) { var t = _a[_i]; inferFromTypes(t, t) } return } for (var matchingTypes = void 0, _b = 0, _c = source.types; _b < _c.length; _b++) { var t = _c[_b]; if (typeIdenticalToSomeType(t, target.types)) (matchingTypes || (matchingTypes = [])).push(t), inferFromTypes(t, t); else if (96 & t.flags) { var b = getBaseTypeOfLiteralType(t); typeIdenticalToSomeType(b, target.types) && (matchingTypes || (matchingTypes = [])).push(t, b) } } matchingTypes && (source = removeTypesFromUnionOrIntersection(source, matchingTypes), target = removeTypesFromUnionOrIntersection(target, matchingTypes)) } if (1081344 & target.flags) { if (67108864 & source.flags || source === silentNeverType) return; var inference = getInferenceInfoForType(target); if (inference) { if (!inference.isFixed) { if ((void 0 === inference.priority || priority < inference.priority) && (inference.candidates = void 0, inference.contraCandidates = void 0, inference.priority = priority), priority === inference.priority) { var candidate = propagationType || source; contravariant ? inference.contraCandidates = ts.append(inference.contraCandidates, candidate) : inference.candidates = ts.append(inference.candidates, candidate) } 8 & priority || !(32768 & target.flags) || isTypeParameterAtTopLevel(originalTarget, target) || (inference.topLevel = !1) } return } } if (4 & ts.getObjectFlags(source) && 4 & ts.getObjectFlags(target) && source.target === target.target) for (var sourceTypes = source.typeArguments || ts.emptyArray, targetTypes = target.typeArguments || ts.emptyArray, count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length, variances = getVariances(source.target), i = 0; i < count; i++)i < variances.length && 2 === variances[i] ? inferFromContravariantTypes(sourceTypes[i], targetTypes[i]) : inferFromTypes(sourceTypes[i], targetTypes[i]); else if (524288 & source.flags && 524288 & target.flags) contravariant = !contravariant, inferFromTypes(source.type, target.type), contravariant = !contravariant; else if ((isLiteralType(source) || 2 & source.flags) && 524288 & target.flags) { var empty = createEmptyObjectTypeFromStringLiteral(source); contravariant = !contravariant; var savePriority = priority; priority |= 16, inferFromTypes(empty, target.type), priority = savePriority, contravariant = !contravariant } else if (1048576 & source.flags && 1048576 & target.flags) inferFromTypes(source.objectType, target.objectType), inferFromTypes(source.indexType, target.indexType); else if (2097152 & source.flags && 2097152 & target.flags) inferFromTypes(source.checkType, target.checkType), inferFromTypes(source.extendsType, target.extendsType), inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target)), inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target)); else if (393216 & target.flags) { for (var targetTypes = target.types, typeVariableCount = 0, typeVariable = void 0, _d = 0, targetTypes_3 = targetTypes; _d < targetTypes_3.length; _d++) { var t = targetTypes_3[_d]; getInferenceInfoForType(t) ? (typeVariable = t, typeVariableCount++) : inferFromTypes(source, t) } if (1 === typeVariableCount) { var savePriority = priority; priority |= 1, inferFromTypes(source, typeVariable), priority = savePriority } } else if (131072 & source.flags) for (var sourceTypes = source.types, _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) { var sourceType = sourceTypes_3[_e]; inferFromTypes(sourceType, target) } else if (32 & priority && 8159232 & source.flags || (source = getApparentType(source)), 327680 & source.flags) { var key = source.id + "," + target.id; if (visited && visited.get(key)) return; (visited || (visited = ts.createMap())).set(key, !0); var isNonConstructorObject = 65536 & target.flags && !(16 & ts.getObjectFlags(target) && target.symbol && 32 & target.symbol.flags), symbol = isNonConstructorObject ? target.symbol : void 0; if (symbol) { if (ts.contains(symbolStack, symbol)) return; (symbolStack || (symbolStack = [])).push(symbol), inferFromObjectTypes(source, target), symbolStack.pop() } else inferFromObjectTypes(source, target) } } } } function inferFromContravariantTypes(source, target) { strictFunctionTypes || 64 & priority ? (contravariant = !contravariant, inferFromTypes(source, target), contravariant = !contravariant) : inferFromTypes(source, target) } function getInferenceInfoForType(type) { if (1081344 & type.flags) for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) { var inference = inferences_1[_i]; if (type === inference.typeParameter) return inference } } function inferFromObjectTypes(source, target) { if (isGenericMappedType(source) && isGenericMappedType(target) && (inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target)), inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target))), 32 & ts.getObjectFlags(target)) { var constraintType = getConstraintTypeFromMappedType(target); if (524288 & constraintType.flags) { var inference = getInferenceInfoForType(constraintType.type); if (inference && !inference.isFixed) { var inferredType = inferTypeForHomomorphicMappedType(source, target); if (inferredType) { var savePriority = priority; priority |= 2, inferFromTypes(inferredType, inference.typeParameter), priority = savePriority } } return } if (32768 & constraintType.flags) { var savePriority = priority; return priority |= 4, inferFromTypes(getIndexType(source), constraintType), priority = savePriority, void inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)) } } typesDefinitelyUnrelated(source, target) || (inferFromProperties(source, target), inferFromSignatures(source, target, 0), inferFromSignatures(source, target, 1), inferFromIndexTypes(source, target)) } function inferFromProperties(source, target) { for (var properties = getPropertiesOfObjectType(target), _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { var targetProp = properties_6[_i], sourceProp = getPropertyOfType(source, targetProp.escapedName); sourceProp && inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)) } } function inferFromSignatures(source, target, kind) { for (var sourceSignatures = getSignaturesOfType(source, kind), targetSignatures = getSignaturesOfType(target, kind), sourceLen = sourceSignatures.length, targetLen = targetSignatures.length, len = sourceLen < targetLen ? sourceLen : targetLen, i = 0; i < len; i++)inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getBaseSignature(targetSignatures[targetLen - len + i])) } function inferFromSignature(source, target) { forEachMatchingParameterType(source, target, inferFromContravariantTypes); var sourceTypePredicate = getTypePredicateOfSignature(source), targetTypePredicate = getTypePredicateOfSignature(target); sourceTypePredicate && targetTypePredicate && sourceTypePredicate.kind === targetTypePredicate.kind ? inferFromTypes(sourceTypePredicate.type, targetTypePredicate.type) : inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)) } function inferFromIndexTypes(source, target) { var targetStringIndexType = getIndexTypeOfType(target, 0); if (targetStringIndexType) { var sourceIndexType = getIndexTypeOfType(source, 0) || getImplicitIndexTypeOfType(source, 0); sourceIndexType && inferFromTypes(sourceIndexType, targetStringIndexType) } var targetNumberIndexType = getIndexTypeOfType(target, 1); if (targetNumberIndexType) { var sourceIndexType = getIndexTypeOfType(source, 1) || getIndexTypeOfType(source, 0) || getImplicitIndexTypeOfType(source, 1); sourceIndexType && inferFromTypes(sourceIndexType, targetNumberIndexType) } } void 0 === priority && (priority = 0); var symbolStack, visited, propagationType, contravariant = !1; inferFromTypes(originalSource, originalTarget) } function typeIdenticalToSomeType(type, types) { for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { var t = types_11[_i]; if (isTypeIdenticalTo(t, type)) return !0 } return !1 } function removeTypesFromUnionOrIntersection(type, typesToRemove) { for (var reducedTypes = [], _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; typeIdenticalToSomeType(t, typesToRemove) || reducedTypes.push(t) } return 131072 & type.flags ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes) } function hasPrimitiveConstraint(type) { var constraint = getConstraintOfTypeParameter(type); return constraint && maybeTypeOfKind(constraint, 540670) } function isObjectLiteralType(type) { return !!(128 & ts.getObjectFlags(type)) } function widenObjectLiteralCandidates(candidates) { if (candidates.length > 1) { var objectLiterals = ts.filter(candidates, isObjectLiteralType); if (objectLiterals.length) { var objectLiteralsType = getWidenedType(getUnionType(objectLiterals, 2)); return ts.concatenate(ts.filter(candidates, function (t) { return !isObjectLiteralType(t) }), [objectLiteralsType]) } } return candidates } function getContravariantInference(inference) { return 28 & inference.priority ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates) } function getCovariantInference(inference, context, signature) { var candidates = widenObjectLiteralCandidates(inference.candidates), primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter), widenLiteralTypes = !primitiveConstraint && inference.topLevel && (inference.isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), inference.typeParameter)), baseCandidates = primitiveConstraint ? ts.sameMap(candidates, getRegularTypeOfLiteralType) : widenLiteralTypes ? ts.sameMap(candidates, getWidenedLiteralType) : candidates, unwidenedType = 1 & context.flags || 28 & inference.priority ? getUnionType(baseCandidates, 2) : getCommonSupertype(baseCandidates); return getWidenedType(unwidenedType) } function getInferredType(context, index) { var inference = context.inferences[index], inferredType = inference.inferredType; if (!inferredType) { var signature = context.signature; if (signature) if (inference.candidates) inferredType = getCovariantInference(inference, context, signature), 16384 & inferredType.flags && inference.contraCandidates && (inferredType = getContravariantInference(inference)); else if (inference.contraCandidates) inferredType = getContravariantInference(inference); else if (2 & context.flags) inferredType = silentNeverType; else { var defaultType = getDefaultFromTypeParameter(inference.typeParameter); inferredType = defaultType ? instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context.signature.typeParameters, index), context)) : getDefaultTypeArgumentType(!!(4 & context.flags)) } else inferredType = getTypeFromInference(inference); inference.inferredType = inferredType; var constraint = getConstraintOfTypeParameter(inference.typeParameter); if (constraint) { var instantiatedConstraint = instantiateType(constraint, context); context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType)) || (inference.inferredType = inferredType = instantiatedConstraint) } } return inferredType } function getDefaultTypeArgumentType(isInJavaScriptFile) { return isInJavaScriptFile ? anyType : emptyObjectType } function getInferredTypes(context) { for (var result = [], i = 0; i < context.inferences.length; i++)result.push(getInferredType(context, i)); return result } function getResolvedSymbol(node) { var links = getNodeLinks(node); return links.resolvedSymbol || (links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.escapedText, 68264895, ts.Diagnostics.Cannot_find_name_0, node, !ts.isWriteOnlyAccess(node), !1, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol), links.resolvedSymbol } function isInTypeQuery(node) { return !!ts.findAncestor(node, function (n) { return 164 === n.kind || 71 !== n.kind && 145 !== n.kind && "quit" }) } function getFlowCacheKey(node) { if (71 === node.kind) { var symbol = getResolvedSymbol(node); return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : void 0 } if (99 === node.kind) return "0"; if (184 === node.kind) { var key = getFlowCacheKey(node.expression); return key && key + "." + ts.idText(node.name) } if (181 === node.kind) { var container = node.parent.parent, key = 181 === container.kind ? getFlowCacheKey(container) : container.initializer && getFlowCacheKey(container.initializer), text = getBindingElementNameText(node), result = key && text && key + "." + text; return result } } function getBindingElementNameText(element) { if (179 !== element.parent.kind) return "" + element.parent.elements.indexOf(element); var name = element.propertyName || element.name; switch (name.kind) { case 71: return ts.idText(name); case 146: return ts.isStringOrNumericLiteral(name.expression) ? name.expression.text : void 0; case 9: case 8: return name.text; default: ts.Debug.fail("Unexpected name kind for binding element name") } } function isMatchingReference(source, target) { switch (source.kind) { case 71: return 71 === target.kind && getResolvedSymbol(source) === getResolvedSymbol(target) || (231 === target.kind || 181 === target.kind) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 99: return 99 === target.kind; case 97: return 97 === target.kind; case 184: return 184 === target.kind && source.name.escapedText === target.name.escapedText && isMatchingReference(source.expression, target.expression); case 181: if (184 !== target.kind) return !1; var t = target; if (t.name.escapedText !== getBindingElementNameText(source)) return !1; if (181 === source.parent.parent.kind && isMatchingReference(source.parent.parent, t.expression)) return !0; if (231 === source.parent.parent.kind) { var maybeId = source.parent.parent.initializer; return maybeId && isMatchingReference(maybeId, t.expression) } }return !1 } function containsMatchingReference(source, target) { for (; 184 === source.kind;)if (source = source.expression, isMatchingReference(source, target)) return !0; return !1 } function containsMatchingReferenceDiscriminant(source, target) { return 184 === target.kind && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.escapedText) } function getDeclaredTypeOfReference(expr) { if (71 === expr.kind) return getTypeOfSymbol(getResolvedSymbol(expr)); if (184 === expr.kind) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.escapedText) } } function isDiscriminantProperty(type, name) { if (type && 131072 & type.flags) { var prop = getUnionOrIntersectionProperty(type, name); if (prop && 2 & ts.getCheckFlags(prop)) return void 0 === prop.isDiscriminantProperty && (prop.isDiscriminantProperty = 32 & prop.checkFlags && isLiteralType(getTypeOfSymbol(prop))), prop.isDiscriminantProperty } return !1 } function findDiscriminantProperties(sourceProperties, target) { for (var result, _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { var sourceProperty = sourceProperties_2[_i]; if (isDiscriminantProperty(target, sourceProperty.escapedName)) { if (result) { result.push(sourceProperty); continue } result = [sourceProperty] } } return result } function isOrContainsMatchingReference(source, target) { return isMatchingReference(source, target) || containsMatchingReference(source, target) } function hasMatchingArgument(callExpression, reference) { if (callExpression.arguments) for (var _i = 0, _a = callExpression.arguments; _i < _a.length; _i++) { var argument = _a[_i]; if (isOrContainsMatchingReference(reference, argument)) return !0 } return !(184 !== callExpression.expression.kind || !isOrContainsMatchingReference(reference, callExpression.expression.expression)) } function getFlowNodeId(flow) { return flow.id || (flow.id = nextFlowId, nextFlowId++), flow.id } function typeMaybeAssignableTo(source, target) { if (!(131072 & source.flags)) return isTypeAssignableTo(source, target); for (var _i = 0, _a = source.types; _i < _a.length; _i++) { var t = _a[_i]; if (isTypeAssignableTo(t, target)) return !0 } return !1 } function getAssignmentReducedType(declaredType, assignedType) { if (declaredType !== assignedType) { if (16384 & assignedType.flags) return assignedType; var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t) }); if (!(16384 & reducedType.flags)) return reducedType } return declaredType } function getTypeFactsOfTypes(types) { for (var result = 0, _i = 0, types_12 = types; _i < types_12.length; _i++) { var t = types_12[_i]; result |= getTypeFacts(t) } return result } function isFunctionObjectType(type) { var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)) } function getTypeFacts(type) { var flags = type.flags; if (2 & flags) return strictNullChecks ? 4079361 : 4194049; if (32 & flags) { var isEmpty = "" === type.value; return strictNullChecks ? isEmpty ? 3030785 : 1982209 : isEmpty ? 3145473 : 4194049 } if (20 & flags) return strictNullChecks ? 4079234 : 4193922; if (64 & flags) { var isZero = 0 === type.value; return strictNullChecks ? isZero ? 3030658 : 1982082 : isZero ? 3145346 : 4193922 } return 8 & flags ? strictNullChecks ? 4078980 : 4193668 : 136 & flags ? strictNullChecks ? type === falseType ? 3030404 : 1981828 : type === falseType ? 3145092 : 4193668 : 65536 & flags ? isFunctionObjectType(type) ? strictNullChecks ? 1970144 : 4181984 : strictNullChecks ? 1972176 : 4184016 : 6144 & flags ? 2457472 : 8192 & flags ? 2340752 : 1536 & flags ? strictNullChecks ? 1981320 : 4193160 : 134217728 & flags ? strictNullChecks ? 1972176 : 4184016 : 7897088 & flags ? getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType) : 393216 & flags ? getTypeFactsOfTypes(type.types) : 4194303 } function getTypeWithFacts(type, include) { return filterType(type, function (t) { return 0 !== (getTypeFacts(t) & include) }) } function getTypeWithDefault(type, defaultExpression) { if (defaultExpression) { var defaultType = getTypeOfExpression(defaultExpression); return getUnionType([getTypeWithFacts(type, 131072), defaultType]) } return type } function getTypeOfDestructuredProperty(type, name) { var text = ts.getTextOfPropertyName(name); return getConstraintForLocation(getTypeOfPropertyOfType(type, text), name) || isNumericLiteralName(text) && getIndexTypeOfType(type, 1) || getIndexTypeOfType(type, 0) || unknownType } function getTypeOfDestructuredArrayElement(type, index) { return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || checkIteratedTypeOrElementType(type, void 0, !1, !1) || unknownType } function getTypeOfDestructuredSpreadExpression(type) { return createArrayType(checkIteratedTypeOrElementType(type, void 0, !1, !1) || unknownType) } function getAssignedTypeOfBinaryExpression(node) { var isDestructuringDefaultAssignment = 182 === node.parent.kind && isDestructuringAssignmentTarget(node.parent) || 269 === node.parent.kind && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right) } function isDestructuringAssignmentTarget(parent) { return 199 === parent.parent.kind && parent.parent.left === parent || 221 === parent.parent.kind && parent.parent.initializer === parent } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)) } function getAssignedTypeOfSpreadExpression(node) { return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent)) } function getAssignedTypeOfPropertyAssignment(node) { return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name) } function getAssignedTypeOfShorthandPropertyAssignment(node) { return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer) } function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { case 220: return stringType; case 221: return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; case 199: return getAssignedTypeOfBinaryExpression(parent); case 193: return undefinedType; case 182: return getAssignedTypeOfArrayLiteralElement(parent, node); case 203: return getAssignedTypeOfSpreadExpression(parent); case 269: return getAssignedTypeOfPropertyAssignment(parent); case 270: return getAssignedTypeOfShorthandPropertyAssignment(parent) }return unknownType } function getInitialTypeOfBindingElement(node) { var pattern = node.parent, parentType = getInitialType(pattern.parent), type = 179 === pattern.kind ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : node.dotDotDotToken ? getTypeOfDestructuredSpreadExpression(parentType) : getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)); return getTypeWithDefault(type, node.initializer) } function getTypeOfInitializer(node) { var links = getNodeLinks(node); return links.resolvedType || getTypeOfExpression(node) } function getInitialTypeOfVariableDeclaration(node) { return node.initializer ? getTypeOfInitializer(node.initializer) : 220 === node.parent.parent.kind ? stringType : 221 === node.parent.parent.kind ? checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType : unknownType } function getInitialType(node) { return 231 === node.kind ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node) } function getInitialOrAssignedType(node) { return 231 === node.kind || 181 === node.kind ? getInitialType(node) : getAssignedType(node) } function isEmptyArrayAssignment(node) { return 231 === node.kind && node.initializer && isEmptyArrayLiteral(node.initializer) || 181 !== node.kind && 199 === node.parent.kind && isEmptyArrayLiteral(node.parent.right) } function getReferenceCandidate(node) { switch (node.kind) { case 190: return getReferenceCandidate(node.expression); case 199: switch (node.operatorToken.kind) { case 58: return getReferenceCandidate(node.left); case 26: return getReferenceCandidate(node.right) } }return node } function getReferenceRoot(node) { var parent = node.parent; return 190 === parent.kind || 199 === parent.kind && 58 === parent.operatorToken.kind && parent.left === node || 199 === parent.kind && 26 === parent.operatorToken.kind && parent.right === node ? getReferenceRoot(parent) : node } function getTypeOfSwitchClause(clause) { return 265 === clause.kind ? getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)) : neverType } function getSwitchClauseTypes(switchStatement) { var links = getNodeLinks(switchStatement); if (!links.switchTypes) { links.switchTypes = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; links.switchTypes.push(getTypeOfSwitchClause(clause)) } } return links.switchTypes } function eachTypeContainedIn(source, types) { return 131072 & source.flags ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t) }) : ts.contains(types, source) } function isTypeSubsetOf(source, target) { return source === target || 131072 & target.flags && isTypeSubsetOfUnion(source, target) } function isTypeSubsetOfUnion(source, target) { if (131072 & source.flags) { for (var _i = 0, _a = source.types; _i < _a.length; _i++) { var t = _a[_i]; if (!containsType(target.types, t)) return !1 } return !0 } return !!(256 & source.flags && getBaseTypeOfEnumLiteralType(source) === target) || containsType(target.types, source) } function forEachType(type, f) { return 131072 & type.flags ? ts.forEach(type.types, f) : f(type) } function filterType(type, f) { if (131072 & type.flags) { var types = type.types, filtered = ts.filter(types, f); return filtered === types ? type : getUnionTypeFromSortedList(filtered, 268435456 & type.flags) } return f(type) ? type : neverType } function mapType(type, mapper, noReductions) { if (16384 & type.flags) return type; if (!(131072 & type.flags)) return mapper(type); for (var mappedType, mappedTypes, types = type.types, _i = 0, types_13 = types; _i < types_13.length; _i++) { var current = types_13[_i], t = mapper(current); t && (mappedType ? mappedTypes ? mappedTypes.push(t) : mappedTypes = [mappedType, t] : mappedType = t) } return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 : 1) : mappedType } function extractTypesOfKind(type, kind) { return filterType(type, function (t) { return 0 !== (t.flags & kind) }) } function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) { return isTypeSubsetOf(stringType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 32) || isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 64) ? mapType(typeWithPrimitives, function (t) { return 2 & t.flags ? extractTypesOfKind(typeWithLiterals, 34) : 4 & t.flags ? extractTypesOfKind(typeWithLiterals, 68) : t }) : typeWithPrimitives } function isIncomplete(flowType) { return 0 === flowType.flags } function getTypeFromFlowType(flowType) { return 0 === flowType.flags ? flowType.type : flowType } function createFlowType(type, incomplete) { return incomplete ? { flags: 0, type: type } : type } function createEvolvingArrayType(elementType) { var result = createObjectType(256); return result.elementType = elementType, result } function getEvolvingArrayType(elementType) { return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)) } function addEvolvingArrayElementType(evolvingArrayType, node) { var elementType = getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])) } function createFinalArrayType(elementType) { return 16384 & elementType.flags ? autoArrayType : createArrayType(131072 & elementType.flags ? getUnionType(elementType.types, 2) : elementType) } function getFinalArrayType(evolvingArrayType) { return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType)) } function finalizeEvolvingArrayType(type) { return 256 & ts.getObjectFlags(type) ? getFinalArrayType(type) : type } function getElementTypeOfEvolvingArrayType(type) { return 256 & ts.getObjectFlags(type) ? type.elementType : neverType } function isEvolvingArrayTypeList(types) { for (var hasEvolvingArrayType = !1, _i = 0, types_14 = types; _i < types_14.length; _i++) { var t = types_14[_i]; if (!(16384 & t.flags)) { if (!(256 & ts.getObjectFlags(t))) return !1; hasEvolvingArrayType = !0 } } return hasEvolvingArrayType } function getUnionOrEvolvingArrayType(types, subtypeReduction) { return isEvolvingArrayTypeList(types) ? getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType))) : getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction) } function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node), parent = root.parent, isLengthPushOrUnshift = 184 === parent.kind && ("length" === parent.name.escapedText || 186 === parent.parent.kind && ts.isPushOrUnshiftIdentifier(parent.name)), isElementAssignment = 185 === parent.kind && parent.expression === root && 199 === parent.parent.kind && 58 === parent.parent.operatorToken.kind && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 84); return isLengthPushOrUnshift || isElementAssignment } function maybeTypePredicateCall(node) { var links = getNodeLinks(node); return void 0 === links.maybeTypePredicate && (links.maybeTypePredicate = getMaybeTypePredicate(node)), links.maybeTypePredicate } function getMaybeTypePredicate(node) { if (97 !== node.expression.kind) { var funcType = checkNonNullExpression(node.expression); if (funcType !== silentNeverType) { var apparentType = getApparentType(funcType); return apparentType !== unknownType && ts.some(getSignaturesOfType(apparentType, 0), signatureHasTypePredicate) } } return !1 } function reportFlowControlError(node) { var block = ts.findAncestor(node, ts.isFunctionOrModuleBlock), sourceFile = ts.getSourceFileOfNode(node), span = ts.getSpanOfTokenAtPosition(sourceFile, block.statements.pos); diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis)) } function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) { function getTypeAtFlowNode(flow) { if (2500 === flowDepth) return flowAnalysisDisabled = !0, reportFlowControlError(reference), unknownType; for (flowDepth++; ;) { var flags = flow.flags; if (1024 & flags) for (var i = sharedFlowStart; i < sharedFlowCount; i++)if (sharedFlowNodes[i] === flow) return flowDepth-- , sharedFlowTypes[i]; var type = void 0; if (4096 & flags) flow.locked = !0, type = getTypeAtFlowNode(flow.antecedent), flow.locked = !1; else { if (2048 & flags) { flow = flow.antecedent; continue } if (16 & flags) { if (type = getTypeAtFlowAssignment(flow), !type) { flow = flow.antecedent; continue } } else if (96 & flags) type = getTypeAtFlowCondition(flow); else if (128 & flags) type = getTypeAtSwitchClause(flow); else if (12 & flags) { if (1 === flow.antecedents.length) { flow = flow.antecedents[0]; continue } type = 4 & flags ? getTypeAtFlowBranchLabel(flow) : getTypeAtFlowLoopLabel(flow) } else if (256 & flags) { if (type = getTypeAtFlowArrayMutation(flow), !type) { flow = flow.antecedent; continue } } else if (2 & flags) { var container = flow.container; if (container && container !== flowContainer && 184 !== reference.kind && 99 !== reference.kind) { flow = container.flowNode; continue } type = initialType } else type = convertAutoToAny(declaredType) } return 1024 & flags && (sharedFlowNodes[sharedFlowCount] = flow, sharedFlowTypes[sharedFlowCount] = type, sharedFlowCount++), flowDepth-- , type } } function getTypeAtFlowAssignment(flow) { var node = flow.node; if (isMatchingReference(reference, node)) { if (2 === ts.getAssignmentTargetKind(node)) { var flowType = getTypeAtFlowNode(flow.antecedent); return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType)) } if (declaredType === autoType || declaredType === autoArrayType) { if (isEmptyArrayAssignment(node)) return getEvolvingArrayType(neverType); var assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node)); return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType } return 131072 & declaredType.flags ? getAssignmentReducedType(declaredType, getInitialOrAssignedType(node)) : declaredType } if (containsMatchingReference(reference, node)) return declaredType } function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node, expr = 186 === node.kind ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { var flowType = getTypeAtFlowNode(flow.antecedent), type = getTypeFromFlowType(flowType); if (256 & ts.getObjectFlags(type)) { var evolvedType_1 = type; if (186 === node.kind) for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg) } else { var indexType = getTypeOfExpression(node.left.argumentExpression); isTypeAssignableToKind(indexType, 84) && (evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right)) } return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType)) } return flowType } } } function getTypeAtFlowCondition(flow) { var flowType = getTypeAtFlowNode(flow.antecedent), type = getTypeFromFlowType(flowType); if (16384 & type.flags) return flowType; var assumeTrue = 0 !== (32 & flow.flags), nonEvolvingType = finalizeEvolvingArrayType(type), narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue); if (narrowedType === nonEvolvingType) return flowType; var incomplete = isIncomplete(flowType), resultType = incomplete && 16384 & narrowedType.flags ? silentNeverType : narrowedType; return createFlowType(resultType, incomplete) } function getTypeAtSwitchClause(flow) { var flowType = getTypeAtFlowNode(flow.antecedent), type = getTypeFromFlowType(flowType), expr = flow.switchStatement.expression; return isMatchingReference(reference, expr) ? type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd) : isMatchingReferenceDiscriminant(expr, type) && (type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd) })), createFlowType(type, isIncomplete(flowType)) } function getTypeAtFlowBranchLabel(flow) { for (var antecedentTypes = [], subtypeReduction = !1, seenIncomplete = !1, _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { var antecedent = _a[_i]; if (!(2048 & antecedent.flags && antecedent.lock.locked)) { var flowType = getTypeAtFlowNode(antecedent), type = getTypeFromFlowType(flowType); if (type === declaredType && declaredType === initialType) return type; ts.pushIfUnique(antecedentTypes, type), isTypeSubsetOf(type, declaredType) || (subtypeReduction = !0), isIncomplete(flowType) && (seenIncomplete = !0) } } return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction ? 2 : 1), seenIncomplete) } function getTypeAtFlowLoopLabel(flow) { var id = getFlowNodeId(flow), cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap()); if (!key && (key = getFlowCacheKey(reference), !key)) return declaredType; var cached = cache.get(key); if (cached) return cached; for (var i = flowLoopStart; i < flowLoopCount; i++)if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], 1), !0); var firstAntecedentType, antecedentTypes = [], subtypeReduction = !1; flowLoopNodes[flowLoopCount] = flow, flowLoopKeys[flowLoopCount] = key, flowLoopTypes[flowLoopCount] = antecedentTypes; for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { var antecedent = _a[_i]; flowLoopCount++; var flowType = getTypeAtFlowNode(antecedent); flowLoopCount-- , firstAntecedentType || (firstAntecedentType = flowType); var type = getTypeFromFlowType(flowType), cached_1 = cache.get(key); if (cached_1) return cached_1; if (ts.pushIfUnique(antecedentTypes, type), isTypeSubsetOf(type, declaredType) || (subtypeReduction = !0), type === declaredType) break } var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction ? 2 : 1); return isIncomplete(firstAntecedentType) ? createFlowType(result, !0) : (cache.set(key, result), result) } function isMatchingReferenceDiscriminant(expr, computedType) { return 184 === expr.kind && 131072 & computedType.flags && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(computedType, expr.name.escapedText) } function narrowTypeByDiscriminant(type, propAccess, narrowType) { var propName = propAccess.name.escapedText, propType = getTypeOfPropertyOfType(type, propName), narrowedPropType = propType && narrowType(propType); return propType === narrowedPropType ? type : filterType(type, function (t) { return isTypeComparableTo(getTypeOfPropertyOfType(t, propName), narrowedPropType) }) } function narrowTypeByTruthiness(type, expr, assumeTrue) { return isMatchingReference(reference, expr) ? getTypeWithFacts(type, assumeTrue ? 1048576 : 2097152) : isMatchingReferenceDiscriminant(expr, declaredType) ? narrowTypeByDiscriminant(type, expr, function (t) { return getTypeWithFacts(t, assumeTrue ? 1048576 : 2097152) }) : containsMatchingReferenceDiscriminant(reference, expr) ? declaredType : type } function isTypePresencePossible(type, propName, assumeTrue) { if (getIndexInfoOfType(type, 0)) return !0; var prop = getPropertyOfType(type, propName); return prop ? !!(16777216 & prop.flags) || assumeTrue : !assumeTrue } function narrowByInKeyword(type, literal, assumeTrue) { if (196608 & type.flags || 32768 & type.flags && type.isThisType) { var propName_1 = ts.escapeLeadingUnderscores(literal.text); return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue) }) } return type } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { switch (expr.operatorToken.kind) { case 58: return narrowTypeByTruthiness(type, expr.left, assumeTrue); case 32: case 33: case 34: case 35: var operator_1 = expr.operatorToken.kind, left_1 = getReferenceCandidate(expr.left), right_1 = getReferenceCandidate(expr.right); if (194 === left_1.kind && ts.isStringLiteralLike(right_1)) return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); if (194 === right_1.kind && ts.isStringLiteralLike(left_1)) return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); if (isMatchingReference(reference, left_1)) return narrowTypeByEquality(type, operator_1, right_1, assumeTrue); if (isMatchingReference(reference, right_1)) return narrowTypeByEquality(type, operator_1, left_1, assumeTrue); if (isMatchingReferenceDiscriminant(left_1, declaredType)) return narrowTypeByDiscriminant(type, left_1, function (t) { return narrowTypeByEquality(t, operator_1, right_1, assumeTrue) }); if (isMatchingReferenceDiscriminant(right_1, declaredType)) return narrowTypeByDiscriminant(type, right_1, function (t) { return narrowTypeByEquality(t, operator_1, left_1, assumeTrue) }); if (containsMatchingReferenceDiscriminant(reference, left_1) || containsMatchingReferenceDiscriminant(reference, right_1)) return declaredType; break; case 93: return narrowTypeByInstanceof(type, expr, assumeTrue); case 92: var target = getReferenceCandidate(expr.right); if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) return narrowByInKeyword(type, expr.left, assumeTrue); break; case 26: return narrowType(type, expr.right, assumeTrue) }return type } function narrowTypeByEquality(type, operator, value, assumeTrue) { if (1 & type.flags) return type; 33 !== operator && 35 !== operator || (assumeTrue = !assumeTrue); var valueType = getTypeOfExpression(value); if (12288 & valueType.flags) { if (!strictNullChecks) return type; var doubleEquals = 32 === operator || 33 === operator, facts = doubleEquals ? assumeTrue ? 65536 : 524288 : 8192 & valueType.flags ? assumeTrue ? 32768 : 262144 : assumeTrue ? 16384 : 131072; return getTypeWithFacts(type, facts) } if (134283777 & type.flags) return type; if (assumeTrue) { var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType) }); return 16384 & narrowedType.flags ? type : replacePrimitivesWithLiterals(narrowedType, valueType) } if (isUnitType(valueType)) { var regularType_1 = getRegularTypeOfLiteralType(valueType); return filterType(type, function (t) { return getRegularTypeOfLiteralType(t) !== regularType_1 }) } return type } function narrowTypeByTypeof(type, typeOfExpr, operator, literal, assumeTrue) { var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) return containsMatchingReference(reference, target) ? declaredType : type; if (33 !== operator && 35 !== operator || (assumeTrue = !assumeTrue), assumeTrue && !(131072 & type.flags)) { var targetType = typeofTypesByName.get(literal.text); if (targetType) { if (isTypeSubtypeOf(targetType, type)) return targetType; if (7897088 & type.flags) { var constraint = getBaseConstraintOfType(type) || anyType; if (isTypeSubtypeOf(targetType, constraint)) return getIntersectionType([type, targetType]) } } } var facts = assumeTrue ? typeofEQFacts.get(literal.text) || 64 : typeofNEFacts.get(literal.text) || 8192; return getTypeWithFacts(type, facts) } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { var switchTypes = getSwitchClauseTypes(switchStatement); if (!switchTypes.length) return type; var clauseTypes = switchTypes.slice(clauseStart, clauseEnd), hasDefaultClause = clauseStart === clauseEnd || ts.contains(clauseTypes, neverType), discriminantType = getUnionType(clauseTypes), caseType = 16384 & discriminantType.flags ? neverType : replacePrimitivesWithLiterals(filterType(type, function (t) { return areTypesComparable(discriminantType, t) }), discriminantType); if (!hasDefaultClause) return caseType; var defaultType = filterType(type, function (t) { return !(isUnitType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(t))) }); return 16384 & caseType.flags ? defaultType : getUnionType([caseType, defaultType]) } function narrowTypeByInstanceof(type, expr, assumeTrue) { var left = getReferenceCandidate(expr.left); if (!isMatchingReference(reference, left)) return containsMatchingReference(reference, left) ? declaredType : type; var rightType = getTypeOfExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) return type; var targetType, prototypeProperty = getPropertyOfType(rightType, "prototype"); if (prototypeProperty) { var prototypePropertyType = getTypeOfSymbol(prototypeProperty); isTypeAny(prototypePropertyType) || (targetType = prototypePropertyType) } if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) return type; if (!targetType) { var constructSignatures = void 0; 2 & ts.getObjectFlags(rightType) ? constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures : 16 & ts.getObjectFlags(rightType) && (constructSignatures = getSignaturesOfType(rightType, 1)), constructSignatures && constructSignatures.length && (targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)) }))) } return targetType ? getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom) : type } function getNarrowedType(type, candidate, assumeTrue, isRelated) { if (!assumeTrue) return filterType(type, function (t) { return !isRelated(t, candidate) }); if (131072 & type.flags) { var assignableType = filterType(type, function (t) { return isRelated(t, candidate) }); if (!(16384 & assignableType.flags)) return assignableType } return isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]) } function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { if (!hasMatchingArgument(callExpression, reference) || !maybeTypePredicateCall(callExpression)) return type; var signature = getResolvedSignature(callExpression), predicate = getTypePredicateOfSignature(signature); if (!predicate) return type; if (isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType)) return type; if (ts.isIdentifierTypePredicate(predicate)) { var predicateArgument = callExpression.arguments[predicate.parameterIndex - (signature.thisParameter ? 1 : 0)]; if (predicateArgument) { if (isMatchingReference(reference, predicateArgument)) return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); if (containsMatchingReference(reference, predicateArgument)) return declaredType } } else { var invokedExpression = ts.skipParentheses(callExpression.expression); if (185 === invokedExpression.kind || 184 === invokedExpression.kind) { var accessExpression = invokedExpression, possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); if (containsMatchingReference(reference, possibleReference)) return declaredType } } return type } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { case 71: case 99: case 97: case 184: return narrowTypeByTruthiness(type, expr, assumeTrue); case 186: return narrowTypeByTypePredicate(type, expr, assumeTrue); case 190: return narrowType(type, expr.expression, assumeTrue); case 199: return narrowTypeByBinaryExpression(type, expr, assumeTrue); case 197: if (51 === expr.operator) return narrowType(type, expr.operand, !assumeTrue) }return type } void 0 === initialType && (initialType = declaredType); var key, flowDepth = 0; if (flowAnalysisDisabled) return unknownType; if (!reference.flowNode || !couldBeUninitialized && !(142575359 & declaredType.flags)) return declaredType; var sharedFlowStart = sharedFlowCount, evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); sharedFlowCount = sharedFlowStart; var resultType = 256 & ts.getObjectFlags(evolvedType) && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); return reference.parent && 208 === reference.parent.kind && 16384 & getTypeWithFacts(resultType, 524288).flags ? declaredType : resultType } function getTypeOfSymbolAtLocation(symbol, location) { if (symbol = symbol.exportSymbol || symbol, 71 === location.kind && (ts.isRightSideOfQualifiedNameOrPropertyAccess(location) && (location = location.parent), ts.isExpressionNode(location) && !ts.isAssignmentTarget(location))) { var type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) return type } return getTypeOfSymbol(symbol) } function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || 239 === node.kind || 273 === node.kind || 151 === node.kind }) } function isParameterAssigned(symbol) { var func = ts.getRootDeclaration(symbol.valueDeclaration).parent, links = getNodeLinks(func); return 4194304 & links.flags || (links.flags |= 4194304, hasParentWithAssignmentsMarked(func) || markParameterAssignments(func)), symbol.isAssigned || !1 } function hasParentWithAssignmentsMarked(node) { return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(4194304 & getNodeLinks(node).flags) }) } function markParameterAssignments(node) { if (71 === node.kind) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); symbol.valueDeclaration && 148 === ts.getRootDeclaration(symbol.valueDeclaration).kind && (symbol.isAssigned = !0) } } else ts.forEachChild(node, markParameterAssignments) } function isConstVariable(symbol) { return 3 & symbol.flags && 0 !== (2 & getDeclarationNodeFlagsFromSymbol(symbol)) && getTypeOfSymbol(symbol) !== autoArrayType } function removeOptionalityFromDeclaredType(declaredType, declaration) { var annotationIncludesUndefined = strictNullChecks && 148 === declaration.kind && declaration.initializer && 4096 & getFalsyFlags(declaredType) && !(4096 & getFalsyFlags(checkExpression(declaration.initializer))); return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 131072) : declaredType } function isConstraintPosition(node) { var parent = node.parent; return 184 === parent.kind || 186 === parent.kind && parent.expression === node || 185 === parent.kind && parent.expression === node || 181 === parent.kind && parent.name === node && !!parent.initializer; } function typeHasNullableConstraint(type) { return 7372800 & type.flags && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 12288) } function getConstraintForLocation(type, node) { return type && isConstraintPosition(node) && forEachType(type, typeHasNullableConstraint) ? mapType(getWidenedType(type), getBaseConstraintOrType) : type } function markAliasReferenced(symbol, location) { !isNonLocalAlias(symbol, 67216319) || isInTypeQuery(location) || isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol)) || markAliasSymbolAsReferenced(symbol) } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === unknownSymbol) return unknownType; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); return languageVersion < 2 && (192 === container.kind ? error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression) : ts.hasModifier(container, 256) && error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method)), getNodeLinks(container).flags |= 8192, getTypeOfSymbol(symbol) } node.parent && ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node || markAliasReferenced(symbol, node); var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol), declaration = localOrExportSymbol.valueDeclaration; if (32 & localOrExportSymbol.flags) if (234 === declaration.kind && ts.nodeIsDecorated(declaration)) for (var container = ts.getContainingClass(node); void 0 !== container;) { if (container === declaration && container.name !== node) { getNodeLinks(declaration).flags |= 8388608, getNodeLinks(node).flags |= 16777216; break } container = ts.getContainingClass(container) } else if (204 === declaration.kind) for (var container = ts.getThisContainer(node, !1); void 0 !== container;) { if (container.parent === declaration) { 151 === container.kind && ts.hasModifier(container, 32) && (getNodeLinks(declaration).flags |= 8388608, getNodeLinks(node).flags |= 16777216); break } container = ts.getThisContainer(container, !1) } checkNestedBlockScopedBinding(node, symbol); var type = getConstraintForLocation(getTypeOfSymbol(localOrExportSymbol), node), assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { if (!(3 & localOrExportSymbol.flags || ts.isInJavaScriptFile(node) && 512 & localOrExportSymbol.flags)) return error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol)), unknownType; if (isReadonlySymbol(localOrExportSymbol)) return error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol)), unknownType } var isAlias = 2097152 & localOrExportSymbol.flags; if (3 & localOrExportSymbol.flags) { if (1 === assignmentKind) return type } else { if (!isAlias) return type; declaration = ts.find(symbol.declarations, isSomeImportDeclaration) } if (!declaration) return type; for (var isParameter = 148 === ts.getRootDeclaration(declaration).kind, declarationContainer = getControlFlowContainer(declaration), flowContainer = getControlFlowContainer(node), isOuterVariable = flowContainer !== declarationContainer, isSpreadDestructuringAsignmentTarget = node.parent && node.parent.parent && ts.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); flowContainer !== declarationContainer && (191 === flowContainer.kind || 192 === flowContainer.kind || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol));)flowContainer = getControlFlowContainer(flowContainer); var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAsignmentTarget || type !== autoType && type !== autoArrayType && (!strictNullChecks || 0 !== (1 & type.flags) || isInTypeQuery(node) || 251 === node.parent.kind) || 208 === node.parent.kind || 231 === declaration.kind && declaration.exclamationToken || 4194304 & declaration.flags, initialType = assumeInitialized ? isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type), flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized); if (type === autoType || type === autoArrayType) { if (flowType === autoType || flowType === autoArrayType) return noImplicitAny && (error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)), error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType))), convertAutoToAny(flowType) } else if (!assumeInitialized && !(4096 & getFalsyFlags(type)) && 4096 & getFalsyFlags(flowType)) return error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)), type; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType } function isInsideFunction(node, threshold) { return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n) }) } function checkNestedBlockScopedBinding(node, symbol) { if (!(languageVersion >= 2 || 0 === (34 & symbol.flags) || 268 === symbol.valueDeclaration.parent.kind)) { for (var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration), usedInFunction = isInsideFunction(node.parent, container), current = container, containedInIterationStatement = !1; current && !ts.nodeStartsNewLexicalEnvironment(current);) { if (ts.isIterationStatement(current, !1)) { containedInIterationStatement = !0; break } current = current.parent } containedInIterationStatement && (usedInFunction && (getNodeLinks(current).flags |= 65536), 219 === container.kind && ts.getAncestor(symbol.valueDeclaration, 232).parent === container && isAssignedInBodyOfForStatement(node, container) && (getNodeLinks(symbol.valueDeclaration).flags |= 2097152), getNodeLinks(symbol.valueDeclaration).flags |= 262144), usedInFunction && (getNodeLinks(symbol.valueDeclaration).flags |= 131072) } } function isAssignedInBodyOfForStatement(node, container) { for (var current = node; 190 === current.parent.kind;)current = current.parent; var isAssigned = !1; if (ts.isAssignmentTarget(current)) isAssigned = !0; else if (197 === current.parent.kind || 198 === current.parent.kind) { var expr = current.parent; isAssigned = 43 === expr.operator || 44 === expr.operator } return !!isAssigned && !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement }) } function captureLexicalThis(node, container) { if (getNodeLinks(node).flags |= 2, 151 === container.kind || 154 === container.kind) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 } else getNodeLinks(container).flags |= 4 } function findFirstSuperCall(n) { if (ts.isSuperCall(n)) return n; if (!ts.isFunctionLike(n)) return ts.forEachChild(n, findFirstSuperCall) } function getSuperCallInConstructor(constructor) { var links = getNodeLinks(constructor); return void 0 === links.hasSuperCall && (links.superCall = findFirstSuperCall(constructor.body), links.hasSuperCall = !!links.superCall), links.superCall } function classDeclarationExtendsNull(classDecl) { var classSymbol = getSymbolOfNode(classDecl), classInstanceType = getDeclaredTypeOfSymbol(classSymbol), baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType } function checkThisBeforeSuper(node, container, diagnosticMessage) { var containingClassDecl = container.parent, baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { var superCall = getSuperCallInConstructor(container); (!superCall || superCall.end > node.pos) && error(node, diagnosticMessage) } } function checkThisExpression(node) { var container = ts.getThisContainer(node, !0), needToCaptureLexicalThis = !1; switch (154 === container.kind && checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class), 192 === container.kind && (container = ts.getThisContainer(container, !1), needToCaptureLexicalThis = languageVersion < 2), container.kind) { case 238: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; case 237: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 154: isInConstructorArgumentInitializer(node, container) && error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); break; case 151: case 150: ts.hasModifier(container, 32) && error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); break; case 146: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name) }needToCaptureLexicalThis && captureLexicalThis(node, container); var type = tryGetThisTypeAt(node, container); return !type && noImplicitThis && error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation), type || anyType } function tryGetThisTypeAt(node, container) { if (void 0 === container && (container = ts.getThisContainer(node, !1)), ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { if (191 === container.kind && 199 === container.parent.kind && 3 === ts.getSpecialPropertyAssignmentKind(container.parent)) { var className = container.parent.left.expression.expression, classSymbol = checkExpression(className).symbol; if (classSymbol && classSymbol.members && 16 & classSymbol.flags) return getFlowTypeOfReference(node, getInferredClassType(classSymbol)) } var thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container); if (thisType) return getFlowTypeOfReference(node, thisType) } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent), type = ts.hasModifier(container, 32) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; return getFlowTypeOfReference(node, type) } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); if (type && type !== unknownType) return getFlowTypeOfReference(node, type) } } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); if (jsdocType && 283 === jsdocType.kind) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && "this" === jsDocFunctionType.parameters[0].name.escapedText) return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type) } } function isInConstructorArgumentInitializer(node, constructorDecl) { return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : 148 === n.kind }) } function checkSuperExpression(node) { function isLegalUsageOfSuperExpression(container) { return !!container && (isCallExpression ? 154 === container.kind : !(!ts.isClassLike(container.parent) && 183 !== container.parent.kind) && (ts.hasModifier(container, 32) ? 153 === container.kind || 152 === container.kind || 155 === container.kind || 156 === container.kind : 153 === container.kind || 152 === container.kind || 155 === container.kind || 156 === container.kind || 151 === container.kind || 150 === container.kind || 154 === container.kind)) } var isCallExpression = 186 === node.parent.kind && node.parent.expression === node, container = ts.getSuperContainer(node, !0), needToCaptureLexicalThis = !1; if (!isCallExpression) for (; container && 192 === container.kind;)container = ts.getSuperContainer(container, !0), needToCaptureLexicalThis = languageVersion < 2; var canUseSuperExpression = isLegalUsageOfSuperExpression(container), nodeCheckFlag = 0; if (!canUseSuperExpression) { var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : 146 === n.kind }); return current && 146 === current.kind ? error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name) : isCallExpression ? error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors) : container && container.parent && (ts.isClassLike(container.parent) || 183 === container.parent.kind) ? error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class) : error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions), unknownType } if (isCallExpression || 154 !== container.kind || checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class), nodeCheckFlag = ts.hasModifier(container, 32) || isCallExpression ? 512 : 256, getNodeLinks(node).flags |= nodeCheckFlag, 153 === container.kind && ts.hasModifier(container, 256) && (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent) ? getNodeLinks(container).flags |= 4096 : getNodeLinks(container).flags |= 2048), needToCaptureLexicalThis && captureLexicalThis(node.parent, container), 183 === container.parent.kind) return languageVersion < 2 ? (error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher), unknownType) : anyType; var classLikeDeclaration = container.parent; if (!ts.getClassExtendsHeritageClauseElement(classLikeDeclaration)) return error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class), unknownType; var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration)), baseClassType = classType && getBaseTypes(classType)[0]; return baseClassType ? 154 === container.kind && isInConstructorArgumentInitializer(node, container) ? (error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments), unknownType) : 512 === nodeCheckFlag ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType) : unknownType } function getContainingObjectLiteral(func) { return 153 !== func.kind && 155 !== func.kind && 156 !== func.kind || 183 !== func.parent.kind ? 191 === func.kind && 269 === func.parent.kind ? func.parent.parent : void 0 : func.parent } function getThisTypeArgument(type) { return 4 & ts.getObjectFlags(type) && type.target === globalThisType ? type.typeArguments[0] : void 0 } function getThisTypeFromContextualType(type) { return mapType(type, function (t) { return 262144 & t.flags ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t) }) } function getContextualThisParameterType(func) { if (192 !== func.kind) { if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; if (thisParameter) return getTypeOfSymbol(thisParameter) } } var inJs = ts.isInJavaScriptFile(func); if (noImplicitThis || inJs) { var containingLiteral = getContainingObjectLiteral(func); if (containingLiteral) { for (var contextualType = getApparentTypeOfContextualType(containingLiteral), literal = containingLiteral, type = contextualType; type;) { var thisType = getThisTypeFromContextualType(type); if (thisType) return instantiateType(thisType, getContextualMapper(containingLiteral)); if (269 !== literal.parent.kind) break; literal = literal.parent.parent, type = getApparentTypeOfContextualType(literal) } return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral) } var parent = func.parent; if (199 === parent.kind && 58 === parent.operatorToken.kind) { var target = parent.left; if (184 === target.kind || 185 === target.kind) { var expression = target.expression; if (inJs && ts.isIdentifier(expression)) { var sourceFile = ts.getSourceFileOfNode(parent); if (sourceFile.commonJsModuleIndicator && getResolvedSymbol(expression) === sourceFile.symbol) return } return checkExpressionCached(expression) } } } } } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); if (iife && iife.arguments) { var indexOfParameter = func.parameters.indexOf(parameter); if (parameter.dotDotDotToken) { for (var restTypes = [], i = indexOfParameter; i < iife.arguments.length; i++)restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); return restTypes.length ? createArrayType(getUnionType(restTypes)) : void 0 } var links = getNodeLinks(iife), cached = links.resolvedSignature; links.resolvedSignature = anySignature; var type = indexOfParameter < iife.arguments.length ? getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : parameter.initializer ? void 0 : undefinedWideningType; return links.resolvedSignature = cached, type } var contextualSignature = getContextualSignature(func); if (contextualSignature) { var funcHasRestParameters = ts.hasRestParameter(func), len = func.parameters.length - (funcHasRestParameters ? 1 : 0), indexOfParameter = func.parameters.indexOf(parameter); if (void 0 === ts.getThisParameter(func) || contextualSignature.thisParameter || (ts.Debug.assert(0 !== indexOfParameter), indexOfParameter -= 1), indexOfParameter < len) return getTypeAtPosition(contextualSignature, indexOfParameter); if (funcHasRestParameters && indexOfParameter === func.parameters.length - 1 && isRestParameterIndex(contextualSignature, func.parameters.length - 1)) return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)) } } } function getContextualTypeForInitializerExpression(node) { var declaration = node.parent; if (ts.hasInitializer(declaration) && node === declaration.initializer) { var typeNode = ts.getEffectiveTypeAnnotationNode(declaration); if (typeNode) return getTypeFromTypeNode(typeNode); if (148 === declaration.kind) { var type = getContextuallyTypedParameterType(declaration); if (type) return type } if (ts.isBindingPattern(declaration.name)) return getTypeFromBindingPattern(declaration.name, !0, !1); if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent, name = declaration.propertyName || declaration.name; if (181 !== parentDeclaration.kind) { var parentTypeNode = ts.getEffectiveTypeAnnotationNode(parentDeclaration); if (parentTypeNode && !ts.isBindingPattern(name)) { var text = ts.getTextOfPropertyName(name); if (text) return getTypeOfPropertyOfType(getTypeFromTypeNode(parentTypeNode), text) } } } } } function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { var functionFlags = ts.getFunctionFlags(func); if (1 & functionFlags) return; var contextualReturnType = getContextualReturnType(func); return 2 & functionFlags ? contextualReturnType && getAwaitedTypeOfPromise(contextualReturnType) : contextualReturnType } } function getContextualTypeForYieldOperand(node) { var func = ts.getContainingFunction(node); if (func) { var functionFlags = ts.getFunctionFlags(func), contextualReturnType = getContextualReturnType(func); if (contextualReturnType) return node.asteriskToken ? contextualReturnType : getIteratedTypeOfGenerator(contextualReturnType, 0 !== (2 & functionFlags)) } } function isInParameterInitializerBeforeContainingFunction(node) { for (var inBindingInitializer = !1; node.parent && !ts.isFunctionLike(node.parent);) { if (ts.isParameter(node.parent) && (inBindingInitializer || node.parent.initializer === node)) return !0; ts.isBindingElement(node.parent) && node.parent.initializer === node && (inBindingInitializer = !0), node = node.parent } return !1 } function getContextualReturnType(functionDecl) { if (154 === functionDecl.kind || ts.getEffectiveReturnTypeNode(functionDecl) || isGetAccessorWithAnnotatedSetAccessor(functionDecl)) return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); return signature && !isResolvingReturnTypeOfSignature(signature) ? getReturnTypeOfSignature(signature) : void 0 } function getContextualTypeForArgument(callTarget, arg) { var args = getEffectiveCallArguments(callTarget), argIndex = args.indexOf(arg); return argIndex === -1 ? void 0 : getContextualTypeForArgumentAtIndex(callTarget, argIndex) } function getContextualTypeForArgumentAtIndex(callTarget, argIndex) { var signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget); return getTypeAtPosition(signature, argIndex) } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { if (188 === template.parent.kind) return getContextualTypeForArgument(template.parent, substitutionExpression) } function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent, left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right; switch (operatorToken.kind) { case 58: return node === right && isContextSensitiveAssignment(binaryExpression) ? getTypeOfExpression(left) : void 0; case 54: var type = getContextualType(binaryExpression); return type || node !== right || ts.getDeclaredJavascriptInitializer(binaryExpression.parent) || ts.getAssignedJavascriptInitializer(binaryExpression) ? type : getTypeOfExpression(left); case 53: case 26: return node === right ? getContextualType(binaryExpression) : void 0; default: return } } function isContextSensitiveAssignment(binaryExpression) { var kind = ts.getSpecialPropertyAssignmentKind(binaryExpression); switch (kind) { case 0: return !0; case 5: return !binaryExpression.left.symbol; case 1: case 2: case 3: case 4: case 6: return !1; default: ts.Debug.assertNever(kind) } } function getTypeOfPropertyOfContextualType(type, name) { return mapType(type, function (t) { var prop = 458752 & t.flags ? getPropertyOfType(t, name) : void 0; return prop ? getTypeOfSymbol(prop) : void 0 }, !0) } function getIndexTypeOfContextualType(type, kind) { return mapType(type, function (t) { return getIndexTypeOfStructuredType(t, kind) }, !0) } function contextualTypeIsTupleLikeType(type) { return !!(131072 & type.flags ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)) } function getContextualTypeForObjectLiteralMethod(node) { if (ts.Debug.assert(ts.isObjectLiteralMethod(node)), !(8388608 & node.flags)) return getContextualTypeForObjectLiteralElement(node) } function getContextualTypeForObjectLiteralElement(element) { var objectLiteral = element.parent, type = getApparentTypeOfContextualType(objectLiteral); if (type) { if (!hasNonBindableDynamicName(element)) { var symbolName_1 = getSymbolOfNode(element).escapedName, propertyType = getTypeOfPropertyOfContextualType(type, symbolName_1); if (propertyType) return propertyType } return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0) } } function getContextualTypeForElementExpression(arrayContextualType, index) { return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || getIndexTypeOfContextualType(arrayContextualType, 1) || getIteratedTypeOrElementType(arrayContextualType, void 0, !1, !1, !1)) } function getContextualTypeForConditionalOperand(node) { var conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : void 0 } function getContextualTypeForChildJsxExpression(node) { var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName), jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node)); return attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && "" !== jsxChildrenPropertyName ? getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName) : void 0 } function getContextualTypeForJsxExpression(node) { var exprParent = node.parent; return ts.isJsxAttributeLike(exprParent) ? getContextualType(node) : ts.isJsxElement(exprParent) ? getContextualTypeForChildJsxExpression(exprParent) : void 0 } function getContextualTypeForJsxAttribute(attribute) { if (ts.isJsxAttribute(attribute)) { var attributesType = getApparentTypeOfContextualType(attribute.parent); if (!attributesType || isTypeAny(attributesType)) return; return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText) } return getContextualType(attribute.parent) } function isPossiblyDiscriminantValue(node) { switch (node.kind) { case 9: case 8: case 13: case 101: case 86: case 95: case 71: return !0; case 184: case 190: return isPossiblyDiscriminantValue(node.expression) }return !1 } function getApparentTypeOfContextualType(node) { var contextualType = getContextualType(node); if (contextualType = contextualType && mapType(contextualType, getApparentType), !(contextualType && 131072 & contextualType.flags && ts.isObjectLiteralExpression(node))) return contextualType; var match; propLoop: for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; if (prop.symbol && 269 === prop.kind && isPossiblyDiscriminantValue(prop.initializer) && isDiscriminantProperty(contextualType, prop.symbol.escapedName)) for (var discriminatingType = checkExpression(prop.initializer), _b = 0, _c = contextualType.types; _b < _c.length; _b++) { var type = _c[_b], targetType = getTypeOfPropertyOfType(type, prop.symbol.escapedName); if (targetType && checkTypeAssignableTo(discriminatingType, targetType, void 0)) { if (match) { if (type === match) continue; match = void 0; break propLoop } match = type } } } return match || contextualType } function getContextualType(node) { if (!(8388608 & node.flags)) { if (node.contextualType) return node.contextualType; var parent = node.parent; switch (parent.kind) { case 231: case 148: case 151: case 150: case 181: return getContextualTypeForInitializerExpression(node); case 192: case 224: return getContextualTypeForReturnExpression(node); case 202: return getContextualTypeForYieldOperand(parent); case 186: case 187: return getContextualTypeForArgument(parent, node); case 189: case 207: return getTypeFromTypeNode(parent.type); case 199: return getContextualTypeForBinaryOperand(node); case 269: case 270: return getContextualTypeForObjectLiteralElement(parent); case 271: return getApparentTypeOfContextualType(parent.parent); case 182: var arrayLiteral = parent, type = getApparentTypeOfContextualType(arrayLiteral); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); case 200: return getContextualTypeForConditionalOperand(node); case 210: return ts.Debug.assert(201 === parent.parent.kind), getContextualTypeForSubstitutionExpression(parent.parent, node); case 190: var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : void 0; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); case 264: return getContextualTypeForJsxExpression(parent); case 261: case 263: return getContextualTypeForJsxAttribute(parent); case 256: case 255: return getContextualJsxElementAttributesType(parent) } } } function getContextualMapper(node) { return node = ts.findAncestor(node, function (n) { return !!n.contextualMapper }), node ? node.contextualMapper : identityMapper } function getContextualJsxElementAttributesType(node) { if (isJsxIntrinsicIdentifier(node.tagName)) return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); var valueType = checkExpression(node.tagName); if (isTypeAny(valueType)) return anyType; var isJs = ts.isInJavaScriptFile(node); return mapType(valueType, function (t) { return getJsxSignaturesParameterTypes(t, isJs, node) }) } function getJsxSignaturesParameterTypes(valueType, isJs, context) { if (2 & valueType.flags) return anyType; if (32 & valueType.flags) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, context); if (intrinsicElementsType !== unknownType) { var stringLiteralTypeName = valueType.value, intrinsicProp = getPropertyOfType(intrinsicElementsType, ts.escapeLeadingUnderscores(stringLiteralTypeName)); if (intrinsicProp) return getTypeOfSymbol(intrinsicProp); var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0); if (indexSignatureType) return indexSignatureType } return anyType } var signatures = getSignaturesOfType(valueType, 1), ctor = !0; if (0 === signatures.length && (signatures = getSignaturesOfType(valueType, 0), ctor = !1, 0 === signatures.length)) return unknownType; var links = getNodeLinks(context); links.resolvedSignatures || (links.resolvedSignatures = ts.createMap()); var cacheKey = "" + getTypeId(valueType), cachedResolved = links.resolvedSignatures.get(cacheKey); return cachedResolved && cachedResolved !== resolvingSignaturesArray ? signatures = cachedResolved : cachedResolved || (links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray), links.resolvedSignatures.set(cacheKey, signatures = instantiateJsxSignatures(context, signatures))), getUnionType(ts.map(signatures, ctor ? function (t) { return getJsxPropsTypeFromClassType(t, isJs, context, !1) } : function (t) { return getJsxPropsTypeFromCallSignature(t, context) }), 0) } function getJsxPropsTypeFromCallSignature(sig, context) { var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType), intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); return intrinsicAttribs !== unknownType && (propsType = intersectTypes(intrinsicAttribs, propsType)), propsType } function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) { var instanceType = getReturnTypeOfSignature(sig); return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation) } function getJsxPropsTypeFromClassType(sig, isJs, context, reportErrors) { var forcedLookupLocation = getJsxElementPropertiesName(getJsxNamespaceAt(context)), attributesType = void 0 === forcedLookupLocation ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) : "" === forcedLookupLocation ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); if (attributesType) { if (isTypeAny(attributesType)) return attributesType; var apparentAttributesType = attributesType, intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); if (intrinsicClassAttribs !== unknownType) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol), hostClassType = getReturnTypeOfSignature(sig); apparentAttributesType = intersectTypes(typeParams ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isJs)) : intrinsicClassAttribs, apparentAttributesType) } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); return intrinsicAttribs !== unknownType && (apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType)), apparentAttributesType } return reportErrors && forcedLookupLocation && ts.length(context.attributes.properties) && error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation)), emptyObjectType } function getContextualCallSignature(type, node) { var signatures = getSignaturesOfType(type, 0); if (1 === signatures.length) { var signature = signatures[0]; if (!isAritySmaller(signature, node)) return signature } } function isAritySmaller(signature, target) { for (var targetParameterCount = 0; targetParameterCount < target.parameters.length; targetParameterCount++) { var param = target.parameters[targetParameterCount]; if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) break } target.parameters.length && ts.parameterIsThisKeyword(target.parameters[0]) && targetParameterCount--; var sourceLength = signature.hasRestParameter ? Number.MAX_VALUE : signature.parameters.length; return sourceLength < targetParameterCount } function isFunctionExpressionOrArrowFunction(node) { return 191 === node.kind || 192 === node.kind } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) ? getContextualSignature(node) : void 0 } function getContextualTypeForFunctionLikeDeclaration(node) { return ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getApparentTypeOfContextualType(node) } function getContextualSignature(node) { ts.Debug.assert(153 !== node.kind || ts.isObjectLiteralMethod(node)); var type; if (ts.isInJavaScriptFile(node)) { var jsdoc = ts.getJSDocType(node); jsdoc && (type = getTypeFromTypeNode(jsdoc)) } if (type || (type = getContextualTypeForFunctionLikeDeclaration(node)), type) { if (!(131072 & type.flags)) return getContextualCallSignature(type, node); for (var signatureList, types = type.types, _i = 0, types_15 = types; _i < types_15.length; _i++) { var current = types_15[_i], signature = getContextualCallSignature(current, node); if (signature) if (signatureList) { if (!compareSignaturesIdentical(signatureList[0], signature, !1, !0, !0, compareTypesIdentical)) return; signatureList.push(signature) } else signatureList = [signature] } var result; return signatureList && (result = cloneSignature(signatureList[0]), result.unionSignatures = signatureList), result } } function checkSpreadExpression(node, checkMode) { languageVersion < 2 && compilerOptions.downlevelIteration && checkExternalEmitHelpers(node, 1536); var arrayOrIterableType = checkExpression(node.expression, checkMode); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, !1, !1) } function hasDefaultValue(node) { return 181 === node.kind && !!node.initializer || 199 === node.kind && 58 === node.operatorToken.kind } function checkArrayLiteral(node, checkMode) { for (var elements = node.elements, hasSpreadElement = !1, elementTypes = [], inDestructuringPattern = ts.isAssignmentTarget(node), contextualType = getApparentTypeOfContextualType(node), index = 0; index < elements.length; index++) { var e = elements[index]; if (inDestructuringPattern && 203 === e.kind) { var restArrayType = checkExpression(e.expression, checkMode), restElementType = getIndexTypeOfType(restArrayType, 1) || getIteratedTypeOrElementType(restArrayType, void 0, !1, !1, !1); restElementType && elementTypes.push(restElementType) } else { var elementContextualType = getContextualTypeForElementExpression(contextualType, index), type = checkExpressionForMutableLocation(e, checkMode, elementContextualType); elementTypes.push(type) } hasSpreadElement = hasSpreadElement || 203 === e.kind } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { var type = cloneTypeReference(createTupleType(elementTypes)); return type.pattern = node, type } if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; if (pattern && (180 === pattern.kind || 182 === pattern.kind)) for (var patternElements = pattern.elements, i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; hasDefaultValue(patternElement) ? elementTypes.push(contextualType.typeArguments[i]) : (205 !== patternElement.kind && error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value), elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType)) } if (elementTypes.length) return createTupleType(elementTypes) } } return createArrayType(elementTypes.length ? getUnionType(elementTypes, 2) : strictNullChecks ? implicitNeverType : undefinedWideningType) } function isNumericName(name) { switch (name.kind) { case 146: return isNumericComputedName(name); case 71: return isNumericLiteralName(name.escapedText); case 8: case 9: return isNumericLiteralName(name.text); default: return !1 } } function isNumericComputedName(name) { return isTypeAssignableToKind(checkComputedPropertyName(name), 84) } function isInfinityOrNaNString(name) { return "Infinity" === name || "-Infinity" === name || "NaN" === name } function isNumericLiteralName(name) { return (+name).toString() === name } function checkComputedPropertyName(node) { var links = getNodeLinks(node.expression); return links.resolvedType || (links.resolvedType = checkExpression(node.expression), 12288 & links.resolvedType.flags || !isTypeAssignableToKind(links.resolvedType, 1654) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType) ? error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any) : checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, !0)), links.resolvedType } function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) { for (var propTypes = [], i = 0; i < properties.length; i++)(0 === kind || isNumericName(propertyNodes[i + offset].name)) && propTypes.push(getTypeOfSymbol(properties[i])); var unionType = propTypes.length ? getUnionType(propTypes, 2) : undefinedType; return createIndexInfo(unionType, !1) } function checkObjectLiteral(node, checkMode) { function createObjectLiteralType() { var stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : void 0, numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : void 0, result = createAnonymousType(node.symbol, propertiesTable, ts.emptyArray, ts.emptyArray, stringIndexInfo, numberIndexInfo), freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8388608; return result.flags |= 33554432 | freshObjectLiteralFlag | 117440512 & typeFlags, result.objectFlags |= 128, patternWithComputedProperties && (result.objectFlags |= 512), inDestructuringPattern && (result.pattern = node), 12288 & result.flags || (propagatedFlags |= 117440512 & result.flags), result } var inDestructuringPattern = ts.isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable, propertiesArray = [], spread = emptyObjectType, propagatedFlags = 8388608, contextualType = getApparentTypeOfContextualType(node), contextualTypeHasPattern = contextualType && contextualType.pattern && (179 === contextualType.pattern.kind || 183 === contextualType.pattern.kind), isInJSFile = ts.isInJavaScriptFile(node) && !ts.isInJsonFile(node), isJSObjectLiteral = !contextualType && isInJSFile, typeFlags = 0, patternWithComputedProperties = !1, hasComputedStringProperty = !1, hasComputedNumberProperty = !1; if (isInJSFile && 0 === node.properties.length) { var symbol = getSymbolOfNode(node); if (symbol.exports) return propertiesTable = symbol.exports, symbol.exports.forEach(function (symbol) { return propertiesArray.push(getMergedSymbol(symbol)) }), createObjectLiteralType() } propertiesTable = ts.createSymbolTable(); for (var offset = 0, i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i], member = getSymbolOfNode(memberDecl), computedNameType = memberDecl.name && 146 === memberDecl.name.kind && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ? checkComputedPropertyName(memberDecl.name) : void 0; if (269 === memberDecl.kind || 270 === memberDecl.kind || ts.isObjectLiteralMethod(memberDecl)) { var type = 269 === memberDecl.kind ? checkPropertyAssignment(memberDecl, checkMode) : 270 === memberDecl.kind ? checkExpressionForMutableLocation(memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJSFile) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); jsDocType && (checkTypeAssignableTo(type, jsDocType, memberDecl), type = jsDocType) } typeFlags |= type.flags; var nameType = computedNameType && 1120 & computedNameType.flags ? computedNameType : void 0, prop = nameType ? createSymbol(4 | member.flags, getLateBoundNameFromType(nameType), 1024) : createSymbol(4 | member.flags, member.escapedName); if (nameType && (prop.nameType = nameType), inDestructuringPattern) { var isOptional = 269 === memberDecl.kind && hasDefaultValue(memberDecl.initializer) || 270 === memberDecl.kind && memberDecl.objectAssignmentInitializer; isOptional && (prop.flags |= 16777216) } else if (contextualTypeHasPattern && !(512 & ts.getObjectFlags(contextualType))) { var impliedProp = getPropertyOfType(contextualType, member.escapedName); impliedProp ? prop.flags |= 16777216 & impliedProp.flags : compilerOptions.suppressExcessPropertyErrors || getIndexInfoOfType(contextualType, 0) || error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)) } prop.declarations = member.declarations, prop.parent = member.parent, member.valueDeclaration && (prop.valueDeclaration = member.valueDeclaration), prop.type = type, prop.target = member, member = prop } else { if (271 === memberDecl.kind) { languageVersion < 2 && checkExternalEmitHelpers(memberDecl, 2), propertiesArray.length > 0 && (spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, propagatedFlags, 0), propertiesArray = [], propertiesTable = ts.createSymbolTable(), hasComputedStringProperty = !1, hasComputedNumberProperty = !1, typeFlags = 0); var type = checkExpression(memberDecl.expression); if (!isValidSpreadType(type)) return error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types), unknownType; spread = getSpreadType(spread, type, node.symbol, propagatedFlags, 0), offset = i + 1; continue } ts.Debug.assert(155 === memberDecl.kind || 156 === memberDecl.kind), checkNodeDeferred(memberDecl) } !computedNameType || 1120 & computedNameType.flags ? propertiesTable.set(member.escapedName, member) : isTypeAssignableTo(computedNameType, stringNumberSymbolType) && (isTypeAssignableTo(computedNameType, numberType) ? hasComputedNumberProperty = !0 : hasComputedStringProperty = !0, inDestructuringPattern && (patternWithComputedProperties = !0)), propertiesArray.push(member) } if (contextualTypeHasPattern) for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; propertiesTable.get(prop.escapedName) || spread && getPropertyOfType(spread, prop.escapedName) || (16777216 & prop.flags || error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value), propertiesTable.set(prop.escapedName, prop), propertiesArray.push(prop)) } return spread !== emptyObjectType ? (propertiesArray.length > 0 && (spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, propagatedFlags, 0)), spread) : createObjectLiteralType() } function isValidSpreadType(type) { return !!(134217729 & type.flags || 14560 & getFalsyFlags(type) && isValidSpreadType(removeDefinitelyFalsyTypes(type)) || 65536 & type.flags && !isGenericMappedType(type) || 393216 & type.flags && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t) })) } function checkJsxSelfClosingElement(node, checkMode) { return checkJsxOpeningLikeElementOrOpeningFragment(node, checkMode), getJsxElementTypeAt(node) || anyType } function checkJsxElement(node, checkMode) { return checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement, checkMode), isJsxIntrinsicIdentifier(node.closingElement.tagName) ? getIntrinsicTagSymbol(node.closingElement) : checkExpression(node.closingElement.tagName), getJsxElementTypeAt(node) || anyType } function checkJsxFragment(node, checkMode) { return checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment, checkMode), 2 === compilerOptions.jsx && (compilerOptions.jsxFactory || ts.getSourceFileOfNode(node).pragmas.has("jsx")) && error(node, compilerOptions.jsxFactory ? ts.Diagnostics.JSX_fragment_is_not_supported_when_using_jsxFactory : ts.Diagnostics.JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma), getJsxElementTypeAt(node) || anyType } function isUnhyphenatedJsxName(name) { return !ts.stringContains(name, "-") } function isJsxIntrinsicIdentifier(tagName) { switch (tagName.kind) { case 184: case 99: return !1; case 71: return ts.isIntrinsicJsxName(tagName.escapedText); default: ts.Debug.fail() } } function checkJsxAttribute(node, checkMode) { return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType } function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { function createJsxAttributesType() { var result = createAnonymousType(attributes.symbol, attributesTable, ts.emptyArray, ts.emptyArray, void 0, void 0); return result.flags |= 33554432, result.objectFlags |= 4224, result } for (var typeToIntersect, attributes = openingLikeElement.attributes, attributesTable = ts.createSymbolTable(), spread = emptyObjectType, hasSpreadAnyType = !1, explicitlySpecifyChildrenAttribute = !1, jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(openingLikeElement)), _i = 0, _a = attributes.properties; _i < _a.length; _i++) { var attributeDecl = _a[_i], member = attributeDecl.symbol; if (ts.isJsxAttribute(attributeDecl)) { var exprType = checkJsxAttribute(attributeDecl, checkMode), attributeSymbol = createSymbol(33554436 | member.flags, member.escapedName); attributeSymbol.declarations = member.declarations, attributeSymbol.parent = member.parent, member.valueDeclaration && (attributeSymbol.valueDeclaration = member.valueDeclaration), attributeSymbol.type = exprType, attributeSymbol.target = member, attributesTable.set(attributeSymbol.escapedName, attributeSymbol), attributeDecl.name.escapedText === jsxChildrenPropertyName && (explicitlySpecifyChildrenAttribute = !0) } else { ts.Debug.assert(263 === attributeDecl.kind), attributesTable.size > 0 && (spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, 0, 4096), attributesTable = ts.createSymbolTable()); var exprType = checkExpressionCached(attributeDecl.expression, checkMode); isTypeAny(exprType) && (hasSpreadAnyType = !0), isValidSpreadType(exprType) ? spread = getSpreadType(spread, exprType, openingLikeElement.symbol, 0, 4096) : typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType } } hasSpreadAnyType || attributesTable.size > 0 && (spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, 0, 4096)); var parent = 254 === openingLikeElement.parent.kind ? openingLikeElement.parent : void 0; if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && "" !== jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute && error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName)); var childrenPropSymbol = createSymbol(33554436, jsxChildrenPropertyName); childrenPropSymbol.type = 1 === childrenTypes.length ? childrenTypes[0] : createArrayType(getUnionType(childrenTypes)); var childPropMap = ts.createSymbolTable(); childPropMap.set(jsxChildrenPropertyName, childrenPropSymbol), spread = getSpreadType(spread, createAnonymousType(attributes.symbol, childPropMap, ts.emptyArray, ts.emptyArray, void 0, void 0), attributes.symbol, 0, 4096) } } return hasSpreadAnyType ? anyType : typeToIntersect && spread !== emptyObjectType ? getIntersectionType([typeToIntersect, spread]) : typeToIntersect || (spread === emptyObjectType ? createJsxAttributesType() : spread) } function checkJsxChildren(node, checkMode) { for (var childrenTypes = [], _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; 10 === child.kind ? child.containsOnlyWhiteSpaces || childrenTypes.push(stringType) : childrenTypes.push(checkExpressionForMutableLocation(child, checkMode)) } return childrenTypes } function checkJsxAttributes(node, checkMode) { return createJsxAttributesTypeFromAttributesProperty(node.parent, checkMode) } function getJsxType(name, location) { var namespace = getJsxNamespaceAt(location), exports = namespace && getExportsOfSymbol(namespace), typeSymbol = exports && getSymbol(exports, name, 67901928); return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : unknownType } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, node); if (intrinsicElementsType !== unknownType) { if (!ts.isIdentifier(node.tagName)) return ts.Debug.fail(); var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.escapedText); if (intrinsicProp) return links.jsxFlags |= 1, links.resolvedSymbol = intrinsicProp; var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0); return indexSignatureType ? (links.jsxFlags |= 2, links.resolvedSymbol = intrinsicElementsType.symbol) : (error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(node.tagName), "JSX." + JsxNames.IntrinsicElements), links.resolvedSymbol = unknownSymbol) } return noImplicitAny && error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, ts.unescapeLeadingUnderscores(JsxNames.IntrinsicElements)), links.resolvedSymbol = unknownSymbol } return links.resolvedSymbol } function instantiateJsxSignatures(node, signatures) { for (var candidateForTypeArgumentError, instantiatedSignatures = [], hasTypeArgumentError = !!node.typeArguments, _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) { var signature = signatures_3[_i]; if (signature.typeParameters) { var isJavascript = ts.isInJavaScriptFile(node), typeArgumentInstantiated = getJsxSignatureTypeArgumentInstantiation(signature, node, isJavascript, !1); if (typeArgumentInstantiated) hasTypeArgumentError = !1, instantiatedSignatures.push(typeArgumentInstantiated); else { node.typeArguments && hasCorrectTypeArgumentArity(signature, node.typeArguments) && (candidateForTypeArgumentError = signature); var inferenceContext = createInferenceContext(signature.typeParameters, signature, isJavascript ? 4 : 0), typeArguments = inferJsxTypeArguments(signature, node, inferenceContext); instantiatedSignatures.push(getSignatureInstantiation(signature, typeArguments, isJavascript)) } } else instantiatedSignatures.push(signature) } return node.typeArguments && hasTypeArgumentError && (candidateForTypeArgumentError ? checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, !0) : 0 !== node.typeArguments.length && diagnostics.add(getTypeArgumentArityError(node, signatures, node.typeArguments))), instantiatedSignatures } function getJsxSignatureTypeArgumentInstantiation(signature, node, isJavascript, reportErrors) { if (node.typeArguments && hasCorrectTypeArgumentArity(signature, node.typeArguments)) { var args = checkTypeArguments(signature, node.typeArguments, reportErrors); if (args) return getSignatureInstantiation(signature, args, isJavascript) } } function getJsxNamespaceAt(location) { var namespaceName = getJsxNamespace(location), resolvedNamespace = resolveName(location, namespaceName, 1920, void 0, namespaceName, !1); if (resolvedNamespace) { var candidate = getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920); if (candidate) return candidate } return getGlobalSymbol(JsxNames.JSX, 1920, void 0) } function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) { var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 67901928), jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym), propertiesOfJsxElementAttribPropInterface = jsxElementAttribPropInterfaceType && getPropertiesOfType(jsxElementAttribPropInterfaceType); if (propertiesOfJsxElementAttribPropInterface) { if (0 === propertiesOfJsxElementAttribPropInterface.length) return ""; if (1 === propertiesOfJsxElementAttribPropInterface.length) return propertiesOfJsxElementAttribPropInterface[0].escapedName; propertiesOfJsxElementAttribPropInterface.length > 1 && error(jsxElementAttribPropInterfaceSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, ts.unescapeLeadingUnderscores(nameOfAttribPropContainer)) } } function getJsxElementPropertiesName(jsxNamespace) { return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace) } function getJsxElementChildrenPropertyName(jsxNamespace) { return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace) } function getApparentTypeOfJsxPropsType(propsType) { if (propsType) { if (262144 & propsType.flags) { for (var propsApparentType = [], _i = 0, _a = propsType.types; _i < _a.length; _i++) { var t = _a[_i]; propsApparentType.push(getApparentType(t)) } return getIntersectionType(propsApparentType) } return getApparentType(propsType) } } function defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { if (ts.Debug.assert(!(131072 & elementType.flags)), !elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { var jsxStatelessElementType = getJsxStatelessElementTypeAt(openingLikeElement); if (jsxStatelessElementType) { var callSignature = getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, void 0); if (callSignature !== unknownSignature) { var callReturnType = callSignature && getReturnTypeOfSignature(callSignature), paramType = callReturnType && (0 === callSignature.parameters.length ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); if (paramType = getApparentTypeOfJsxPropsType(paramType), callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, openingLikeElement); return intrinsicAttributes !== unknownType && (paramType = intersectTypes(intrinsicAttributes, paramType)), paramType } } } } } function tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { if (ts.Debug.assert(!(131072 & elementType.flags)), !elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { var jsxStatelessElementType = getJsxStatelessElementTypeAt(openingLikeElement); if (jsxStatelessElementType) { var candidatesOutArray = []; getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray); for (var result = void 0, allMatchingAttributesType = void 0, _i = 0, candidatesOutArray_1 = candidatesOutArray; _i < candidatesOutArray_1.length; _i++) { var candidate = candidatesOutArray_1[_i], callReturnType = getReturnTypeOfSignature(candidate), paramType = callReturnType && (0 === candidate.parameters.length ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0])); if (paramType = getApparentTypeOfJsxPropsType(paramType), callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { for (var shouldBeCandidate = !0, _a = 0, _b = openingLikeElement.attributes.properties; _a < _b.length; _a++) { var attribute = _b[_a]; if (ts.isJsxAttribute(attribute) && isUnhyphenatedJsxName(attribute.name.escapedText) && !getPropertyOfType(paramType, attribute.name.escapedText)) { shouldBeCandidate = !1; break } } shouldBeCandidate && (result = intersectTypes(result, paramType)), allMatchingAttributesType = intersectTypes(allMatchingAttributesType, paramType) } } result || (result = allMatchingAttributesType); var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, openingLikeElement); return intrinsicAttributes !== unknownType && (result = intersectTypes(intrinsicAttributes, result)), result } } } function getInstantiatedJsxSignatures(openingLikeElement, elementType, reportErrors) { var links = getNodeLinks(openingLikeElement); links.resolvedSignatures || (links.resolvedSignatures = ts.createMap()); var cacheKey = "" + getTypeId(elementType); if (!links.resolvedSignatures.get(cacheKey) || links.resolvedSignatures.get(cacheKey) !== resolvingSignaturesArray) { if (links.resolvedSignatures.get(cacheKey)) return links.resolvedSignatures.get(cacheKey); links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray); var signatures = getSignaturesOfType(elementType, 1); if (0 === signatures.length && (signatures = getSignaturesOfType(elementType, 0), 0 === signatures.length)) return void (reportErrors && error(openingLikeElement.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(openingLikeElement.tagName))); var results = instantiateJsxSignatures(openingLikeElement, signatures); return links.resolvedSignatures.set(cacheKey, results), results } } function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) { if (131072 & elementType.flags) { var types = elementType.types; return getUnionType(types.map(function (type) { return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType) }), 2) } if (isTypeAny(elementType)) return elementType; if (2 & elementType.flags) return anyType; if (32 & elementType.flags) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, openingLikeElement); if (intrinsicElementsType !== unknownType) { var stringLiteralTypeName = elementType.value, intrinsicProp = getPropertyOfType(intrinsicElementsType, ts.escapeLeadingUnderscores(stringLiteralTypeName)); if (intrinsicProp) return getTypeOfSymbol(intrinsicProp); var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0); if (indexSignatureType) return indexSignatureType; error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements) } return anyType } var instantiatedSignatures = getInstantiatedJsxSignatures(openingLikeElement, elementType, !0); if (!ts.length(instantiatedSignatures)) return unknownType; var elemInstanceType = getUnionType(ts.map(instantiatedSignatures, getReturnTypeOfSignature), 2), statelessAttributesType = shouldIncludeAllStatelessAttributesType ? tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); if (statelessAttributesType) return statelessAttributesType; elementClassType && checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); var isJs = ts.isInJavaScriptFile(openingLikeElement); return getUnionType(ts.map(instantiatedSignatures, function (sig) { return getJsxPropsTypeFromClassType(sig, isJs, openingLikeElement, !0) })) } function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); var links = getNodeLinks(node); if (!links.resolvedJsxElementAttributesType) { var symbol = getIntrinsicTagSymbol(node); return 1 & links.jsxFlags ? links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol) : 2 & links.jsxFlags ? links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, 0).type : links.resolvedJsxElementAttributesType = unknownType } return links.resolvedJsxElementAttributesType } function getCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType) { return resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, checkExpression(node.tagName), getJsxElementClassTypeAt(node)) } function getAllAttributesTypeFromJsxOpeningLikeElement(node) { return isJsxIntrinsicIdentifier(node.tagName) ? getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) : getCustomJsxElementAttributesType(node, !0) } function getAttributesTypeFromJsxOpeningLikeElement(node) { return isJsxIntrinsicIdentifier(node.tagName) ? getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) : getCustomJsxElementAttributesType(node, !1) } function getJsxAttributePropertySymbol(attrib) { var attributesType = getAttributesTypeFromJsxOpeningLikeElement(attrib.parent.parent), prop = getPropertyOfType(attributesType, attrib.name.escapedText); return prop || unknownSymbol } function getJsxElementClassTypeAt(location) { var type = getJsxType(JsxNames.ElementClass, location); if (type !== unknownType) return type } function getJsxElementTypeAt(location) { return getJsxType(JsxNames.Element, location) } function getJsxStatelessElementTypeAt(location) { var jsxElementType = getJsxElementTypeAt(location); if (jsxElementType) return getUnionType([jsxElementType, nullType]) } function getJsxIntrinsicTagNamesAt(location) { var intrinsics = getJsxType(JsxNames.IntrinsicElements, location); return intrinsics ? getPropertiesOfType(intrinsics) : ts.emptyArray } function checkJsxPreconditions(errorNode) { 0 === (compilerOptions.jsx || 0) && error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided), void 0 === getJsxElementTypeAt(errorNode) && noImplicitAny && error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist) } function checkJsxOpeningLikeElementOrOpeningFragment(node, checkMode) { var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(node); isNodeOpeningLikeElement && checkGrammarJsxElement(node), checkJsxPreconditions(node); var reactRefErr = diagnostics && 2 === compilerOptions.jsx ? ts.Diagnostics.Cannot_find_name_0 : void 0, reactNamespace = getJsxNamespace(node), reactLocation = isNodeOpeningLikeElement ? node.tagName : node, reactSym = resolveName(reactLocation, reactNamespace, 67216319, reactRefErr, reactNamespace, !0); reactSym && (reactSym.isReferenced = 67108863, 2097152 & reactSym.flags && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym)) && markAliasSymbolAsReferenced(reactSym)), isNodeOpeningLikeElement ? checkJsxAttributesAssignableToTagNameAttributes(node, checkMode) : checkJsxChildren(node.parent) } function isKnownProperty(targetType, name, isComparingJsxAttributes) { if (65536 & targetType.flags) { var resolved = resolveStructuredTypeMembers(targetType); if (resolved.stringIndexInfo || resolved.numberIndexInfo && isNumericLiteralName(name) || getPropertyOfObjectType(targetType, name) || isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) return !0 } else if (393216 & targetType.flags) for (var _i = 0, _a = targetType.types; _i < _a.length; _i++) { var t = _a[_i]; if (isKnownProperty(t, name, isComparingJsxAttributes)) return !0 } return !1 } function checkJsxAttributesAssignableToTagNameAttributes(openingLikeElement, checkMode) { var targetAttributesType = isJsxIntrinsicIdentifier(openingLikeElement.tagName) ? getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : getCustomJsxElementAttributesType(openingLikeElement, !1), sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode), isSourceAttributeTypeAssignableToTarget = isTypeAssignableTo(sourceAttributesType, targetAttributesType); if (!isSourceAttributeTypeAssignableToTarget || isTypeAny(sourceAttributesType) || isTypeAny(targetAttributesType)) { if (!isSourceAttributeTypeAssignableToTarget) { if (ts.length(openingLikeElement.attributes.properties)) { for (var reportedError = !1, _loop_7 = function (prop) { if (ts.isJsxSpreadAttribute(prop)) return "continue"; var name = ts.idText(prop.name), sourcePropType = getIndexedAccessType(sourceAttributesType, getLiteralType(name)), targetPropType = getIndexedAccessType(targetAttributesType, getLiteralType(name)), rootChain = function () { return ts.chainDiagnosticMessages(void 0, ts.Diagnostics.Types_of_property_0_are_incompatible, name) }; checkTypeAssignableTo(sourcePropType, targetPropType, prop, void 0, rootChain) || (reportedError = !0) }, _b = 0, _c = openingLikeElement.attributes.properties; _b < _c.length; _b++) { var prop = _c[_b]; _loop_7(prop) } if (reportedError) return } checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.tagName) } } else for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { var attribute = _a[_i]; if (ts.isJsxAttribute(attribute)) { var attrName = attribute.name, isNotIgnoredJsxProperty = isUnhyphenatedJsxName(ts.idText(attrName)) || !!getPropertyOfType(targetAttributesType, attrName.escapedText); if (isNotIgnoredJsxProperty && !isKnownProperty(targetAttributesType, attrName.escapedText, !0)) { error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(attrName), typeToString(targetAttributesType)); break } } } } function checkJsxExpression(node, checkMode) { if (node.expression) { var type = checkExpression(node.expression, checkMode); return node.dotDotDotToken && type !== anyType && !isArrayType(type) && error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type), type } return unknownType } function getDeclarationKindFromSymbol(s) { return s.valueDeclaration ? s.valueDeclaration.kind : 151 } function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0 } function isPrototypeProperty(symbol) { if (8192 & symbol.flags || 4 & ts.getCheckFlags(symbol)) return !0; if (ts.isInJavaScriptFile(symbol.valueDeclaration)) { var parent = symbol.valueDeclaration.parent; return parent && ts.isBinaryExpression(parent) && 3 === ts.getSpecialPropertyAssignmentKind(parent) } } function checkPropertyAccessibility(node, left, type, prop) { var flags = ts.getDeclarationModifierFlagsFromSymbol(prop), errorNode = 184 === node.kind || 231 === node.kind ? node.name : 178 === node.kind ? node : node.right; if (256 & ts.getCheckFlags(prop)) return error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)), !1; if (97 === left.kind) { if (languageVersion < 2 && symbolHasNonMethodDeclaration(prop)) return error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword), !1; if (128 & flags) return error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))), !1 } if (128 & flags && ts.isThisProperty(node) && symbolHasNonMethodDeclaration(prop)) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeWithinConstructorOfClass(node, declaringClassDeclaration)) return error(errorNode, ts.Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), ts.getTextOfIdentifierOrLiteral(declaringClassDeclaration.name)), !1 } if (!(24 & flags)) return !0; if (8 & flags) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); return !!isNodeWithinClass(node, declaringClassDeclaration) || (error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop))), !1) } if (97 === left.kind) return !0; var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); return isClassDerivedFromDeclaringClasses(enclosingClass, prop) ? enclosingClass : void 0 }); return enclosingClass ? !!(32 & flags) || (32768 & type.flags && (type = type.isThisType ? getConstraintOfTypeParameter(type) : getBaseConstraintOfType(type)), !(!type || !hasBaseType(type, enclosingClass)) || (error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)), !1)) : (error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || type)), !1) } function symbolHasNonMethodDeclaration(symbol) { return forEachProperty(symbol, function (prop) { var propKind = getDeclarationKindFromSymbol(prop); return 153 !== propKind && 152 !== propKind }) } function checkNonNullExpression(node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) { return checkNonNullType(checkExpression(node), node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) } function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) { var kind = 12288 & (strictNullChecks ? getFalsyFlags(type) : type.flags); if (kind) { error(node, 4096 & kind ? 8192 & kind ? nullOrUndefinedDiagnostic || ts.Diagnostics.Object_is_possibly_null_or_undefined : undefinedDiagnostic || ts.Diagnostics.Object_is_possibly_undefined : nullDiagnostic || ts.Diagnostics.Object_is_possibly_null); var t = getNonNullableType(type); return 28672 & t.flags ? unknownType : t } return type } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name) } function checkQualifiedName(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right) } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { var propType, leftType = checkNonNullExpression(left), parentSymbol = getNodeLinks(left).resolvedSymbol, apparentType = getApparentType(getWidenedType(leftType)); if (isTypeAny(apparentType) || apparentType === silentNeverType) return ts.isIdentifier(left) && parentSymbol && markAliasReferenced(parentSymbol, node), apparentType; var assignmentKind = ts.getAssignmentTargetKind(node), prop = getPropertyOfType(apparentType, right.escapedText); if (!ts.isIdentifier(left) || !parentSymbol || prop && isConstEnumOrConstEnumOnlyModule(prop) || markAliasReferenced(parentSymbol, node), prop) { if (checkPropertyNotUsedBeforeDeclaration(prop, node, right), markPropertyAsReferenced(prop, node, 99 === left.kind), getNodeLinks(node).resolvedSymbol = prop, checkPropertyAccessibility(node, left, apparentType, prop), assignmentKind && (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node))) return error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, ts.idText(right)), unknownType; propType = getConstraintForLocation(getTypeOfSymbol(prop), node) } else { var indexInfo = getIndexInfoOfType(apparentType, 0); if (!indexInfo || !indexInfo.type) return right.escapedText && !checkAndReportErrorForExtendingInterface(node) && reportNonexistentProperty(right, 32768 & leftType.flags && leftType.isThisType ? apparentType : leftType), unknownType; indexInfo.isReadonly && (ts.isAssignmentTarget(node) || ts.isDeleteTarget(node)) && error(node, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType)), propType = indexInfo.type } if (184 !== node.kind || 1 === assignmentKind || prop && !(98311 & prop.flags) && !(8192 & prop.flags && 131072 & propType.flags)) return propType; var assumeUninitialized = !1; if (strictNullChecks && strictPropertyInitialization && 99 === left.kind) { var declaration = prop && prop.valueDeclaration; if (declaration && isInstancePropertyWithoutInitializer(declaration)) { var flowContainer = getControlFlowContainer(node); 154 === flowContainer.kind && flowContainer.parent === declaration.parent && (assumeUninitialized = !0) } } var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType); return assumeUninitialized && !(4096 & getFalsyFlags(propType)) && 4096 & getFalsyFlags(flowType) ? (error(right, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)), propType) : assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType } function checkPropertyNotUsedBeforeDeclaration(prop, node, right) { var valueDeclaration = prop.valueDeclaration; valueDeclaration && (!isInPropertyInitializer(node) || isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) || isPropertyDeclaredInAncestorClass(prop) ? 234 !== valueDeclaration.kind || 161 === node.parent.kind || 4194304 & valueDeclaration.flags || isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) || error(right, ts.Diagnostics.Class_0_used_before_its_declaration, ts.idText(right)) : error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.idText(right))) } function isInPropertyInitializer(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { case 151: return !0; case 269: return !1; default: return !ts.isExpressionNode(node) && "quit" } }) } function isPropertyDeclaredInAncestorClass(prop) { if (!(32 & prop.parent.flags)) return !1; for (var classType = getTypeOfSymbol(prop.parent); ;) { if (classType = classType.symbol && getSuperClass(classType), !classType) return !1; var superProperty = getPropertyOfType(classType, prop.escapedName); if (superProperty && superProperty.valueDeclaration) return !0 } } function getSuperClass(classType) { var x = getBaseTypes(classType); if (0 !== x.length) return getIntersectionType(x) } function reportNonexistentProperty(propNode, containingType) { var errorInfo; if (131072 & containingType.flags && !(16382 & containingType.flags)) for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) { var subtype = _a[_i]; if (!getPropertyOfType(subtype, propNode.escapedText)) { errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype)); break } } var promisedType = getPromisedTypeOfPromise(containingType); if (promisedType && getPropertyOfType(promisedType, propNode.escapedText)) errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await, ts.declarationNameToString(propNode), typeToString(containingType)); else { var suggestion = getSuggestionForNonexistentProperty(propNode, containingType); errorInfo = void 0 !== suggestion ? ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, ts.declarationNameToString(propNode), typeToString(containingType), suggestion) : ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType)) } diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo)) } function getSuggestionForNonexistentProperty(node, containingType) { var suggestion = getSpellingSuggestionForName(ts.idText(node), getPropertiesOfType(containingType), 67216319); return suggestion && ts.symbolName(suggestion) } function getSuggestionForNonexistentSymbol(location, outerName, meaning) { ts.Debug.assert(void 0 !== outerName, "outername should always be defined"); var result = resolveNameHelper(location, outerName, meaning, void 0, outerName, !1, !1, function (symbols, name, meaning) { ts.Debug.assertEqual(outerName, name, "name should equal outerName"); var symbol = getSymbol(symbols, name, meaning); return symbol || getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), ts.arrayFrom(symbols.values()), meaning) }); return result && ts.symbolName(result) } function getSuggestionForNonexistentModule(name, targetModule) { var suggestion = targetModule.exports && getSpellingSuggestionForName(ts.idText(name), getExportsOfModuleAsArray(targetModule), 2623475); return suggestion && ts.symbolName(suggestion) } function getSpellingSuggestionForName(name, symbols, meaning) { for (var bestCandidate, maximumLengthDifference = Math.min(2, Math.floor(.34 * name.length)), bestDistance = Math.floor(.4 * name.length) + 1, justCheckExactMatches = !1, nameLowerCase = name.toLowerCase(), _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { var candidate = symbols_3[_i], candidateName = ts.symbolName(candidate); if (34 !== candidateName.charCodeAt(0) && candidate.flags & meaning && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference) { var candidateNameLowerCase = candidateName.toLowerCase(); if (candidateNameLowerCase === nameLowerCase) return candidate; if (!(justCheckExactMatches || candidateName.length < 3)) { var distance = levenshteinWithMax(nameLowerCase, candidateNameLowerCase, bestDistance - 1); void 0 !== distance && (distance < 3 ? (justCheckExactMatches = !0, bestCandidate = candidate) : (ts.Debug.assert(distance < bestDistance), bestDistance = distance, bestCandidate = candidate)) } } } return bestCandidate } function levenshteinWithMax(s1, s2, max) { for (var previous = new Array(s2.length + 1), current = new Array(s2.length + 1), big = max + 1, i = 0; i <= s2.length; i++)previous[i] = i; for (var i = 1; i <= s1.length; i++) { var c1 = s1.charCodeAt(i - 1), minJ = i > max ? i - max : 1, maxJ = s2.length > max + i ? max + i : s2.length; current[0] = i; for (var colMin = i, j = 1; j < minJ; j++)current[j] = big; for (var j = minJ; j <= maxJ; j++) { var dist = c1 === s2.charCodeAt(j - 1) ? previous[j - 1] : Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + 2); current[j] = dist, colMin = Math.min(colMin, dist) } for (var j = maxJ + 1; j <= s2.length; j++)current[j] = big; if (colMin > max) return; var temp = previous; previous = current, current = temp } var res = previous[s2.length]; return res > max ? void 0 : res } function markPropertyAsReferenced(prop, nodeForCheckWriteOnly, isThisAccess) { if (prop && 106500 & prop.flags && prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 8) && (!nodeForCheckWriteOnly || !ts.isWriteOnlyAccess(nodeForCheckWriteOnly) || 65536 & prop.flags && !(32768 & prop.flags))) { if (isThisAccess) { var containingMethod = ts.findAncestor(nodeForCheckWriteOnly, ts.isFunctionLikeDeclaration); if (containingMethod && containingMethod.symbol === prop) return } (1 & ts.getCheckFlags(prop) ? getSymbolLinks(prop).target : prop).isReferenced = 67108863 } } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { case 184: return isValidPropertyAccessWithType(node, node.expression, propertyName, getWidenedType(checkExpression(node.expression))); case 145: return isValidPropertyAccessWithType(node, node.left, propertyName, getWidenedType(checkExpression(node.left))); case 178: return isValidPropertyAccessWithType(node, node, propertyName, getTypeFromTypeNode(node)) } } function isValidPropertyAccessForCompletions(node, type, property) { return isValidPropertyAccessWithType(node, 178 === node.kind ? node : node.expression, property.escapedName, type) && (!(8192 & property.flags) || isValidMethodAccess(property, type)) } function isValidMethodAccess(method, actualThisType) { var propType = getTypeOfFuncClassEnumModule(method), signatures = getSignaturesOfType(getNonNullableType(propType), 0); return ts.Debug.assert(0 !== signatures.length), signatures.some(function (sig) { var signatureThisType = getThisTypeOfSignature(sig); return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType)) }) } function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) { if (!sig.typeParameters) return signatureThisType; var context = createInferenceContext(sig.typeParameters, sig, 0); return inferTypes(context.inferences, actualThisType, signatureThisType), instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context))) } function isValidPropertyAccessWithType(node, left, propertyName, type) { if (type === unknownType || isTypeAny(type)) return !0; var prop = getPropertyOfType(type, propertyName); return prop ? checkPropertyAccessibility(node, left, type, prop) : ts.isInJavaScriptFile(node) && 131072 & type.flags && type.types.some(function (elementType) { return isValidPropertyAccessWithType(node, left, propertyName, elementType) }) } function getForInVariableSymbol(node) { var initializer = node.initializer; if (232 === initializer.kind) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) return getSymbolOfNode(variable) } else if (71 === initializer.kind) return getResolvedSymbol(initializer) } function hasNumericPropertyNames(type) { return getIndexTypeOfType(type, 1) && !getIndexTypeOfType(type, 0) } function isForInVariableForNumericPropertyNames(expr) { var e = ts.skipParentheses(expr); if (71 === e.kind) { var symbol = getResolvedSymbol(e); if (3 & symbol.flags) for (var child = expr, node = expr.parent; node;) { if (220 === node.kind && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) return !0; child = node, node = node.parent } } return !1 } function checkIndexedAccess(node) { var objectType = checkNonNullExpression(node.expression), indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); if (187 === node.parent.kind && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end), end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead) } else { var start = node.end - "]".length, end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected) } return unknownType } var indexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : checkExpression(indexExpression); return objectType === unknownType || objectType === silentNeverType ? objectType : isConstEnumObjectType(objectType) && 9 !== indexExpression.kind ? (error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal), unknownType) : checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node) } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) return !1; if (!ts.isWellKnownSymbolSyntactically(expression)) return !1; if (0 === (1536 & expressionType.flags)) return reportError && error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)), !1; var leftHandSide = expression.expression, leftHandSideSymbol = getResolvedSymbol(leftHandSide); if (!leftHandSideSymbol) return !1; var globalESSymbol = getGlobalESSymbolConstructorSymbol(!0); return !!globalESSymbol && (leftHandSideSymbol === globalESSymbol || (reportError && error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object), !1)) } function callLikeExpressionMayHaveTypeArguments(node) { return ts.isCallOrNewExpression(node) } function resolveUntypedCall(node) { return callLikeExpressionMayHaveTypeArguments(node) && ts.forEach(node.typeArguments, checkSourceElement), 188 === node.kind ? checkExpression(node.template) : 149 !== node.kind && ts.forEach(node.arguments, function (argument) { checkExpression(argument) }), anySignature } function resolveErrorCall(node) { return resolveUntypedCall(node), unknownSignature } function reorderCandidates(signatures, result) { var lastParent, lastSymbol, index, spliceIndex, cutoffIndex = 0, specializedIndex = -1; ts.Debug.assert(!result.length); for (var _i = 0, signatures_4 = signatures; _i < signatures_4.length; _i++) { var signature = signatures_4[_i], symbol = signature.declaration && getSymbolOfNode(signature.declaration), parent = signature.declaration && signature.declaration.parent; lastSymbol && symbol !== lastSymbol ? (index = cutoffIndex = result.length, lastParent = parent) : lastParent && parent === lastParent ? index++ : (lastParent = parent, index = cutoffIndex), lastSymbol = symbol, signature.hasLiteralTypes ? (specializedIndex++ , spliceIndex = specializedIndex, cutoffIndex++) : spliceIndex = index, result.splice(spliceIndex, 0, signature) } } function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; if (arg && 203 === arg.kind) return i } return -1 } function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) { void 0 === signatureHelpTrailingComma && (signatureHelpTrailingComma = !1); var argCount, typeArguments, callIsIncomplete, spreadArgIndex = -1; if (ts.isJsxOpeningLikeElement(node)) return !0; if (188 === node.kind) if (argCount = args.length, typeArguments = node.typeArguments, 201 === node.template.kind) { var lastSpan = ts.lastOrUndefined(node.template.templateSpans); ts.Debug.assert(void 0 !== lastSpan), callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated } else { var templateLiteral = node.template; ts.Debug.assert(13 === templateLiteral.kind), callIsIncomplete = !!templateLiteral.isUnterminated } else if (149 === node.kind) typeArguments = void 0, argCount = getEffectiveArgumentCount(node, void 0, signature); else { if (!node.arguments) return ts.Debug.assert(187 === node.kind), 0 === signature.minArgumentCount; argCount = signatureHelpTrailingComma ? args.length + 1 : args.length, callIsIncomplete = node.arguments.end === node.end, typeArguments = node.typeArguments, spreadArgIndex = getSpreadArgumentIndex(args) } if (!hasCorrectTypeArgumentArity(signature, typeArguments)) return !1; if (spreadArgIndex >= 0) return isRestParameterIndex(signature, spreadArgIndex) || signature.minArgumentCount <= spreadArgIndex && spreadArgIndex < signature.parameters.length; if (!signature.hasRestParameter && argCount > signature.parameters.length) return !1; var hasEnoughArguments = argCount >= signature.minArgumentCount; return callIsIncomplete || hasEnoughArguments } function hasCorrectTypeArgumentArity(signature, typeArguments) { var numTypeParameters = ts.length(signature.typeParameters), minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); return !typeArguments || typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters } function getSingleCallSignature(type) { if (65536 & type.flags) { var resolved = resolveStructuredTypeMembers(type); if (1 === resolved.callSignatures.length && 0 === resolved.constructSignatures.length && 0 === resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) return resolved.callSignatures[0] } } function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper, compareTypes) { var context = createInferenceContext(signature.typeParameters, signature, 1, compareTypes); return forEachMatchingParameterType(contextualSignature, signature, function (source, target) { inferTypes(context.inferences, instantiateType(source, contextualMapper || identityMapper), target) }), contextualMapper || inferTypes(context.inferences, getReturnTypeOfSignature(contextualSignature), getReturnTypeOfSignature(signature), 8), getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJavaScriptFile(contextualSignature.declaration)) } function inferJsxTypeArguments(signature, node, context) { var skipContextParamType = getTypeAtPosition(signature, 0), checkAttrTypeSkipContextSensitive = checkExpressionWithContextualType(node.attributes, skipContextParamType, identityMapper); inferTypes(context.inferences, checkAttrTypeSkipContextSensitive, skipContextParamType); var paramType = getTypeAtPosition(signature, 0), checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context); return inferTypes(context.inferences, checkAttrType, paramType), getInferredTypes(context) } function inferTypeArguments(node, signature, args, excludeArgument, context) { for (var _i = 0, _a = context.inferences; _i < _a.length; _i++) { var inference = _a[_i]; inference.isFixed || (inference.inferredType = void 0) } if (149 !== node.kind) { var contextualType = getContextualType(node); if (contextualType) { var instantiatedType = instantiateType(contextualType, cloneTypeMapper(getContextualMapper(node))), contextualSignature = getSingleCallSignature(instantiatedType), inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiation(contextualSignature, contextualSignature.typeParameters, ts.isInJavaScriptFile(node))) : instantiatedType, inferenceTargetType = getReturnTypeOfSignature(signature); inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8) } } var thisType = getThisTypeOfSignature(signature); if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node), thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; inferTypes(context.inferences, thisArgumentType, thisType) } for (var argCount = getEffectiveArgumentCount(node, args, signature), i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); if (void 0 === arg || 205 !== arg.kind) { var paramType = getTypeAtPosition(signature, i), argType = getEffectiveArgumentType(node, i); if (void 0 === argType) { var mapper = excludeArgument && void 0 !== excludeArgument[i] ? identityMapper : context; argType = checkExpressionWithContextualType(arg, paramType, mapper) } inferTypes(context.inferences, argType, paramType) } } if (excludeArgument) for (var i = 0; i < argCount; i++)if (excludeArgument[i] === !1) { var arg = args[i], paramType = getTypeAtPosition(signature, i); inferTypes(context.inferences, checkExpressionWithContextualType(arg, paramType, context), paramType) } return getInferredTypes(context) } function checkTypeArguments(signature, typeArgumentNodes, reportErrors, headMessage) { for (var mapper, isJavascript = ts.isInJavaScriptFile(signature.declaration), typeParameters = signature.typeParameters, typeArgumentTypes = fillMissingTypeArguments(ts.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), isJavascript), i = 0; i < typeArgumentNodes.length; i++) { ts.Debug.assert(void 0 !== typeParameters[i], "Should not call checkTypeArguments with too many type arguments"); var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { var errorInfo = reportErrors && headMessage && function () { return ts.chainDiagnosticMessages(void 0, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1) }, typeArgumentHeadMessage = headMessage || ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1; mapper || (mapper = createTypeMapper(typeParameters, typeArgumentTypes)); var typeArgument = typeArgumentTypes[i]; if (!checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : void 0, typeArgumentHeadMessage, errorInfo)) return !1 } } return typeArgumentTypes } function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation) { var callIsIncomplete = node.attributes.end === node.end; if (callIsIncomplete) return !0; for (var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, paramType = getTypeAtPosition(signature, 0), attributesType = checkExpressionWithContextualType(node.attributes, paramType, void 0), argProperties = getPropertiesOfType(attributesType), _i = 0, argProperties_1 = argProperties; _i < argProperties_1.length; _i++) { var arg = argProperties_1[_i]; if (!getPropertyOfType(paramType, arg.escapedName) && isUnhyphenatedJsxName(arg.escapedName)) return !1 } return checkTypeRelatedTo(attributesType, paramType, relation, void 0, headMessage) } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { if (ts.isJsxOpeningLikeElement(node)) return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); var thisType = getThisTypeOfSignature(signature); if (thisType && thisType !== voidType && 187 !== node.kind) { var thisArgumentNode = getThisArgumentOfCall(node), thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType, errorNode = reportErrors ? thisArgumentNode || node : void 0, headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; if (!checkTypeRelatedTo(thisArgumentType, getThisTypeOfSignature(signature), relation, errorNode, headMessage_1)) return !1 } for (var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, argCount = getEffectiveArgumentCount(node, args, signature), i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); if (void 0 === arg || 205 !== arg.kind) { var paramType = getTypeAtPosition(signature, i), argType = getEffectiveArgumentType(node, i) || checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : void 0), checkArgType = excludeArgument ? getRegularTypeOfObjectLiteral(argType) : argType, errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : void 0; if (!checkTypeRelatedTo(checkArgType, paramType, relation, errorNode, headMessage)) return !1 } } return !0 } function getThisArgumentOfCall(node) { if (186 === node.kind) { var callee = ts.skipOuterExpressions(node.expression); if (184 === callee.kind || 185 === callee.kind) return callee.expression } } function getEffectiveCallArguments(node) { if (188 === node.kind) { var template = node.template, args_4 = [void 0]; return 201 === template.kind && ts.forEach(template.templateSpans, function (span) { args_4.push(span.expression) }), args_4 } return 149 === node.kind ? void 0 : ts.isJsxOpeningLikeElement(node) ? node.attributes.properties.length > 0 ? [node.attributes] : ts.emptyArray : node.arguments || ts.emptyArray } function getEffectiveArgumentCount(node, args, signature) { if (149 !== node.kind) return args.length; switch (node.parent.kind) { case 234: case 204: return 1; case 151: return 2; case 153: case 155: case 156: return 0 === languageVersion ? 2 : signature.parameters.length >= 3 ? 3 : 2; case 148: return 3 } } function getEffectiveDecoratorFirstArgumentType(node) { if (234 === node.kind) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol) } if (148 === node.kind && (node = node.parent, 154 === node.kind)) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol) } return 151 === node.kind || 153 === node.kind || 155 === node.kind || 156 === node.kind ? getParentTypeOfClassElement(node) : (ts.Debug.fail("Unsupported decorator target."), unknownType) } function getEffectiveDecoratorSecondArgumentType(node) { if (234 === node.kind) return ts.Debug.fail("Class decorators should not have a second synthetic argument."), unknownType; if (148 === node.kind && (node = node.parent, 154 === node.kind)) return anyType; if (151 === node.kind || 153 === node.kind || 155 === node.kind || 156 === node.kind) { var element = node; switch (element.name.kind) { case 71: return getLiteralType(ts.idText(element.name)); case 8: case 9: return getLiteralType(element.name.text); case 146: var nameType = checkComputedPropertyName(element.name); return isTypeAssignableToKind(nameType, 1536) ? nameType : stringType; default: return ts.Debug.fail("Unsupported property name."), unknownType } } return ts.Debug.fail("Unsupported decorator target."), unknownType } function getEffectiveDecoratorThirdArgumentType(node) { if (234 === node.kind) return ts.Debug.fail("Class decorators should not have a third synthetic argument."), unknownType; if (148 === node.kind) return numberType; if (151 === node.kind) return ts.Debug.fail("Property decorators should not have a third synthetic argument."), unknownType; if (153 === node.kind || 155 === node.kind || 156 === node.kind) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType) } return ts.Debug.fail("Unsupported decorator target."), unknownType } function getEffectiveDecoratorArgumentType(node, argIndex) { return 0 === argIndex ? getEffectiveDecoratorFirstArgumentType(node.parent) : 1 === argIndex ? getEffectiveDecoratorSecondArgumentType(node.parent) : 2 === argIndex ? getEffectiveDecoratorThirdArgumentType(node.parent) : (ts.Debug.fail("Decorators should not have a fourth synthetic argument."), unknownType) } function getEffectiveArgumentType(node, argIndex) { return 149 === node.kind ? getEffectiveDecoratorArgumentType(node, argIndex) : 0 === argIndex && 188 === node.kind ? getGlobalTemplateStringsArrayType() : void 0 } function getEffectiveArgument(node, args, argIndex) { if (149 !== node.kind && (0 !== argIndex || 188 !== node.kind)) return args[argIndex] } function getEffectiveArgumentErrorNode(node, argIndex, arg) { return 149 === node.kind ? node.expression : 0 === argIndex && 188 === node.kind ? node.template : arg } function getTypeArgumentArityError(node, signatures, typeArguments) { for (var min = 1 / 0, max = -(1 / 0), _i = 0, signatures_5 = signatures; _i < signatures_5.length; _i++) { var sig = signatures_5[_i]; min = Math.min(min, getMinTypeArgumentCount(sig.typeParameters)), max = Math.max(max, ts.length(sig.typeParameters)) } var paramCount = min === max ? min : min + "-" + max; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length) } function resolveCall(node, signatures, candidatesOutArray, fallbackError) { function chooseOverload(candidates, relation, signatureHelpTrailingComma) { if (void 0 === signatureHelpTrailingComma && (signatureHelpTrailingComma = !1), candidateForArgumentError = void 0, candidateForTypeArgumentError = void 0, isSingleNonGenericCandidate) { var candidate = candidates[0]; if (!hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) return; return checkApplicableSignature(node, args, candidate, relation, excludeArgument, !1) ? candidate : void (candidateForArgumentError = candidate) } for (var candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) { var originalCandidate = candidates[candidateIndex]; if (hasCorrectArity(node, args, originalCandidate, signatureHelpTrailingComma)) for (var candidate = void 0, inferenceContext = originalCandidate.typeParameters ? createInferenceContext(originalCandidate.typeParameters, originalCandidate, ts.isInJavaScriptFile(node) ? 4 : 0) : void 0; ;) { if (candidate = originalCandidate, candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { var typeArgumentResult = checkTypeArguments(candidate, typeArguments, !1); if (!typeArgumentResult) { candidateForTypeArgumentError = originalCandidate; break } typeArgumentTypes = typeArgumentResult } else typeArgumentTypes = inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); var isJavascript = ts.isInJavaScriptFile(candidate.declaration); candidate = getSignatureInstantiation(candidate, typeArgumentTypes, isJavascript) } if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, !1)) { candidateForArgumentError = candidate; break } if (0 === excludeCount) return candidates[candidateIndex] = candidate, candidate; excludeCount-- , excludeCount > 0 ? excludeArgument[excludeArgument.indexOf(!0)] = !1 : excludeArgument = void 0 } } } var typeArguments, isTaggedTemplate = 188 === node.kind, isDecorator = 149 === node.kind, isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); isDecorator || (typeArguments = node.typeArguments, (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || 97 !== node.expression.kind) && ts.forEach(typeArguments, checkSourceElement)); var candidates = candidatesOutArray || []; if (reorderCandidates(signatures, candidates), !candidates.length) return diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Call_target_does_not_contain_any_signatures)), resolveErrorCall(node); var excludeArgument, args = getEffectiveCallArguments(node), isSingleNonGenericCandidate = 1 === candidates.length && !candidates[0].typeParameters, excludeCount = 0; if (!isDecorator && !isSingleNonGenericCandidate) for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++)isContextSensitive(args[i]) && (excludeArgument || (excludeArgument = new Array(args.length)), excludeArgument[i] = !0, excludeCount++); var candidateForArgumentError, candidateForTypeArgumentError, result, signatureHelpTrailingComma = candidatesOutArray && 186 === node.kind && node.arguments.hasTrailingComma; if (candidates.length > 1 && (result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma)), result || (result = chooseOverload(candidates, assignableRelation, signatureHelpTrailingComma)), result) return result; if (candidateForArgumentError) { if (isJsxOpeningOrSelfClosingElement) return candidateForArgumentError; checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, void 0, !0) } else if (candidateForTypeArgumentError) checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, !0, fallbackError); else if (typeArguments && ts.every(signatures, function (sig) { return ts.length(sig.typeParameters) !== typeArguments.length })) diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments)); else if (args) { for (var min_1 = Number.POSITIVE_INFINITY, max = Number.NEGATIVE_INFINITY, _i = 0, signatures_6 = signatures; _i < signatures_6.length; _i++) { var sig = signatures_6[_i]; min_1 = Math.min(min_1, sig.minArgumentCount), max = Math.max(max, sig.parameters.length) } var hasRestParameter_1 = ts.some(signatures, function (sig) { return sig.hasRestParameter }), hasSpreadArgument = getSpreadArgumentIndex(args) > -1, paramCount = hasRestParameter_1 ? min_1 : min_1 < max ? min_1 + "-" + max : min_1, argCount = args.length; argCount <= max && hasSpreadArgument && argCount--; var error_1 = hasRestParameter_1 && hasSpreadArgument ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more : hasRestParameter_1 ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1 : hasSpreadArgument ? ts.Diagnostics.Expected_0_arguments_but_got_1_or_more : ts.Diagnostics.Expected_0_arguments_but_got_1; diagnostics.add(ts.createDiagnosticForNode(node, error_1, paramCount, argCount)) } else fallbackError && diagnostics.add(ts.createDiagnosticForNode(node, fallbackError)); if (!produceDiagnostics) { ts.Debug.assert(candidates.length > 0); var bestIndex = getLongestCandidateIndex(candidates, void 0 === apparentArgumentCount ? args.length : apparentArgumentCount), candidate = candidates[bestIndex], typeParameters = candidate.typeParameters; if (typeParameters && callLikeExpressionMayHaveTypeArguments(node) && node.typeArguments) { for (var typeArguments_1 = node.typeArguments.map(getTypeOfNode); typeArguments_1.length > typeParameters.length;)typeArguments_1.pop(); for (; typeArguments_1.length < typeParameters.length;)typeArguments_1.push(getDefaultTypeArgumentType(ts.isInJavaScriptFile(node))); var instantiated = createSignatureInstantiation(candidate, typeArguments_1); return candidates[bestIndex] = instantiated, instantiated } return candidate } return resolveErrorCall(node) } function getLongestCandidateIndex(candidates, argsCount) { for (var maxParamsIndex = -1, maxParams = -1, i = 0; i < candidates.length; i++) { var candidate = candidates[i]; if (candidate.hasRestParameter || candidate.parameters.length >= argsCount) return i; candidate.parameters.length > maxParams && (maxParams = candidate.parameters.length, maxParamsIndex = i) } return maxParamsIndex } function resolveCallExpression(node, candidatesOutArray) { if (97 === node.expression.kind) { var superType = checkSuperExpression(node.expression); if (isTypeAny(superType)) return ts.forEach(node.arguments, checkExpresionNoReturn), anySignature; if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); if (baseTypeNode) { var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode); return resolveCall(node, baseConstructors, candidatesOutArray) } } return resolveUntypedCall(node) } var funcType = checkNonNullExpression(node.expression, ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null, ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined, ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined); if (funcType === silentNeverType) return silentNeverSignature; var apparentType = getApparentType(funcType); if (apparentType === unknownType) return resolveErrorCall(node); var callSignatures = getSignaturesOfType(apparentType, 0), constructSignatures = getSignaturesOfType(apparentType, 1); return isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length) ? (funcType !== unknownType && node.typeArguments && error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments), resolveUntypedCall(node)) : callSignatures.length ? resolveCall(node, callSignatures, candidatesOutArray) : (constructSignatures.length ? error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)) : invocationError(node, apparentType, 0), resolveErrorCall(node)) } function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) { return isTypeAny(funcType) || isTypeAny(apparentFuncType) && 32768 & funcType.flags || !numCallSignatures && !numConstructSignatures && !(147456 & apparentFuncType.flags) && isTypeAssignableTo(funcType, globalFunctionType) } function resolveNewExpression(node, candidatesOutArray) { if (node.arguments && languageVersion < 1) { var spreadIndex = getSpreadArgumentIndex(node.arguments); spreadIndex >= 0 && error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher) } var expressionType = checkNonNullExpression(node.expression); if (expressionType === silentNeverType) return silentNeverSignature; if (expressionType = getApparentType(expressionType), expressionType === unknownType) return resolveErrorCall(node); if (isTypeAny(expressionType)) return node.typeArguments && error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments), resolveUntypedCall(node); var constructSignatures = getSignaturesOfType(expressionType, 1); if (constructSignatures.length) { if (!isConstructorAccessible(node, constructSignatures[0])) return resolveErrorCall(node); var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); return valueDecl && ts.hasModifier(valueDecl, 128) ? (error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class), resolveErrorCall(node)) : resolveCall(node, constructSignatures, candidatesOutArray) } var callSignatures = getSignaturesOfType(expressionType, 0); if (callSignatures.length) { var signature = resolveCall(node, callSignatures, candidatesOutArray); return isJavaScriptConstructor(signature.declaration) || getReturnTypeOfSignature(signature) === voidType || error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword), getThisTypeOfSignature(signature) === voidType && error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void), signature } return invocationError(node, expressionType, 1), resolveErrorCall(node) } function isConstructorAccessible(node, signature) { if (!signature || !signature.declaration) return !0; var declaration = signature.declaration, modifiers = ts.getSelectedModifierFlags(declaration, 24); if (!modifiers) return !0; var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol), declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); if (!isNodeWithinClass(node, declaringClassDeclaration)) { var containingClass = ts.getContainingClass(node); if (containingClass) for (var containingType = getTypeOfNode(containingClass), baseTypes = getBaseTypes(containingType); baseTypes.length;) { var baseType = baseTypes[0]; if (16 & modifiers && baseType.symbol === declaration.parent.symbol) return !0; baseTypes = getBaseTypes(baseType) } return 8 & modifiers && error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)), 16 & modifiers && error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)), !1 } return !0 } function invocationError(node, apparentType, kind) { error(node, 0 === kind ? ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures : ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature, typeToString(apparentType)), invocationErrorRecovery(apparentType, kind) } function invocationErrorRecovery(apparentType, kind) { if (apparentType.symbol) { var importNode = getSymbolLinks(apparentType.symbol).originatingImport; if (importNode && !ts.isImportCall(importNode)) { var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind); if (!sigs || !sigs.length) return; error(importNode, ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime) } } } function resolveTaggedTemplateExpression(node, candidatesOutArray) { var tagType = checkExpression(node.tag), apparentType = getApparentType(tagType); if (apparentType === unknownType) return resolveErrorCall(node); var callSignatures = getSignaturesOfType(apparentType, 0), constructSignatures = getSignaturesOfType(apparentType, 1); return isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length) ? resolveUntypedCall(node) : callSignatures.length ? resolveCall(node, callSignatures, candidatesOutArray) : (invocationError(node, apparentType, 0), resolveErrorCall(node)) } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { case 234: case 204: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; case 151: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 153: case 155: case 156: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression } } function resolveDecorator(node, candidatesOutArray) { var funcType = checkExpression(node.expression), apparentType = getApparentType(funcType); if (apparentType === unknownType) return resolveErrorCall(node); var callSignatures = getSignaturesOfType(apparentType, 0), constructSignatures = getSignaturesOfType(apparentType, 1); if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) return resolveUntypedCall(node); if (isPotentiallyUncalledDecorator(node, callSignatures)) { var nodeStr = ts.getTextOfNode(node.expression, !1); return error(node, ts.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr), resolveErrorCall(node) } var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { var errorInfo = void 0; return errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)), errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage), diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)), invocationErrorRecovery(apparentType, 0), resolveErrorCall(node) } return resolveCall(node, callSignatures, candidatesOutArray, headMessage) } function isPotentiallyUncalledDecorator(decorator, signatures) { return signatures.length && ts.every(signatures, function (signature) { return 0 === signature.minArgumentCount && !signature.hasRestParameter && signature.parameters.length < getEffectiveArgumentCount(decorator, void 0, signature) }) } function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) { ts.Debug.assert(!(131072 & elementType.flags)); var callSignatures = elementType && getSignaturesOfType(elementType, 0); if (callSignatures && callSignatures.length > 0) return resolveCall(openingLikeElement, callSignatures, candidatesOutArray) } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { case 186: return resolveCallExpression(node, candidatesOutArray); case 187: return resolveNewExpression(node, candidatesOutArray); case 188: return resolveTaggedTemplateExpression(node, candidatesOutArray); case 149: return resolveDecorator(node, candidatesOutArray); case 256: case 255: var exprTypes = checkExpression(node.tagName); return forEachType(exprTypes, function (exprType) { var sfcResult = getResolvedJsxStatelessFunctionSignature(node, exprType, candidatesOutArray); if (sfcResult && sfcResult !== unknownSignature) return sfcResult; var sigs = getInstantiatedJsxSignatures(node, exprType); return candidatesOutArray && ts.length(sigs) && candidatesOutArray.push.apply(candidatesOutArray, sigs), ts.length(sigs) ? sigs[0] : unknownSignature }) || unknownSignature }ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.") } function getResolvedSignature(node, candidatesOutArray) { var links = getNodeLinks(node), cached = links.resolvedSignature; if (cached && cached !== resolvingSignature && !candidatesOutArray) return cached; links.resolvedSignature = resolvingSignature; var result = resolveSignature(node, candidatesOutArray); return links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached, result } function isJavaScriptConstructor(node) { if (node && ts.isInJavaScriptFile(node)) { if (ts.getJSDocClassTag(node)) return !0; var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) : ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) : void 0; return symbol && void 0 !== symbol.members } return !1 } function getJavaScriptClassType(symbol) { var initializer = ts.getDeclaredJavascriptInitializer(symbol.valueDeclaration); initializer && (symbol = getSymbolOfNode(initializer)); var inferred; isJavaScriptConstructor(symbol.valueDeclaration) && (inferred = getInferredClassType(symbol)); var assigned = getAssignedClassType(symbol), valueType = getTypeOfSymbol(symbol); return valueType.symbol && !isInferredClassType(valueType) && isJavaScriptConstructor(valueType.symbol.valueDeclaration) && (inferred = getInferredClassType(valueType.symbol)), assigned && inferred ? getIntersectionType([inferred, assigned]) : assigned || inferred } function getAssignedClassType(symbol) { var decl = symbol.valueDeclaration, assignmentSymbol = decl && decl.parent && (ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) || ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent)); if (assignmentSymbol) { var prototype = ts.forEach(assignmentSymbol.declarations, getAssignedJavascriptPrototype); if (prototype) return checkExpression(prototype) } } function getAssignedJavascriptPrototype(node) { if (!node.parent) return !1; for (var parent = node.parent; parent && 184 === parent.kind;)parent = parent.parent; if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && 58 === parent.operatorToken.kind) { var right = ts.getInitializerOfBinaryExpression(parent); return ts.isObjectLiteralExpression(right) && right } } function getInferredClassType(symbol) { var links = getSymbolLinks(symbol); return links.inferredClassType || (links.inferredClassType = createAnonymousType(symbol, getMembersOfSymbol(symbol) || emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0)), links.inferredClassType } function isInferredClassType(type) { return type.symbol && 16 & ts.getObjectFlags(type) && getSymbolLinks(type.symbol).inferredClassType === type } function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node.arguments); var signature = getResolvedSignature(node); if (97 === node.expression.kind) return voidType; if (187 === node.kind) { var declaration = signature.declaration; if (declaration && 154 !== declaration.kind && 158 !== declaration.kind && 163 !== declaration.kind && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = checkExpression(node.expression).symbol; funcSymbol || 71 !== node.expression.kind || (funcSymbol = getResolvedSymbol(node.expression)); var type = funcSymbol && getJavaScriptClassType(funcSymbol); return type ? signature.target ? instantiateType(type, signature.mapper) : type : (noImplicitAny && error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type), anyType) } } if (ts.isInJavaScriptFile(node) && isCommonJsRequire(node)) return resolveExternalModuleTypeByLiteral(node.arguments[0]); var returnType = getReturnTypeOfSignature(signature); return 1536 & returnType.flags && isSymbolOrSymbolForCall(node) ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)) : returnType } function isSymbolOrSymbolForCall(node) { if (!ts.isCallExpression(node)) return !1; var left = node.expression; if (ts.isPropertyAccessExpression(left) && "for" === left.name.escapedText && (left = left.expression), !ts.isIdentifier(left) || "Symbol" !== left.escapedText) return !1; var globalESSymbol = getGlobalESSymbolConstructorSymbol(!1); return !!globalESSymbol && globalESSymbol === resolveName(left, "Symbol", 67216319, void 0, void 0, !1) } function checkImportCallExpression(node) { if (checkGrammarArguments(node.arguments) || checkGrammarImportCallExpression(node), 0 === node.arguments.length) return createPromiseReturnType(node, anyType); for (var specifier = node.arguments[0], specifierType = checkExpressionCached(specifier), i = 1; i < node.arguments.length; ++i)checkExpressionCached(node.arguments[i]); (4096 & specifierType.flags || 8192 & specifierType.flags || !isTypeAssignableTo(specifierType, stringType)) && error(specifier, ts.Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType)); var moduleSymbol = resolveExternalModuleName(node, specifier); if (moduleSymbol) { var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, !0); if (esModuleSymbol) return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol)) } return createPromiseReturnType(node, anyType) } function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol) { if (allowSyntheticDefaultImports && type && type !== unknownType) { var synthType = type; if (!synthType.syntheticType) { var file_4 = ts.find(originalSymbol.declarations, ts.isSourceFile), hasSyntheticDefault = canHaveSyntheticDefault(file_4, originalSymbol, !1); if (hasSyntheticDefault) { var memberTable = ts.createSymbolTable(), newSymbol = createSymbol(2097152, "default"); newSymbol.target = resolveSymbol(symbol), memberTable.set("default", newSymbol); var anonymousSymbol = createSymbol(2048, "__type"), defaultContainingObject = createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, void 0, void 0); anonymousSymbol.type = defaultContainingObject, synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, 0, 0) : defaultContainingObject } else synthType.syntheticType = type } return synthType.syntheticType } return type } function isCommonJsRequire(node) { if (!ts.isRequireCall(node, !0)) return !1; if (!ts.isIdentifier(node.expression)) return ts.Debug.fail(); var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 67216319, void 0, void 0, !0); if (resolvedRequire === requireSymbol) return !0; if (2097152 & resolvedRequire.flags) return !1; var targetDeclarationKind = 16 & resolvedRequire.flags ? 233 : 3 & resolvedRequire.flags ? 231 : 0; if (0 !== targetDeclarationKind) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); return !!decl && !!(4194304 & decl.flags) } return !1 } function checkTaggedTemplateExpression(node) { return checkGrammarTypeArguments(node, node.typeArguments), languageVersion < 2 && checkExternalEmitHelpers(node, 65536), getReturnTypeOfSignature(getResolvedSignature(node)) } function checkAssertion(node) { return checkAssertionWorker(node, node.type, node.expression) } function checkAssertionWorker(errNode, type, expression, checkMode) { var exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(expression, checkMode))); checkSourceElement(type); var targetType = getTypeFromTypeNode(type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); isTypeComparableTo(targetType, widenedType) || checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1) } return targetType } function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)) } function checkMetaProperty(node) { return checkGrammarMetaProperty(node), 94 === node.keywordToken ? checkNewTargetMetaProperty(node) : 91 === node.keywordToken ? checkImportMetaProperty(node) : void 0 } function checkNewTargetMetaProperty(node) { var container = ts.getNewTargetContainer(node); if (container) { if (154 === container.kind) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol) } var symbol = getSymbolOfNode(container); return getTypeOfSymbol(symbol) } return error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"), unknownType } function checkImportMetaProperty(node) { (languageVersion < 6 || moduleKind < ts.ModuleKind.ESNext) && error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options); var file = ts.getSourceFileOfNode(node); return ts.Debug.assert(!!(1048576 & file.flags), "Containing file is missing import meta node flag."), ts.Debug.assert(!!file.externalModuleIndicator, "Containing file should be a module."), "meta" === node.name.escapedText ? getGlobalImportMetaType() : unknownType } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { var declaration = symbol.valueDeclaration; if (declaration && ts.hasInitializer(declaration)) return getOptionalType(type) } return type } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType } function getTypeOfFirstParameterOfSignature(signature) { return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType) } function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType } function inferFromAnnotatedParameters(signature, context, mapper) { for (var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0), i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { var typeNode = ts.getEffectiveTypeAnnotationNode(declaration); typeNode && inferTypes(mapper.inferences, getTypeFromTypeNode(typeNode), getTypeAtPosition(context, i)) } } } function assignContextualParameterTypes(signature, context) { if (signature.typeParameters = context.typeParameters, context.thisParameter) { var parameter = signature.thisParameter; (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) && (parameter || (signature.thisParameter = createSymbolWithType(context.thisParameter, void 0)), assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter))) } for (var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0), i = 0; i < len; i++) { var parameter = signature.parameters[i]; if (!ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) { var contextualParameterType = getTypeAtPosition(context, i); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType) } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); if (isTransientSymbol(parameter) || !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) { var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType) } } } function assignBindingElementTypes(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isOmittedExpression(element) || (71 === element.name.kind ? getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element) : assignBindingElementTypes(element.name)) } } function assignTypeToParameterAndFixTypeParameters(parameter, contextualType) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = contextualType; var decl = parameter.valueDeclaration; 71 !== decl.name.kind && (links.type === emptyObjectType && (links.type = getTypeFromBindingPattern(decl.name)), assignBindingElementTypes(decl.name)) } } function createPromiseType(promisedType) { var globalPromiseType = getGlobalPromiseType(!0); return globalPromiseType !== emptyGenericType ? (promisedType = getAwaitedType(promisedType) || emptyObjectType, createTypeReference(globalPromiseType, [promisedType])) : emptyObjectType } function createPromiseReturnType(func, promisedType) { var promiseType = createPromiseType(promisedType); return promiseType === emptyObjectType ? (error(func, ts.isImportCall(func) ? ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option), unknownType) : (getGlobalPromiseConstructorSymbol(!0) || error(func, ts.isImportCall(func) ? ts.Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option), promiseType) } function getReturnTypeFromBody(func, checkMode) { if (!func.body) return unknownType; var type, functionFlags = ts.getFunctionFlags(func); if (212 !== func.body.kind) type = checkExpressionCached(func.body, checkMode), 2 & functionFlags && (type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)); else { var types = checkAndAggregateReturnExpressionTypes(func, checkMode); if (1 & functionFlags) { if (types = ts.concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), types), !types || 0 === types.length) { var iterableIteratorAny = 2 & functionFlags ? createAsyncIterableIteratorType(anyType) : createIterableIteratorType(anyType); return noImplicitAny && error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)), iterableIteratorAny } } else { if (!types) return 2 & functionFlags ? createPromiseReturnType(func, neverType) : neverType; if (0 === types.length) return 2 & functionFlags ? createPromiseReturnType(func, voidType) : voidType } type = getUnionType(types, 2) } var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); if (contextualSignature || reportErrorsFromWidening(func, type), isUnitType(type)) { var contextualType = contextualSignature ? contextualSignature === getSignatureFromDeclaration(func) ? type : getReturnTypeOfSignature(contextualSignature) : void 0; if (contextualType) switch (3 & functionFlags) { case 3: contextualType = getIteratedTypeOfGenerator(contextualType, !0); break; case 1: contextualType = getIteratedTypeOfGenerator(contextualType, !1); break; case 2: contextualType = getPromisedTypeOfPromise(contextualType) }type = getWidenedLiteralLikeTypeForContextualType(type, contextualType) } var widenedType = getWidenedType(type); switch (3 & functionFlags) { case 3: return createAsyncIterableIteratorType(widenedType); case 1: return createIterableIteratorType(widenedType); case 2: return createPromiseType(widenedType); default: return widenedType } } function checkAndAggregateYieldOperandTypes(func, checkMode) { var aggregatedTypes = [], isAsync = 0 !== (2 & ts.getFunctionFlags(func)); return ts.forEachYieldExpression(func.body, function (yieldExpression) { ts.pushIfUnique(aggregatedTypes, getYieldedTypeOfYieldExpression(yieldExpression, isAsync, checkMode)) }), aggregatedTypes } function getYieldedTypeOfYieldExpression(node, isAsync, checkMode) { var errorNode = node.expression || node, expressionType = node.expression ? checkExpressionCached(node.expression, checkMode) : undefinedWideningType, yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(expressionType, errorNode, !1, isAsync) : expressionType; return isAsync ? getAwaitedType(yieldedType, errorNode, node.asteriskToken ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) : yieldedType } function isExhaustiveSwitchStatement(node) { if (!node.possiblyExhaustive) return !1; var type = getTypeOfExpression(node.expression); if (!isLiteralType(type)) return !1; var switchTypes = getSwitchClauseTypes(node); return !(!switchTypes.length || ts.some(switchTypes, isNeitherUnitTypeNorNever)) && eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes) } function functionHasImplicitReturn(func) { return !!(128 & func.flags) && !ts.some(func.body.statements, function (statement) { return 226 === statement.kind && isExhaustiveSwitchStatement(statement) }) } function checkAndAggregateReturnExpressionTypes(func, checkMode) { var functionFlags = ts.getFunctionFlags(func), aggregatedTypes = [], hasReturnWithNoExpression = functionHasImplicitReturn(func), hasReturnOfTypeNever = !1; if (ts.forEachReturnStatement(func.body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { var type = checkExpressionCached(expr, checkMode); 2 & functionFlags && (type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)), 16384 & type.flags && (hasReturnOfTypeNever = !0), ts.pushIfUnique(aggregatedTypes, type) } else hasReturnWithNoExpression = !0 }), 0 !== aggregatedTypes.length || hasReturnWithNoExpression || !hasReturnOfTypeNever && !mayReturnNever(func)) return !(strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) || isJavaScriptConstructor(func) && aggregatedTypes.some(function (t) { return t.symbol === func.symbol }) || ts.pushIfUnique(aggregatedTypes, undefinedType), aggregatedTypes } function mayReturnNever(func) { switch (func.kind) { case 191: case 192: return !0; case 153: return 183 === func.parent.kind; default: return !1 } } function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { if (produceDiagnostics && (!returnType || !maybeTypeOfKind(returnType, 2049)) && 152 !== func.kind && !ts.nodeIsMissing(func.body) && 212 === func.body.kind && functionHasImplicitReturn(func)) { var hasExplicitReturn = 256 & func.flags; if (returnType && 16384 & returnType.flags) error(ts.getEffectiveReturnTypeNode(func), ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); else if (returnType && !hasExplicitReturn) error(ts.getEffectiveReturnTypeNode(func), ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) error(ts.getEffectiveReturnTypeNode(func), ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); else if (compilerOptions.noImplicitReturns) { if (!returnType) { if (!hasExplicitReturn) return; var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) return } error(ts.getEffectiveReturnTypeNode(func) || func, ts.Diagnostics.Not_all_code_paths_return_a_value) } } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { if (ts.Debug.assert(153 !== node.kind || ts.isObjectLiteralMethod(node)), 1 === checkMode && isContextSensitive(node)) return anyFunctionType; var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); hasGrammarError || 191 !== node.kind || checkGrammarForGenerator(node); var links = getNodeLinks(node), type = getTypeOfSymbol(getMergedSymbol(node.symbol)); if (isTypeAny(type)) return type; if (!(1024 & links.flags)) { var contextualSignature = getContextualSignature(node); if (!(1024 & links.flags)) { if (links.flags |= 1024, contextualSignature) { var signature = getSignaturesOfType(type, 0)[0]; if (isContextSensitive(node)) { var contextualMapper = getContextualMapper(node); 2 === checkMode && inferFromAnnotatedParameters(signature, contextualSignature, contextualMapper); var instantiatedContextualSignature = contextualMapper === identityMapper ? contextualSignature : instantiateSignature(contextualSignature, contextualMapper); assignContextualParameterTypes(signature, instantiatedContextualSignature) } if (!ts.getEffectiveReturnTypeNode(node) && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, checkMode); signature.resolvedReturnType || (signature.resolvedReturnType = returnType) } } checkSignatureDeclaration(node), checkNodeDeferred(node) } } return type } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { ts.Debug.assert(153 !== node.kind || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node), returnTypeNode = ts.getEffectiveReturnTypeNode(node), returnOrPromisedType = returnTypeNode && (2 === (3 & functionFlags) ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(returnTypeNode)); if (0 === (1 & functionFlags) && checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType), node.body) if (returnTypeNode || getReturnTypeOfSignature(getSignatureFromDeclaration(node)), 212 === node.body.kind) checkSourceElement(node.body); else { var exprType = checkExpression(node.body); if (returnOrPromisedType) if (2 === (3 & functionFlags)) { var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body) } else checkTypeAssignableTo(exprType, returnOrPromisedType, node.body) } } function checkArithmeticOperandType(operand, type, diagnostic) { return !!isTypeAssignableToKind(type, 84) || (error(operand, diagnostic), !1) } function isReadonlySymbol(symbol) { return !!(8 & ts.getCheckFlags(symbol) || 4 & symbol.flags && 64 & ts.getDeclarationModifierFlagsFromSymbol(symbol) || 3 & symbol.flags && 2 & getDeclarationNodeFlagsFromSymbol(symbol) || 98304 & symbol.flags && !(65536 & symbol.flags) || 8 & symbol.flags) } function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (4 & symbol.flags && (184 === expr.kind || 185 === expr.kind) && 99 === expr.expression.kind) { var func = ts.getContainingFunction(expr); return !func || 154 !== func.kind || !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent) } return !0 } return !1 } function isReferenceThroughNamespaceImport(expr) { if (184 === expr.kind || 185 === expr.kind) { var node = ts.skipParentheses(expr.expression); if (71 === node.kind) { var symbol = getNodeLinks(node).resolvedSymbol; if (2097152 & symbol.flags) { var declaration = getDeclarationOfAliasSymbol(symbol); return declaration && 245 === declaration.kind } } } return !1 } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipOuterExpressions(expr, 3); return 71 === node.kind || 184 === node.kind || 185 === node.kind || (error(expr, invalidReferenceMessage), !1) } function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); if (184 !== expr.kind && 185 !== expr.kind) return error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference), booleanType; var links = getNodeLinks(expr), symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); return symbol && isReadonlySymbol(symbol) && error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property), booleanType } function checkTypeOfExpression(node) { return checkExpression(node.expression), typeofType } function checkVoidExpression(node) { return checkExpression(node.expression), undefinedWideningType } function checkAwaitExpression(node) { produceDiagnostics && (16384 & node.flags || grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function), isInParameterInitializerBeforeContainingFunction(node) && error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer)); var operandType = checkExpression(node.expression); return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) } function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); if (operandType === silentNeverType) return silentNeverType; if (8 === node.operand.kind) { if (38 === node.operator) return getFreshTypeOfLiteralType(getLiteralType(-node.operand.text)); if (37 === node.operator) return getFreshTypeOfLiteralType(getLiteralType(+node.operand.text)) } switch (node.operator) { case 37: case 38: case 52: return checkNonNullType(operandType, node.operand), maybeTypeOfKind(operandType, 1536) && error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)), numberType; case 51: var facts = 3145728 & getTypeFacts(operandType); return 1048576 === facts ? falseType : 2097152 === facts ? trueType : booleanType; case 43: case 44: var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); return ok && checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access), numberType }return unknownType } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); if (operandType === silentNeverType) return silentNeverType; var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); return ok && checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access), numberType } function maybeTypeOfKind(type, kind) { if (type.flags & kind || 536870912 & kind && isGenericMappedType(type)) return !0; if (393216 & type.flags) for (var types = type.types, _i = 0, types_16 = types; _i < types_16.length; _i++) { var t = types_16[_i]; if (maybeTypeOfKind(t, kind)) return !0 } return !1 } function isTypeAssignableToKind(source, kind, strict) { return !!(source.flags & kind) || !(strict && 14337 & source.flags) && (84 & kind && isTypeAssignableTo(source, numberType) || 34 & kind && isTypeAssignableTo(source, stringType) || 136 & kind && isTypeAssignableTo(source, booleanType) || 2048 & kind && isTypeAssignableTo(source, voidType) || 16384 & kind && isTypeAssignableTo(source, neverType) || 8192 & kind && isTypeAssignableTo(source, nullType) || 4096 & kind && isTypeAssignableTo(source, undefinedType) || 512 & kind && isTypeAssignableTo(source, esSymbolType) || 134217728 & kind && isTypeAssignableTo(source, nonPrimitiveType)) } function allTypesAssignableToKind(source, kind, strict) { return 131072 & source.flags ? ts.every(source.types, function (subType) { return allTypesAssignableToKind(subType, kind, strict) }) : isTypeAssignableToKind(source, kind, strict) } function isConstEnumObjectType(type) { return 16 & ts.getObjectFlags(type) && type.symbol && isConstEnumSymbol(type.symbol) } function isConstEnumSymbol(symbol) { return 0 !== (128 & symbol.flags) } function checkInstanceOfExpression(left, right, leftType, rightType) { return leftType === silentNeverType || rightType === silentNeverType ? silentNeverType : (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 16382) && error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter), isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType) || error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type), booleanType) } function checkInExpression(left, right, leftType, rightType) { return leftType === silentNeverType || rightType === silentNeverType ? silentNeverType : (leftType = checkNonNullType(leftType, left), rightType = checkNonNullType(rightType, right), isTypeComparableTo(leftType, stringType) || isTypeAssignableToKind(leftType, 1620) || error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol), isTypeAssignableToKind(rightType, 141590528) || error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter), booleanType) } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; if (checkGrammarForDisallowedTrailingComma(properties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma), strictNullChecks && 0 === properties.length) return checkNonNullType(sourceType, node); for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { var p = properties_7[_i]; checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties) } return sourceType } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { if (269 === property.kind || 270 === property.kind) { var name = property.name; if (146 === name.kind && checkComputedPropertyName(name), isComputedNonLiteralName(name)) return; var text = ts.getTextOfPropertyName(name), type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) return 270 === property.kind ? checkDestructuringAssignment(property, type) : checkDestructuringAssignment(property.initializer, type); error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)) } else { if (271 === property.kind) { languageVersion < 6 && checkExternalEmitHelpers(property, 4); var nonRestNames = []; if (allProperties) for (var i = 0; i < allProperties.length - 1; i++)nonRestNames.push(allProperties[i].name); var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); return checkDestructuringAssignment(property.expression, type) } error(property, ts.Diagnostics.Property_assignment_expected) } } function checkArrayLiteralAssignment(node, sourceType, checkMode) { var elements = node.elements; checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma), languageVersion < 2 && compilerOptions.downlevelIteration && checkExternalEmitHelpers(node, 512); for (var elementType = checkIteratedTypeOrElementType(sourceType, node, !1, !1) || unknownType, i = 0; i < elements.length; i++)checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); return sourceType } function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements, element = elements[elementIndex]; if (205 !== element.kind) if (203 !== element.kind) { var propName = "" + elementIndex, type = isTypeAny(sourceType) ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : elementType; if (type) return checkDestructuringAssignment(element, type, checkMode); checkExpression(element), isTupleType(sourceType) ? error(element, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), getTypeReferenceArity(sourceType), elements.length) : error(element, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName) } else if (elementIndex < elements.length - 1) error(element, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); else { var restExpression = element.expression; if (199 !== restExpression.kind || 58 !== restExpression.operatorToken.kind) return checkDestructuringAssignment(restExpression, createArrayType(elementType), checkMode); error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer) } } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; if (270 === exprOrAssignment.kind) { var prop = exprOrAssignment; prop.objectAssignmentInitializer && (!strictNullChecks || 4096 & getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) || (sourceType = getTypeWithFacts(sourceType, 131072)), checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode)), target = exprOrAssignment.name } else target = exprOrAssignment; return 199 === target.kind && 58 === target.operatorToken.kind && (checkBinaryExpression(target, checkMode), target = target.left), 183 === target.kind ? checkObjectLiteralAssignment(target, sourceType) : 182 === target.kind ? checkArrayLiteralAssignment(target, sourceType, checkMode) : checkReferenceAssignment(target, sourceType, checkMode) } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode), error = 271 === target.parent.kind ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; return checkReferenceExpression(target, error) && checkTypeAssignableTo(sourceType, targetType, target, void 0), sourceType } function isSideEffectFree(node) { switch (node = ts.skipParentheses(node), node.kind) { case 71: case 9: case 12: case 188: case 201: case 13: case 8: case 101: case 86: case 95: case 140: case 191: case 204: case 192: case 182: case 183: case 194: case 208: case 255: case 254: return !0; case 200: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); case 199: return !ts.isAssignmentOperator(node.operatorToken.kind) && (isSideEffectFree(node.left) && isSideEffectFree(node.right)); case 197: case 198: switch (node.operator) { case 51: case 37: case 38: case 52: return !0 }return !1; case 195: case 189: case 207: default: return !1 } } function isTypeEqualityComparableTo(source, target) { return 0 !== (12288 & target.flags) || isTypeComparableTo(source, target) } function checkBinaryExpression(node, checkMode) { return ts.isInJavaScriptFile(node) && ts.getAssignedJavascriptInitializer(node) ? checkExpression(node.right, checkMode) : checkBinaryLikeExpression(node.left, node.operatorToken, node.right, checkMode, node) } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { function checkSpecialAssignment(left, right) { var special = ts.getSpecialPropertyAssignmentKind(left.parent); if (2 === special) for (var rightType_1 = checkExpression(right, checkMode), _i = 0, _a = getPropertiesOfObjectType(rightType_1); _i < _a.length; _i++) { var prop = _a[_i], propType = getTypeOfSymbol(prop); if (propType.symbol && 32 & propType.symbol.flags) { var name = prop.escapedName, symbol = resolveName(prop.valueDeclaration, name, 67901928, void 0, name, !1); if (symbol) return grammarErrorOnNode(symbol.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name)), grammarErrorOnNode(prop.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name)) } } } function isEvalNode(node) { return 71 === node.kind && "eval" === node.escapedText } function checkForDisallowedESSymbolOperand(operator) { var offendingSymbolOperand = maybeTypeOfKind(leftType, 1536) ? left : maybeTypeOfKind(rightType, 1536) ? right : void 0; return !offendingSymbolOperand || (error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)), !1) } function getSuggestedBooleanOperator(operator) { switch (operator) { case 49: case 69: return 54; case 50: case 70: return 35; case 48: case 68: return 53; default: return } } function checkAssignmentOperator(valueType) { produceDiagnostics && ts.isAssignmentOperator(operator) && (!checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access) || ts.isIdentifier(left) && "exports" === ts.unescapeLeadingUnderscores(left.escapedText) || checkTypeAssignableTo(valueType, leftType, left, void 0)) } function reportOperatorError() { error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType)) } var operator = operatorToken.kind; if (58 === operator && (183 === left.kind || 182 === left.kind)) return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); var leftType = checkExpression(left, checkMode), rightType = checkExpression(right, checkMode); switch (operator) { case 39: case 40: case 61: case 62: case 41: case 63: case 42: case 64: case 38: case 60: case 45: case 65: case 46: case 66: case 47: case 67: case 49: case 69: case 50: case 70: case 48: case 68: if (leftType === silentNeverType || rightType === silentNeverType) return silentNeverType; leftType = checkNonNullType(leftType, left), rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; if (136 & leftType.flags && 136 & rightType.flags && void 0 !== (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind))) error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator)); else { var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type), rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); leftOk && rightOk && checkAssignmentOperator(numberType) } return numberType; case 37: case 59: if (leftType === silentNeverType || rightType === silentNeverType) return silentNeverType; isTypeAssignableToKind(leftType, 34) || isTypeAssignableToKind(rightType, 34) || (leftType = checkNonNullType(leftType, left), rightType = checkNonNullType(rightType, right)); var resultType = void 0; return isTypeAssignableToKind(leftType, 84, !0) && isTypeAssignableToKind(rightType, 84, !0) ? resultType = numberType : isTypeAssignableToKind(leftType, 34, !0) || isTypeAssignableToKind(rightType, 34, !0) ? resultType = stringType : (isTypeAny(leftType) || isTypeAny(rightType)) && (resultType = leftType === unknownType || rightType === unknownType ? unknownType : anyType), resultType && !checkForDisallowedESSymbolOperand(operator) ? resultType : resultType ? (59 === operator && checkAssignmentOperator(resultType), resultType) : (reportOperatorError(), anyType); case 27: case 29: case 30: case 31: return checkForDisallowedESSymbolOperand(operator) && (leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)), rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)), isTypeComparableTo(leftType, rightType) || isTypeComparableTo(rightType, leftType) || reportOperatorError()), booleanType; case 32: case 33: case 34: case 35: var leftIsLiteral = isLiteralType(leftType), rightIsLiteral = isLiteralType(rightType); return leftIsLiteral && rightIsLiteral || (leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType, rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType), isTypeEqualityComparableTo(leftType, rightType) || isTypeEqualityComparableTo(rightType, leftType) || reportOperatorError(), booleanType; case 93: return checkInstanceOfExpression(left, right, leftType, rightType); case 92: return checkInExpression(left, right, leftType, rightType); case 53: return 1048576 & getTypeFacts(leftType) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType; case 54: return 2097152 & getTypeFacts(leftType) ? getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2) : leftType; case 58: return checkSpecialAssignment(left, right), checkAssignmentOperator(rightType), getRegularTypeOfObjectLiteral(rightType); case 26: return compilerOptions.allowUnreachableCode || !isSideEffectFree(left) || isEvalNode(right) || error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects), rightType } } function isYieldExpressionInClass(node) { for (var current = node, parent = node.parent; parent;) { if (ts.isFunctionLike(parent) && current === parent.body) return !1; if (ts.isClassLike(current)) return !0; current = parent, parent = parent.parent } return !1 } function checkYieldExpression(node) { produceDiagnostics && (4096 & node.flags && !isYieldExpressionInClass(node) || grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body), isInParameterInitializerBeforeContainingFunction(node) && error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer)); var func = ts.getContainingFunction(node), functionFlags = func ? ts.getFunctionFlags(func) : 0; if (!(1 & functionFlags)) return anyType; node.asteriskToken && (3 === (3 & functionFlags) && languageVersion < 6 && checkExternalEmitHelpers(node, 26624), 1 === (3 & functionFlags) && languageVersion < 2 && compilerOptions.downlevelIteration && checkExternalEmitHelpers(node, 256)); var isAsync = 0 !== (2 & functionFlags), yieldedType = getYieldedTypeOfYieldExpression(node, isAsync), returnType = ts.getEffectiveReturnTypeNode(func); if (returnType) { var signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(returnType), isAsync) || anyType; checkTypeAssignableTo(yieldedType, signatureElementType, node.expression || node, void 0) } return anyType } function checkConditionalExpression(node, checkMode) { checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, checkMode), type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2) } function checkTemplateExpression(node) { return ts.forEach(node.templateSpans, function (templateSpan) { maybeTypeOfKind(checkExpression(templateSpan.expression), 1536) && error(templateSpan.expression, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1, typeToString(esSymbolType), typeToString(stringType)) }), stringType } function getContextNode(node) { return 262 === node.kind ? node.parent.parent : node } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var context = getContextNode(node), saveContextualType = context.contextualType, saveContextualMapper = context.contextualMapper; context.contextualType = contextualType, context.contextualMapper = contextualMapper; var checkMode = contextualMapper === identityMapper ? 1 : contextualMapper ? 2 : 3, result = checkExpression(node, checkMode); return context.contextualType = saveContextualType, context.contextualMapper = saveContextualMapper, result } function checkExpressionCached(node, checkMode) { var links = getNodeLinks(node); if (!links.resolvedType) { if (checkMode) return checkExpression(node, checkMode); var saveFlowLoopStart = flowLoopStart; flowLoopStart = flowLoopCount, links.resolvedType = checkExpression(node, checkMode), flowLoopStart = saveFlowLoopStart } return links.resolvedType } function isTypeAssertion(node) { return node = ts.skipParentheses(node), 189 === node.kind || 207 === node.kind } function checkDeclarationInitializer(declaration) { var inJs = ts.isInJavaScriptFile(declaration), initializer = inJs && ts.getDeclaredJavascriptInitializer(declaration) || declaration.initializer, type = getTypeOfExpression(initializer, !0), widened = 2 & ts.getCombinedNodeFlags(declaration) || 64 & ts.getCombinedModifierFlags(declaration) && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(initializer) ? type : getWidenedLiteralType(type); if (inJs) { if (12288 & widened.flags) return noImplicitAny && reportImplicitAnyError(declaration, anyType), anyType; if (isEmptyArrayLiteralType(widened)) return noImplicitAny && reportImplicitAnyError(declaration, anyArrayType), anyArrayType } return widened } function isLiteralOfContextualType(candidateType, contextualType) { if (contextualType) { if (393216 & contextualType.flags) { var types = contextualType.types; return ts.some(types, function (t) { return isLiteralOfContextualType(candidateType, t) }) } if (7372800 & contextualType.flags) { var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; return maybeTypeOfKind(constraint, 2) && maybeTypeOfKind(candidateType, 32) || maybeTypeOfKind(constraint, 4) && maybeTypeOfKind(candidateType, 64) || maybeTypeOfKind(constraint, 512) && maybeTypeOfKind(candidateType, 1024) || isLiteralOfContextualType(candidateType, constraint) } return 524320 & contextualType.flags && maybeTypeOfKind(candidateType, 32) || 64 & contextualType.flags && maybeTypeOfKind(candidateType, 64) || 128 & contextualType.flags && maybeTypeOfKind(candidateType, 128) || 1024 & contextualType.flags && maybeTypeOfKind(candidateType, 1024) } return !1 } function checkExpressionForMutableLocation(node, checkMode, contextualType) { 2 === arguments.length && (contextualType = getContextualType(node)); var type = checkExpression(node, checkMode); return isTypeAssertion(node) ? type : getWidenedLiteralLikeTypeForContextualType(type, contextualType) } function checkPropertyAssignment(node, checkMode) { return 146 === node.name.kind && checkComputedPropertyName(node.name), checkExpressionForMutableLocation(node.initializer, checkMode) } function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node), 146 === node.name.kind && checkComputedPropertyName(node.name); var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode) } function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { if (2 === checkMode) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType)); if (contextualSignature && !contextualSignature.typeParameters) return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, getContextualMapper(node))) } } } return type } function getTypeOfExpression(node, cache) { if (186 === node.kind && 97 !== node.expression.kind && !ts.isRequireCall(node, !0) && !isSymbolOrSymbolForCall(node)) { var funcType = checkNonNullExpression(node.expression), signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) return getReturnTypeOfSignature(signature) } return cache ? checkExpressionCached(node) : checkExpression(node) } function getContextFreeTypeOfExpression(node) { var saveContextualType = node.contextualType; node.contextualType = anyType; var type = getTypeOfExpression(node); return node.contextualType = saveContextualType, type } function checkExpresionNoReturn(node) { checkExpression(node) } function checkExpression(node, checkMode) { var type; if (145 === node.kind) type = checkQualifiedName(node); else { var uninstantiatedType = checkExpressionWorker(node, checkMode); type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode) } if (isConstEnumObjectType(type)) { var ok = 184 === node.parent.kind && node.parent.expression === node || 185 === node.parent.kind && node.parent.expression === node || (71 === node.kind || 145 === node.kind) && isInRightSideOfImportOrExportAssignment(node) || 164 === node.parent.kind && node.parent.exprName === node; ok || error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query) } return type } function checkParenthesizedExpression(node, checkMode) { var tag = ts.isInJavaScriptFile(node) ? ts.getJSDocTypeTag(node) : void 0; return tag ? checkAssertionWorker(tag, tag.typeExpression.type, node.expression, checkMode) : checkExpression(node.expression, checkMode) } function checkExpressionWorker(node, checkMode) { switch (node.kind) { case 71: return checkIdentifier(node); case 99: return checkThisExpression(node); case 97: return checkSuperExpression(node); case 95: return nullWideningType; case 13: case 9: return getFreshTypeOfLiteralType(getLiteralType(node.text)); case 8: return checkGrammarNumericLiteral(node), getFreshTypeOfLiteralType(getLiteralType(+node.text)); case 101: return trueType; case 86: return falseType; case 201: return checkTemplateExpression(node); case 12: return globalRegExpType; case 182: return checkArrayLiteral(node, checkMode); case 183: return checkObjectLiteral(node, checkMode); case 184: return checkPropertyAccessExpression(node); case 185: return checkIndexedAccess(node); case 186: if (91 === node.expression.kind) return checkImportCallExpression(node); case 187: return checkCallExpression(node); case 188: return checkTaggedTemplateExpression(node); case 190: return checkParenthesizedExpression(node, checkMode); case 204: return checkClassExpression(node); case 191: case 192: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); case 194: return checkTypeOfExpression(node); case 189: case 207: return checkAssertion(node); case 208: return checkNonNullAssertion(node); case 209: return checkMetaProperty(node); case 193: return checkDeleteExpression(node); case 195: return checkVoidExpression(node); case 196: return checkAwaitExpression(node); case 197: return checkPrefixUnaryExpression(node); case 198: return checkPostfixUnaryExpression(node); case 199: return checkBinaryExpression(node, checkMode); case 200: return checkConditionalExpression(node, checkMode); case 203: return checkSpreadExpression(node, checkMode); case 205: return undefinedWideningType; case 202: return checkYieldExpression(node); case 264: return checkJsxExpression(node, checkMode); case 254: return checkJsxElement(node, checkMode); case 255: return checkJsxSelfClosingElement(node, checkMode); case 258: return checkJsxFragment(node, checkMode); case 262: return checkJsxAttributes(node, checkMode); case 256: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement") }return unknownType } function checkTypeParameter(node) { node.expression && grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected), checkSourceElement(node.constraint), checkSourceElement(node.default); var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); hasNonCircularBaseConstraint(typeParameter) || error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)), hasNonCircularTypeParameterDefault(typeParameter) || error(node.default, ts.Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter)); var constraintType = getConstraintOfTypeParameter(typeParameter), defaultType = getDefaultFromTypeParameter(typeParameter); constraintType && defaultType && checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1), produceDiagnostics && checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0) } function checkParameter(node) { checkGrammarDecoratorsAndModifiers(node), checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); ts.hasModifier(node, 92) && (154 === func.kind && ts.nodeIsPresent(func.body) || error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation)), node.questionToken && ts.isBindingPattern(node.name) && func.body && error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature), node.name && ts.isIdentifier(node.name) && ("this" === node.name.escapedText || "new" === node.name.escapedText) && (0 !== func.parameters.indexOf(node) && error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText), 154 !== func.kind && 158 !== func.kind && 163 !== func.kind || error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter)), !node.dotDotDotToken || ts.isBindingPattern(node.name) || isArrayType(getTypeOfSymbol(node.symbol)) || error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type) } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; if (71 === param.name.kind && param.name.escapedText === parameter.escapedText) return i } return -1 } function checkTypePredicate(node) { var parent = getTypePredicateParent(node); if (!parent) return void error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); var typePredicate = getTypePredicateOfSignature(getSignatureFromDeclaration(parent)); if (typePredicate) { checkSourceElement(node.type); var parameterName = node.parameterName; if (ts.isThisTypePredicate(typePredicate)) getTypeFromThisTypeNode(parameterName); else if (typePredicate.parameterIndex >= 0) if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); else { var leadingError = function () { return ts.chainDiagnosticMessages(void 0, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type) }; checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, void 0, leadingError) } else if (parameterName) { for (var hasReportedError = !1, _i = 0, _a = parent.parameters; _i < _a.length; _i++) { var name = _a[_i].name; if (ts.isBindingPattern(name) && checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = !0; break } } hasReportedError || error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName) } } } function getTypePredicateParent(node) { switch (node.parent.kind) { case 192: case 157: case 233: case 191: case 162: case 153: case 152: var parent = node.parent; if (node === parent.type) return parent } } function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { var name = element.name; if (71 === name.kind && name.escapedText === predicateVariableName) return error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName), !0; if ((180 === name.kind || 179 === name.kind) && checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) return !0 } } } function checkSignatureDeclaration(node) { 159 === node.kind ? checkGrammarIndexSignature(node) : 162 !== node.kind && 233 !== node.kind && 163 !== node.kind && 157 !== node.kind && 154 !== node.kind && 158 !== node.kind || checkGrammarFunctionLikeDeclaration(node); var functionFlags = ts.getFunctionFlags(node); if (4 & functionFlags || (3 === (3 & functionFlags) && languageVersion < 6 && checkExternalEmitHelpers(node, 6144), 2 === (3 & functionFlags) && languageVersion < 4 && checkExternalEmitHelpers(node, 64), 0 !== (3 & functionFlags) && languageVersion < 2 && checkExternalEmitHelpers(node, 128)), checkTypeParameters(node.typeParameters), ts.forEach(node.parameters, checkParameter), node.type && checkSourceElement(node.type), produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) switch (node.kind) { case 158: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; case 157: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type) }if (returnTypeNode) { var functionFlags_1 = ts.getFunctionFlags(node); if (1 === (5 & functionFlags_1)) { var returnType = getTypeFromTypeNode(returnTypeNode); if (returnType === voidType) error(returnTypeNode, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); else { var generatorElementType = getIteratedTypeOfGenerator(returnType, 0 !== (2 & functionFlags_1)) || anyType, iterableIteratorInstantiation = 2 & functionFlags_1 ? createAsyncIterableIteratorType(generatorElementType) : createIterableIteratorType(generatorElementType); checkTypeAssignableTo(iterableIteratorInstantiation, returnType, returnTypeNode) } } else 2 === (3 & functionFlags_1) && checkAsyncFunctionReturnType(node) } 159 !== node.kind && 283 !== node.kind && registerForUnusedIdentifiersCheck(node) } } function checkClassForDuplicateDeclarations(node) { function addName(names, location, name, meaning) { var prev = names.get(name); prev ? 4 & prev ? 4 !== meaning && error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)) : prev & meaning ? error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)) : names.set(name, prev | meaning) : names.set(name, meaning); } var Declaration; !function (Declaration) { Declaration[Declaration.Getter = 1] = "Getter", Declaration[Declaration.Setter = 2] = "Setter", Declaration[Declaration.Method = 4] = "Method", Declaration[Declaration.Property = 3] = "Property" }(Declaration || (Declaration = {})); for (var instanceNames = ts.createUnderscoreEscapedMap(), staticNames = ts.createUnderscoreEscapedMap(), _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (154 === member.kind) for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name) && addName(instanceNames, param.name, param.name.escapedText, 3) } else { var isStatic = ts.hasModifier(member, 32), names = isStatic ? staticNames : instanceNames, memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) switch (member.kind) { case 155: addName(names, member.name, memberName, 1); break; case 156: addName(names, member.name, memberName, 2); break; case 151: addName(names, member.name, memberName, 3); break; case 153: addName(names, member.name, memberName, 4) } } } } function checkClassForStaticPropertyNameConflicts(node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i], memberNameNode = member.name, isStatic = ts.hasModifier(member, 32); if (isStatic && memberNameNode) { var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); switch (memberName) { case "name": case "length": case "caller": case "arguments": case "prototype": var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1, className = getNameOfSymbolAsWritten(getSymbolOfNode(node)); error(memberNameNode, message, memberName, className) } } } } function checkObjectTypeForDuplicateDeclarations(node) { for (var names = ts.createMap(), _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (150 === member.kind) { var memberName = void 0; switch (member.name.kind) { case 9: case 8: memberName = member.name.text; break; case 71: memberName = ts.idText(member.name); break; default: continue }names.get(memberName) ? (error(ts.getNameOfDeclaration(member.symbol.valueDeclaration), ts.Diagnostics.Duplicate_identifier_0, memberName), error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName)) : names.set(memberName, !0) } } } function checkTypeForDuplicateIndexSignatures(node) { if (235 === node.kind) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) return } var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol) for (var seenNumericIndexer = !1, seenStringIndexer = !1, _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i], declaration = decl; if (1 === declaration.parameters.length && declaration.parameters[0].type) switch (declaration.parameters[0].type.kind) { case 137: seenStringIndexer ? error(declaration, ts.Diagnostics.Duplicate_string_index_signature) : seenStringIndexer = !0; break; case 134: seenNumericIndexer ? error(declaration, ts.Diagnostics.Duplicate_number_index_signature) : seenNumericIndexer = !0 } } } function checkPropertyDeclaration(node) { checkGrammarDecoratorsAndModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name), checkVariableLikeDeclaration(node) } function checkMethodDeclaration(node) { checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name), checkFunctionOrMethodDeclaration(node), ts.hasModifier(node, 128) && 153 === node.kind && node.body && error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)) } function checkConstructorDeclaration(node) { function isInstancePropertyWithInitializer(n) { return 151 === n.kind && !ts.hasModifier(n, 32) && !!n.initializer } checkSignatureDeclaration(node), checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node), checkSourceElement(node.body); var symbol = getSymbolOfNode(node), firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind); if (node === firstDeclaration && checkFunctionOrConstructorSymbol(symbol), !ts.nodeIsMissing(node.body) && produceDiagnostics) { var containingClassDecl = node.parent; if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { captureLexicalThis(node.parent, containingClassDecl); var classExtendsNull = classDeclarationExtendsNull(containingClassDecl), superCall = getSuperCallInConstructor(node); if (superCall) { classExtendsNull && error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); var superCallShouldBeFirst = ts.some(node.parent.members, isInstancePropertyWithInitializer) || ts.some(node.parameters, function (p) { return ts.hasModifier(p, 92) }); if (superCallShouldBeFirst) { for (var statements = node.body.statements, superCallStatement = void 0, _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; if (215 === statement.kind && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break } if (!ts.isPrologueDirective(statement)) break } superCallStatement || error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties) } } else classExtendsNull || error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call) } } } function checkAccessorDeclaration(node) { if (produceDiagnostics) { if (checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name), checkDecorators(node), checkSignatureDeclaration(node), 155 === node.kind && !(4194304 & node.flags) && ts.nodeIsPresent(node.body) && 128 & node.flags && (256 & node.flags || error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value)), 146 === node.name.kind && checkComputedPropertyName(node.name), !hasNonBindableDynamicName(node)) { var otherKind = 155 === node.kind ? 156 : 155, otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); if (otherAccessor) { var nodeFlags = ts.getModifierFlags(node), otherFlags = ts.getModifierFlags(otherAccessor); (28 & nodeFlags) !== (28 & otherFlags) && error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility), (128 & nodeFlags) !== (128 & otherFlags) && error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract), checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type), checkAccessorDeclarationTypesIdentical(node, otherAccessor, getThisTypeOfDeclaration, ts.Diagnostics.get_and_set_accessor_must_have_the_same_this_type) } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); 155 === node.kind && checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType) } checkSourceElement(node.body) } function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { var firstType = getAnnotatedType(first), secondType = getAnnotatedType(second); firstType && secondType && !isTypeIdenticalTo(firstType, secondType) && error(first, message) } function checkMissingDeclaration(node) { checkDecorators(node) } function getEffectiveTypeArguments(node, typeParameters) { return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJavaScriptFile(node)) } function checkTypeArgumentConstraints(node, typeParameters) { for (var typeArguments, mapper, result = !0, i = 0; i < typeParameters.length; i++) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); constraint && (typeArguments || (typeArguments = getEffectiveTypeArguments(node, typeParameters), mapper = createTypeMapper(typeParameters, typeArguments)), result = result && checkTypeAssignableTo(typeArguments[i], instantiateType(constraint, mapper), node.typeArguments[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1)) } return result } function getTypeParametersForTypeReference(node) { var type = getTypeFromTypeReference(node); if (type !== unknownType) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) return 524288 & symbol.flags && getSymbolLinks(symbol).typeParameters || (4 & ts.getObjectFlags(type) ? type.target.localTypeParameters : void 0) } } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments), 161 !== node.kind || void 0 === node.typeName.jsdocDotPos || ts.isInJavaScriptFile(node) || ts.isInJSDoc(node) || grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); var type = getTypeFromTypeReference(node); if (type !== unknownType) { if (node.typeArguments && (ts.forEach(node.typeArguments, checkSourceElement), produceDiagnostics)) { var typeParameters = getTypeParametersForTypeReference(node); typeParameters && checkTypeArgumentConstraints(node, typeParameters) } 16 & type.flags && 8 & getNodeLinks(node).resolvedSymbol.flags && error(node, ts.Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type)) } } function getTypeArgumentConstraint(node) { var typeReferenceNode = ts.tryCast(node.parent, ts.isTypeReferenceType); if (typeReferenceNode) { var typeParameters = getTypeParametersForTypeReference(typeReferenceNode), constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]); return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters))) } } function checkTypeQuery(node) { getTypeFromTypeQueryNode(node) } function checkTypeLiteral(node) { if (ts.forEach(node.members, checkSourceElement), produceDiagnostics) { var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); checkIndexConstraints(type), checkTypeForDuplicateIndexSignatures(node), checkObjectTypeForDuplicateDeclarations(node) } } function checkArrayType(node) { checkSourceElement(node.elementType) } function checkTupleType(node) { var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes); hasErrorFromDisallowedTrailingComma || 0 !== node.elementTypes.length || grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty), ts.forEach(node.elementTypes, checkSourceElement) } function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement) } function checkIndexedAccessIndexType(type, accessNode) { if (!(1048576 & type.flags)) return type; var objectType = type.objectType, indexType = type.indexType; return isTypeAssignableTo(indexType, getIndexType(objectType, !1)) ? (185 === accessNode.kind && ts.isAssignmentTarget(accessNode) && 32 & ts.getObjectFlags(objectType) && 1 & getMappedTypeModifiers(objectType) && error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)), type) : getIndexInfoOfType(getApparentType(objectType), 1) && isTypeAssignableToKind(indexType, 84) ? type : (error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)), type) } function checkIndexedAccessType(node) { checkSourceElement(node.objectType), checkSourceElement(node.indexType), checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node) } function checkMappedType(node) { checkSourceElement(node.typeParameter), checkSourceElement(node.type), noImplicitAny && !node.type && reportImplicitAnyError(node, anyType); var type = getTypeFromMappedTypeNode(node), constraintType = getConstraintTypeFromMappedType(type); checkTypeAssignableTo(constraintType, keyofConstraintType, node.typeParameter.constraint) } function checkTypeOperator(node) { checkGrammarTypeOperatorNode(node), checkSourceElement(node.type) } function checkConditionalType(node) { ts.forEachChild(node, checkSourceElement) } function checkInferType(node) { ts.findAncestor(node, function (n) { return n.parent && 170 === n.parent.kind && n.parent.extendsType === n }) || grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type), checkSourceElement(node.typeParameter) } function checkImportType(node) { checkSourceElement(node.argument), getTypeFromTypeNode(node) } function isPrivateWithinAmbient(node) { return ts.hasModifier(node, 8) && !!(4194304 & node.flags) } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); return 235 !== n.parent.kind && 234 !== n.parent.kind && 204 !== n.parent.kind && 4194304 & n.flags && (2 & flags || ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent) || (flags |= 1), flags |= 2), flags & flagsToCheck } function checkFunctionOrConstructorSymbol(symbol) { function getCanonicalOverload(overloads, implementation) { var implementationSharesContainerWithFirstOverload = void 0 !== implementation && implementation.parent === overloads[0].parent; return implementationSharesContainerWithFirstOverload ? implementation : overloads[0] } function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; if (0 !== someButNotAllOverloadFlags) { var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1; 1 & deviation ? error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported) : 2 & deviation ? error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient) : 24 & deviation ? error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected) : 128 & deviation && error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract) }) } } function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { if (someHaveQuestionToken !== allHaveQuestionToken) { var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); ts.forEach(overloads, function (o) { var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1; deviation && error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required) }) } } function reportImplementationExpectedError(node) { if (!node.name || !ts.nodeIsMissing(node.name)) { var seen = !1, subsequentNode = ts.forEachChild(node.parent, function (c) { return seen ? c : void (seen = c === node) }); if (subsequentNode && subsequentNode.pos === node.end && subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode, subsequentName = subsequentNode.name; if (node.name && subsequentName && (ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) || !ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { var reportError = (153 === node.kind || 152 === node.kind) && ts.hasModifier(node, 32) !== ts.hasModifier(subsequentNode, 32); if (reportError) { var diagnostic = ts.hasModifier(node, 32) ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic) } return } if (ts.nodeIsPresent(subsequentNode.body)) return void error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)) } var errorNode = node.name || node; isConstructor ? error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing) : ts.hasModifier(node, 128) ? error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive) : error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration) } } if (produceDiagnostics) { for (var bodyDeclaration, lastSeenNonAmbientDeclaration, previousDeclaration, flagsToCheck = 155, someNodeFlags = 0, allNodeFlags = flagsToCheck, someHaveQuestionToken = !1, allHaveQuestionToken = !0, hasOverloads = !1, declarations = symbol.declarations, isConstructor = 0 !== (16384 & symbol.flags), duplicateFunctionDeclaration = !1, multipleConstructorImplementation = !1, _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { var current = declarations_4[_i], node = current, inAmbientContext = 4194304 & node.flags, inAmbientContextOrInterface = 235 === node.parent.kind || 165 === node.parent.kind || inAmbientContext; if (inAmbientContextOrInterface && (previousDeclaration = void 0), 233 === node.kind || 153 === node.kind || 152 === node.kind || 154 === node.kind) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags, allNodeFlags &= currentNodeFlags, someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node), allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node), ts.nodeIsPresent(node.body) && bodyDeclaration ? isConstructor ? multipleConstructorImplementation = !0 : duplicateFunctionDeclaration = !0 : previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos && reportImplementationExpectedError(previousDeclaration), ts.nodeIsPresent(node.body) ? bodyDeclaration || (bodyDeclaration = node) : hasOverloads = !0, previousDeclaration = node, inAmbientContextOrInterface || (lastSeenNonAmbientDeclaration = node) } } if (multipleConstructorImplementation && ts.forEach(declarations, function (declaration) { error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed) }), duplicateFunctionDeclaration && ts.forEach(declarations, function (declaration) { error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Duplicate_function_implementation) }), !lastSeenNonAmbientDeclaration || lastSeenNonAmbientDeclaration.body || ts.hasModifier(lastSeenNonAmbientDeclaration, 128) || lastSeenNonAmbientDeclaration.questionToken || reportImplementationExpectedError(lastSeenNonAmbientDeclaration), hasOverloads && (checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags), checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken), bodyDeclaration)) for (var signatures = getSignaturesOfSymbol(symbol), bodySignature = getSignatureFromDeclaration(bodyDeclaration), _a = 0, signatures_7 = signatures; _a < signatures_7.length; _a++) { var signature = signatures_7[_a]; if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break } } } } function checkExportsOnMergedDeclarations(node) { function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { case 235: case 236: case 296: case 291: return 2; case 238: return ts.isAmbientModule(d) || 0 !== ts.getModuleInstanceState(d) ? 5 : 4; case 234: case 237: return 3; case 273: return 7; case 248: if (!ts.isEntityNameExpression(d.expression)) return 1; d = d.expression; case 242: case 245: case 244: var result_3 = 0, target = resolveAlias(getSymbolOfNode(d)); return ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d) }), result_3; case 231: case 181: case 233: case 247: return 1; default: ts.Debug.fail(ts.Debug.showSyntaxKind(d)) } } if (produceDiagnostics) { var symbol = node.localSymbol; if ((symbol || (symbol = getSymbolOfNode(node), symbol.exportSymbol)) && ts.getDeclarationOfKind(symbol, node.kind) === node) { for (var exportedDeclarationSpaces = 0, nonExportedDeclarationSpaces = 0, defaultExportedDeclarationSpaces = 0, _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i], declarationSpaces = getDeclarationSpaces(d), effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 513); 1 & effectiveDeclarationFlags ? 512 & effectiveDeclarationFlags ? defaultExportedDeclarationSpaces |= declarationSpaces : exportedDeclarationSpaces |= declarationSpaces : nonExportedDeclarationSpaces |= declarationSpaces } var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces, commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces, commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { var d = _c[_b], declarationSpaces = getDeclarationSpaces(d), name = ts.getNameOfDeclaration(d); declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault ? error(name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(name)) : declarationSpaces & commonDeclarationSpacesForExportsAndLocals && error(name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(name)) } var DeclarationSpaces; !function (DeclarationSpaces) { DeclarationSpaces[DeclarationSpaces.None = 0] = "None", DeclarationSpaces[DeclarationSpaces.ExportValue = 1] = "ExportValue", DeclarationSpaces[DeclarationSpaces.ExportType = 2] = "ExportType", DeclarationSpaces[DeclarationSpaces.ExportNamespace = 4] = "ExportNamespace" }(DeclarationSpaces || (DeclarationSpaces = {})) } } } function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage) { var promisedType = getPromisedTypeOfPromise(type, errorNode); return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage) } function getPromisedTypeOfPromise(promise, errorNode) { if (!isTypeAny(promise)) { var typeAsPromise = promise; if (typeAsPromise.promisedTypeOfPromise) return typeAsPromise.promisedTypeOfPromise; if (isReferenceToType(promise, getGlobalPromiseType(!1))) return typeAsPromise.promisedTypeOfPromise = promise.typeArguments[0]; var thenFunction = getTypeOfPropertyOfType(promise, "then"); if (!isTypeAny(thenFunction)) { var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : ts.emptyArray; if (0 === thenSignatures.length) return void (errorNode && error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method)); var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288); if (!isTypeAny(onfulfilledParameterType)) { var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0); return 0 === onfulfilledParameterSignatures.length ? void (errorNode && error(errorNode, ts.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback)) : typeAsPromise.promisedTypeOfPromise = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2) } } } } function checkAwaitedType(type, errorNode, diagnosticMessage) { return getAwaitedType(type, errorNode, diagnosticMessage) || unknownType } function getAwaitedType(type, errorNode, diagnosticMessage) { var typeAsAwaitable = type; if (typeAsAwaitable.awaitedTypeOfType) return typeAsAwaitable.awaitedTypeOfType; if (isTypeAny(type)) return typeAsAwaitable.awaitedTypeOfType = type; if (131072 & type.flags) { for (var types = void 0, _i = 0, _a = type.types; _i < _a.length; _i++) { var constituentType = _a[_i]; types = ts.append(types, getAwaitedType(constituentType, errorNode, diagnosticMessage)) } if (!types) return; return typeAsAwaitable.awaitedTypeOfType = getUnionType(types) } var promisedType = getPromisedTypeOfPromise(type); if (promisedType) { if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) return void (errorNode && error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method)); awaitedTypeStack.push(type.id); var awaitedType = getAwaitedType(promisedType, errorNode, diagnosticMessage); if (awaitedTypeStack.pop(), !awaitedType) return; return typeAsAwaitable.awaitedTypeOfType = awaitedType } var thenFunction = getTypeOfPropertyOfType(type, "then"); return thenFunction && getSignaturesOfType(thenFunction, 0).length > 0 ? void (errorNode && (ts.Debug.assert(!!diagnosticMessage), error(errorNode, diagnosticMessage))) : typeAsAwaitable.awaitedTypeOfType = type } function checkAsyncFunctionReturnType(node) { var returnTypeNode = ts.getEffectiveReturnTypeNode(node), returnType = getTypeFromTypeNode(returnTypeNode); if (languageVersion >= 2) { if (returnType === unknownType) return unknownType; var globalPromiseType = getGlobalPromiseType(!0); if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) return error(returnTypeNode, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type), unknownType } else { if (markTypeNodeAsReferenced(returnTypeNode), returnType === unknownType) return unknownType; var promiseConstructorName = ts.getEntityNameFromTypeNode(returnTypeNode); if (void 0 === promiseConstructorName) return error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType)), unknownType; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67216319, !0), promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) return 71 === promiseConstructorName.kind && "Promise" === promiseConstructorName.escapedText && getTargetType(returnType) === getGlobalPromiseType(!1) ? error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option) : error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)), unknownType; var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(!0); if (globalPromiseConstructorLikeType === emptyObjectType) return error(returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)), unknownType; if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeNode, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) return unknownType; var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName), collidingSymbol = getSymbol(node.locals, rootName.escapedText, 67216319); if (collidingSymbol) return error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName)), unknownType } return checkAwaitedType(returnType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) } function checkDecorator(node) { var signature = getResolvedSignature(node), returnType = getReturnTypeOfSignature(signature); if (!(1 & returnType.flags)) { var expectedReturnType, errorInfo, headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); switch (node.parent.kind) { case 234: var classSymbol = getSymbolOfNode(node.parent), classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; case 148: expectedReturnType = voidType, errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; case 151: expectedReturnType = voidType, errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; case 153: case 155: case 156: var methodType = getTypeOfNode(node.parent), descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]) }checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, function () { return errorInfo }) } } function markTypeNodeAsReferenced(node) { markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node)) } function markEntityNameOrEntityExpressionAsReference(typeName) { if (typeName) { var rootName = getFirstIdentifier(typeName), meaning = 2097152 | (71 === typeName.kind ? 67901928 : 1920), rootSymbol = resolveName(rootName, rootName.escapedText, meaning, void 0, void 0, !0); rootSymbol && 2097152 & rootSymbol.flags && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && markAliasSymbolAsReferenced(rootSymbol) } } function markDecoratorMedataDataTypeNodeAsReferenced(node) { var entityName = getEntityNameForDecoratorMetadata(node); entityName && ts.isEntityName(entityName) && markEntityNameOrEntityExpressionAsReference(entityName) } function getEntityNameForDecoratorMetadata(node) { if (node) switch (node.kind) { case 169: case 168: for (var commonEntityName = void 0, _i = 0, _a = node.types; _i < _a.length; _i++) { for (var typeNode = _a[_i]; 172 === typeNode.kind;)typeNode = typeNode.type; if (131 !== typeNode.kind && (strictNullChecks || 95 !== typeNode.kind && 140 !== typeNode.kind)) { var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); if (!individualEntityName) return; if (commonEntityName) { if (!ts.isIdentifier(commonEntityName) || !ts.isIdentifier(individualEntityName) || commonEntityName.escapedText !== individualEntityName.escapedText) return } else commonEntityName = individualEntityName } } return commonEntityName; case 172: return getEntityNameForDecoratorMetadata(node.type); case 161: return node.typeName } } function getParameterTypeNodeForDecoratorCheck(node) { var typeNode = ts.getEffectiveTypeAnnotationNode(node); return ts.isRestParameter(node) ? ts.getRestParameterElementType(typeNode) : typeNode } function checkDecorators(node) { if (node.decorators && ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { compilerOptions.experimentalDecorators || error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); var firstDecorator = node.decorators[0]; if (checkExternalEmitHelpers(firstDecorator, 8), 148 === node.kind && checkExternalEmitHelpers(firstDecorator, 32), compilerOptions.emitDecoratorMetadata) switch (checkExternalEmitHelpers(firstDecorator, 16), node.kind) { case 234: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)) } break; case 153: case 155: case 156: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)) } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; case 151: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; case 148: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); for (var containingSignature = node.parent, _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { var parameter = _e[_d]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)) } }ts.forEach(node.decorators, checkDecorator) } } function checkFunctionDeclaration(node) { produceDiagnostics && (checkFunctionOrMethodDeclaration(node), checkGrammarForGenerator(node), checkCollisionWithRequireExportsInGeneratedCode(node, node.name), checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name)) } function checkJSDocTypeAliasTag(node) { node.typeExpression || error(node.name, ts.Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags), node.name && checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0), checkSourceElement(node.typeExpression) } function checkJSDocParameterTag(node) { if (checkSourceElement(node.typeExpression), !ts.getParameterSymbolFromJSDoc(node)) { var decl = ts.getHostSignatureFromJSDoc(node); if (decl) { var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node); if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) return; containsArgumentsReference(decl) ? ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node && node.typeExpression && node.typeExpression.type && !isArrayType(getTypeFromTypeNode(node.typeExpression.type)) && error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(145 === node.name.kind ? node.name.right : node.name)) : error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(145 === node.name.kind ? node.name.right : node.name)); } } } function checkJSDocAugmentsTag(node) { var classLike = ts.getJSDocHost(node); if (!ts.isClassDeclaration(classLike) && !ts.isClassExpression(classLike)) return void error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName)); var augmentsTags = ts.getJSDocTags(classLike).filter(ts.isJSDocAugmentsTag); ts.Debug.assert(augmentsTags.length > 0), augmentsTags.length > 1 && error(augmentsTags[1], ts.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); var name = getIdentifierFromEntityNameExpression(node.class.expression), extend = ts.getClassExtendsHeritageClauseElement(classLike); if (extend) { var className = getIdentifierFromEntityNameExpression(extend.expression); className && name.escapedText !== className.escapedText && error(name, ts.Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, ts.idText(node.tagName), ts.idText(name), ts.idText(className)) } } function getIdentifierFromEntityNameExpression(node) { switch (node.kind) { case 71: return node; case 184: return node.name; default: return } } function checkFunctionOrMethodDeclaration(node) { checkDecorators(node), checkSignatureDeclaration(node); var functionFlags = ts.getFunctionFlags(node); if (node.name && 146 === node.name.kind && checkComputedPropertyName(node.name), !hasNonBindableDynamicName(node)) { var symbol = getSymbolOfNode(node), localSymbol = node.localSymbol || symbol, firstDeclaration = ts.find(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !(65536 & declaration.flags) }); node === firstDeclaration && checkFunctionOrConstructorSymbol(localSymbol), symbol.parent && ts.getDeclarationOfKind(symbol, node.kind) === node && checkFunctionOrConstructorSymbol(symbol) } var body = 152 === node.kind ? void 0 : node.body; checkSourceElement(body); var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (0 === (1 & functionFlags)) { var returnOrPromisedType = returnTypeNode && (2 & functionFlags ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(returnTypeNode)); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType) } produceDiagnostics && !returnTypeNode && (noImplicitAny && ts.nodeIsMissing(body) && !isPrivateWithinAmbient(node) && reportImplicitAnyError(node, anyType), 1 & functionFlags && ts.nodeIsPresent(body) && getReturnTypeOfSignature(getSignatureFromDeclaration(node))) } function registerForUnusedIdentifiersCheck(node) { if (produceDiagnostics) { var sourceFile = ts.getSourceFileOfNode(node), potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path); potentiallyUnusedIdentifiers || (potentiallyUnusedIdentifiers = [], allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers)), potentiallyUnusedIdentifiers.push(node) } } function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) { for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { case 234: case 204: checkUnusedClassMembers(node, addDiagnostic), checkUnusedTypeParameters(node, addDiagnostic); break; case 235: checkUnusedTypeParameters(node, addDiagnostic); break; case 273: case 238: case 212: case 240: case 219: case 220: case 221: checkUnusedLocalsAndParameters(node, addDiagnostic); break; case 154: case 191: case 233: case 192: case 153: case 155: case 156: node.body && checkUnusedLocalsAndParameters(node, addDiagnostic), checkUnusedTypeParameters(node, addDiagnostic); break; case 152: case 157: case 158: case 162: case 163: case 236: checkUnusedTypeParameters(node, addDiagnostic); break; default: ts.Debug.assertNever(node, "Node should not have been registered for unused identifiers check") } } } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration, message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(0, ts.createDiagnosticForNode(node, message, name)) } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName) } function isIdentifierThatStartsWithUnderScore(node) { return ts.isIdentifier(node) && 95 === ts.idText(node).charCodeAt(0) } function checkUnusedClassMembers(node, addDiagnostic) { if (!(4194304 & node.flags)) for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { case 153: case 151: case 155: case 156: if (156 === member.kind && 32768 & member.symbol.flags) break; var symbol = getSymbolOfNode(member); !symbol.isReferenced && ts.hasModifier(member, 8) && addDiagnostic(0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); break; case 154: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; !parameter.symbol.isReferenced && ts.hasModifier(parameter, 8) && addDiagnostic(0, ts.createDiagnosticForNode(parameter.name, ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read, ts.symbolName(parameter.symbol))) } break; case 159: case 211: break; default: ts.Debug.fail() } } } function checkUnusedTypeParameters(node, addDiagnostic) { var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); if (!(4194304 & node.flags) && ts.last(getSymbolOfNode(node).declarations) === node) for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { var typeParameter = typeParameters_2[_i]; 262144 & getMergedSymbol(typeParameter.symbol).isReferenced || isIdentifierThatStartsWithUnderScore(typeParameter.name) || addDiagnostic(1, ts.createDiagnosticForNode(typeParameter.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.symbolName(typeParameter.symbol))) } } function addToGroup(map, key, value, getKey) { var keyString = String(getKey(key)), group = map.get(keyString); group ? group[1].push(value) : map.set(keyString, [key, [value]]) } function tryGetRootParameterDeclaration(node) { return ts.tryCast(ts.getRootDeclaration(node), ts.isParameter) } function checkUnusedLocalsAndParameters(nodeWithLocals, addDiagnostic) { if (!(4194304 & nodeWithLocals.flags)) { var unusedImports = ts.createMap(), unusedDestructures = ts.createMap(), unusedVariables = ts.createMap(); nodeWithLocals.locals.forEach(function (local) { if (262144 & local.flags ? 3 & local.flags && !(3 & local.isReferenced) : !local.isReferenced && !local.exportSymbol) for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) if (isImportedDeclaration(declaration)) addToGroup(unusedImports, importClauseFromImported(declaration), declaration, getNodeId); else if (ts.isBindingElement(declaration) && ts.isObjectBindingPattern(declaration.parent)) { var lastElement = ts.last(declaration.parent.elements); declaration !== lastElement && ts.last(declaration.parent.elements).dotDotDotToken || addToGroup(unusedDestructures, declaration.parent, declaration, getNodeId) } else if (ts.isVariableDeclaration(declaration)) isIdentifierThatStartsWithUnderScore(declaration.name) && ts.isForInOrOfStatement(declaration.parent.parent) || addToGroup(unusedVariables, declaration.parent, declaration, getNodeId); else { var parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration); if (parameter) { var name = ts.getNameOfDeclaration(local.valueDeclaration); ts.isParameterPropertyDeclaration(parameter) || ts.parameterIsThisKeyword(parameter) || parameterNameStartsWithUnderscore(name) || addDiagnostic(1, ts.createDiagnosticForNode(name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.symbolName(local))) } else errorUnusedLocal(declaration, ts.symbolName(local), addDiagnostic) } } }), unusedImports.forEach(function (_a) { var importClause = _a[0], unuseds = _a[1], importDecl = importClause.parent, nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? 245 === importClause.namedBindings.kind ? 1 : importClause.namedBindings.elements.length : 0); if (nDeclarations === unuseds.length) addDiagnostic(0, 1 === unuseds.length ? ts.createDiagnosticForNode(importDecl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.first(unuseds).name)) : ts.createDiagnosticForNode(importDecl, ts.Diagnostics.All_imports_in_import_declaration_are_unused)); else for (var _i = 0, unuseds_1 = unuseds; _i < unuseds_1.length; _i++) { var unused = unuseds_1[_i]; errorUnusedLocal(unused, ts.idText(unused.name), addDiagnostic) } }), unusedDestructures.forEach(function (_a) { var bindingPattern = _a[0], bindingElements = _a[1], kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 : 0; if (bindingPattern.elements.length === bindingElements.length) 1 === bindingElements.length && 231 === bindingPattern.parent.kind && 232 === bindingPattern.parent.parent.kind ? addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId) : addDiagnostic(kind, 1 === bindingElements.length ? ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(ts.first(bindingElements).name, ts.isIdentifier))) : ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics.All_destructured_elements_are_unused)); else for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) { var e = bindingElements_1[_i]; addDiagnostic(kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(e.name, ts.isIdentifier)))) } }), unusedVariables.forEach(function (_a) { var declarationList = _a[0], declarations = _a[1]; if (declarationList.declarations.length === declarations.length) addDiagnostic(0, 1 === declarations.length ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) : ts.createDiagnosticForNode(213 === declarationList.parent.kind ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); else for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var decl = declarations_5[_i]; addDiagnostic(0, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.cast(decl.name, ts.isIdentifier)))) } }) } } function bindingNameText(name) { switch (name.kind) { case 71: return ts.idText(name); case 180: case 179: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name) } } function isImportedDeclaration(node) { return 244 === node.kind || 247 === node.kind || 245 === node.kind } function importClauseFromImported(decl) { return 244 === decl.kind ? decl : 245 === decl.kind ? decl.parent : decl.parent.parent } function checkBlock(node) { if (212 === node.kind && checkGrammarStatementInAmbientContext(node), ts.isFunctionOrModuleBlock(node)) { var saveFlowAnalysisDisabled = flowAnalysisDisabled; ts.forEach(node.statements, checkSourceElement), flowAnalysisDisabled = saveFlowAnalysisDisabled } else ts.forEach(node.statements, checkSourceElement); node.locals && registerForUnusedIdentifiersCheck(node) } function checkCollisionWithArgumentsInGeneratedCode(node) { languageVersion >= 2 || compilerOptions.noEmit || !ts.hasRestParameter(node) || 4194304 & node.flags || ts.nodeIsMissing(node.body) || ts.forEach(node.parameters, function (p) { p.name && !ts.isBindingPattern(p.name) && p.name.escapedText === argumentsSymbol.escapedName && error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters) }) } function needCollisionCheckForIdentifier(node, identifier, name) { if (!identifier || identifier.escapedText !== name) return !1; if (151 === node.kind || 150 === node.kind || 153 === node.kind || 152 === node.kind || 155 === node.kind || 156 === node.kind) return !1; if (4194304 & node.flags) return !1; var root = ts.getRootDeclaration(node); return 148 !== root.kind || !ts.nodeIsMissing(root.parent.body) } function checkIfThisIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { if (4 & getNodeCheckFlags(current)) { var isDeclaration_1 = 71 !== node.kind; return isDeclaration_1 ? error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference) : error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference), !0 } }) } function checkIfNewTargetIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { if (8 & getNodeCheckFlags(current)) { var isDeclaration_2 = 71 !== node.kind; return isDeclaration_2 ? error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference) : error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference), !0 } }) } function checkCollisionWithRequireExportsInGeneratedCode(node, name) { if (!(moduleKind >= ts.ModuleKind.ES2015 || compilerOptions.noEmit) && (needCollisionCheckForIdentifier(node, name, "require") || needCollisionCheckForIdentifier(node, name, "exports")) && (!ts.isModuleDeclaration(node) || 1 === ts.getModuleInstanceState(node))) { var parent = getDeclarationContainer(node); 273 === parent.kind && ts.isExternalOrCommonJsModule(parent) && error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)) } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { if (!(languageVersion >= 4 || compilerOptions.noEmit) && needCollisionCheckForIdentifier(node, name, "Promise") && (!ts.isModuleDeclaration(node) || 1 === ts.getModuleInstanceState(node))) { var parent = getDeclarationContainer(node); 273 === parent.kind && ts.isExternalOrCommonJsModule(parent) && 1024 & parent.flags && error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)) } } function checkVarDeclaredNamesNotShadowed(node) { if (0 === (3 & ts.getCombinedNodeFlags(node)) && !ts.isParameterDeclaration(node) && (231 !== node.kind || node.initializer)) { var symbol = getSymbolOfNode(node); if (1 & symbol.flags) { if (!ts.isIdentifier(node.name)) return ts.Debug.fail(); var localDeclarationSymbol = resolveName(node, node.name.escapedText, 3, void 0, void 0, !1); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && 2 & localDeclarationSymbol.flags && 3 & getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol)) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 232), container = 213 === varDeclList.parent.kind && varDeclList.parent.parent ? varDeclList.parent.parent : void 0, namesShareScope = container && (212 === container.kind && ts.isFunctionLike(container.parent) || 239 === container.kind || 238 === container.kind || 273 === container.kind); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name) } } } } } function checkParameterInitializer(node) { function visit(n) { if (!ts.isTypeNode(n) && !ts.isDeclarationName(n)) { if (184 === n.kind) return visit(n.expression); if (71 !== n.kind) return ts.forEachChild(n, visit); var symbol = resolveName(n, n.escapedText, 69313471, void 0, void 0, !1); if (symbol && symbol !== unknownSymbol && symbol.valueDeclaration) { if (symbol.valueDeclaration === node) return void error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { if (148 === symbol.valueDeclaration.kind || 181 === symbol.valueDeclaration.kind) { if (symbol.valueDeclaration.pos < node.pos) return; if (ts.findAncestor(n, function (current) { return current === node.initializer ? "quit" : ts.isFunctionLike(current.parent) || 151 === current.parent.kind && !ts.hasModifier(current.parent, 32) && ts.isClassLike(current.parent.parent) })) return } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)) } } } } if (148 === ts.getRootDeclaration(node).kind) { var func = ts.getContainingFunction(node); visit(node.initializer) } } function convertAutoToAny(type) { return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type } function checkVariableLikeDeclaration(node) { if (checkDecorators(node), ts.isBindingElement(node) || checkSourceElement(node.type), node.name) { if (146 === node.name.kind && (checkComputedPropertyName(node.name), node.initializer && checkExpressionCached(node.initializer)), 181 === node.kind) { 179 === node.parent.kind && languageVersion < 6 && checkExternalEmitHelpers(node, 4), node.propertyName && 146 === node.propertyName.kind && checkComputedPropertyName(node.propertyName); var parent = node.parent.parent, parentType = getTypeForBindingElementParent(parent), name = node.propertyName || node.name; if (!ts.isBindingPattern(name)) { var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property, void 0, !1), parent.initializer && property && checkPropertyAccessibility(parent, parent.initializer, parentType, property) } } if (ts.isBindingPattern(node.name) && (180 === node.name.kind && languageVersion < 2 && compilerOptions.downlevelIteration && checkExternalEmitHelpers(node, 512), ts.forEach(node.name.elements, checkSourceElement)), node.initializer && 148 === ts.getRootDeclaration(node).kind && ts.nodeIsMissing(ts.getContainingFunction(node).body)) return void error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); if (ts.isBindingPattern(node.name)) { if (node.initializer && 220 !== node.parent.parent.kind) { var initializerType = checkExpressionCached(node.initializer); strictNullChecks && 0 === node.name.elements.length ? checkNonNullType(initializerType, node) : checkTypeAssignableTo(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, void 0), checkParameterInitializer(node) } } else { var symbol = getSymbolOfNode(node), type = convertAutoToAny(getTypeOfSymbol(symbol)); if (node === symbol.valueDeclaration) { if (node.initializer && 220 !== node.parent.parent.kind) { var initializer = ts.isInJavaScriptFile(node) && ts.getDeclaredJavascriptInitializer(node) || node.initializer; checkTypeAssignableTo(checkExpressionCached(initializer), type, node, void 0), checkParameterInitializer(node) } } else { var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node)); type === unknownType || declarationType === unknownType || isTypeIdenticalTo(type, declarationType) || 67108864 & symbol.flags || errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType), node.initializer && checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, void 0), areDeclarationFlagsIdentical(node, symbol.valueDeclaration) || (error(ts.getNameOfDeclaration(symbol.valueDeclaration), ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)), error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name))) } 151 !== node.kind && 150 !== node.kind && (checkExportsOnMergedDeclarations(node), 231 !== node.kind && 181 !== node.kind || checkVarDeclaredNamesNotShadowed(node), checkCollisionWithRequireExportsInGeneratedCode(node, node.name), checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name)) } } } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration), message = 151 === nextDeclaration.kind || 150 === nextDeclaration.kind ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType)) } function areDeclarationFlagsIdentical(left, right) { if (148 === left.kind && 231 === right.kind || 231 === left.kind && 148 === right.kind) return !0; if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) return !1; var interestingFlags = 504; return ts.getSelectedModifierFlags(left, interestingFlags) === ts.getSelectedModifierFlags(right, interestingFlags) } function checkVariableDeclaration(node) { return checkGrammarVariableDeclaration(node), checkVariableLikeDeclaration(node) } function checkBindingElement(node) { return checkGrammarBindingElement(node), checkVariableLikeDeclaration(node) } function checkVariableStatement(node) { checkGrammarDecoratorsAndModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node), ts.forEach(node.declarationList.declarations, checkSourceElement) } function checkExpressionStatement(node) { checkGrammarStatementInAmbientContext(node), checkExpression(node.expression) } function checkIfStatement(node) { checkGrammarStatementInAmbientContext(node), checkExpression(node.expression), checkSourceElement(node.thenStatement), 214 === node.thenStatement.kind && error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement), checkSourceElement(node.elseStatement) } function checkDoStatement(node) { checkGrammarStatementInAmbientContext(node), checkSourceElement(node.statement), checkExpression(node.expression) } function checkWhileStatement(node) { checkGrammarStatementInAmbientContext(node), checkExpression(node.expression), checkSourceElement(node.statement) } function checkForStatement(node) { checkGrammarStatementInAmbientContext(node) || node.initializer && 232 === node.initializer.kind && checkGrammarVariableDeclarationList(node.initializer), node.initializer && (232 === node.initializer.kind ? ts.forEach(node.initializer.declarations, checkVariableDeclaration) : checkExpression(node.initializer)), node.condition && checkExpression(node.condition), node.incrementor && checkExpression(node.incrementor), checkSourceElement(node.statement), node.locals && registerForUnusedIdentifiersCheck(node) } function checkForOfStatement(node) { if (checkGrammarForInOrForOfStatement(node), node.awaitModifier) { var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); 2 === (6 & functionFlags) && languageVersion < 6 && checkExternalEmitHelpers(node, 16384) } else compilerOptions.downlevelIteration && languageVersion < 2 && checkExternalEmitHelpers(node, 256); if (232 === node.initializer.kind) checkForInOrForOfVariableDeclaration(node); else { var varExpr = node.initializer, iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); if (182 === varExpr.kind || 183 === varExpr.kind) checkDestructuringAssignment(varExpr, iteratedType || unknownType); else { var leftType = checkExpression(varExpr); checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access), iteratedType && checkTypeAssignableTo(iteratedType, leftType, varExpr, void 0) } } checkSourceElement(node.statement), node.locals && registerForUnusedIdentifiersCheck(node) } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); if (232 === node.initializer.kind) { var variable = node.initializer.declarations[0]; variable && ts.isBindingPattern(variable.name) && error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern), checkForInOrForOfVariableDeclaration(node) } else { var varExpr = node.initializer, leftType = checkExpression(varExpr); 182 === varExpr.kind || 183 === varExpr.kind ? error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern) : isTypeAssignableTo(getIndexTypeOrString(rightType), leftType) ? checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access) : error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any) } rightType !== neverType && isTypeAssignableToKind(rightType, 141590528) || error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)), checkSourceElement(node.statement), node.locals && registerForUnusedIdentifiersCheck(node) } function checkForInOrForOfVariableDeclaration(iterationStatement) { var variableDeclarationList = iterationStatement.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl) } } function checkRightHandSideOfForOf(rhsExpression, awaitModifier) { var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, !0, void 0 !== awaitModifier) } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables) { return isTypeAny(inputType) ? inputType : getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, !0) || anyType } function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterables, checkAssignability) { if (inputType === neverType) return void reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables); var uplevelIteration = languageVersion >= 2, downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; if (uplevelIteration || downlevelIteration || allowAsyncIterables) { var iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : void 0, allowAsyncIterables, !0, checkAssignability); if (iteratedType || uplevelIteration) return iteratedType } var arrayType = inputType, reportedError = !1, hasStringConstituent = !1; if (allowStringInput) { if (131072 & arrayType.flags) { var arrayTypes = inputType.types, filteredTypes = ts.filter(arrayTypes, function (t) { return !(34 & t.flags) }); filteredTypes !== arrayTypes && (arrayType = getUnionType(filteredTypes, 2)) } else 34 & arrayType.flags && (arrayType = neverType); if (hasStringConstituent = arrayType !== inputType, hasStringConstituent && (languageVersion < 1 && errorNode && (error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher), reportedError = !0), 16384 & arrayType.flags)) return stringType } if (!isArrayLikeType(arrayType)) { if (errorNode && !reportedError) { var isIterable = !!getIteratedTypeOfIterable(inputType, void 0, allowAsyncIterables, !0, checkAssignability), diagnostic = !allowStringInput || hasStringConstituent ? downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator : isIterable ? ts.Diagnostics.Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators : ts.Diagnostics.Type_0_is_not_an_array_type : downlevelIteration ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator : isIterable ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(errorNode, diagnostic, typeToString(arrayType)) } return hasStringConstituent ? stringType : void 0 } var arrayElementType = getIndexTypeOfType(arrayType, 1); return hasStringConstituent && arrayElementType ? 34 & arrayElementType.flags ? stringType : getUnionType([arrayElementType, stringType], 2) : arrayElementType } function getIteratedTypeOfIterable(type, errorNode, allowAsyncIterables, allowSyncIterables, checkAssignability) { function getIteratedType(type) { var typeAsIterable = type; if (allowAsyncIterables) { if (typeAsIterable.iteratedTypeOfAsyncIterable) return typeAsIterable.iteratedTypeOfAsyncIterable; if (isReferenceToType(type, getGlobalAsyncIterableType(!1)) || isReferenceToType(type, getGlobalAsyncIterableIteratorType(!1))) return typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0] } if (allowSyncIterables) { if (typeAsIterable.iteratedTypeOfIterable) return typeAsIterable.iteratedTypeOfIterable; if (isReferenceToType(type, getGlobalIterableType(!1)) || isReferenceToType(type, getGlobalIterableIteratorType(!1))) return typeAsIterable.iteratedTypeOfIterable = type.typeArguments[0] } var asyncMethodType = allowAsyncIterables && getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("asyncIterator")), methodType = asyncMethodType || allowSyncIterables && getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); if (!isTypeAny(methodType)) { var signatures = methodType && getSignaturesOfType(methodType, 0); if (!ts.some(signatures)) return void (errorNode && (reportTypeNotIterableError(errorNode, type, allowAsyncIterables), errorNode = void 0)); var returnType = getUnionType(ts.map(signatures, getReturnTypeOfSignature), 2), iteratedType = getIteratedTypeOfIterator(returnType, errorNode, !!asyncMethodType); return checkAssignability && errorNode && iteratedType && checkTypeAssignableTo(type, asyncMethodType ? createAsyncIterableType(iteratedType) : createIterableType(iteratedType), errorNode), asyncMethodType ? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType : typeAsIterable.iteratedTypeOfIterable = iteratedType } } if (!isTypeAny(type)) return mapType(type, getIteratedType) } function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { error(errorNode, allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator, typeToString(type)) } function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (!isTypeAny(type)) { var typeAsIterator = type; if (isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator) return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator; var getIteratorType = isAsyncIterator ? getGlobalAsyncIteratorType : getGlobalIteratorType; if (isReferenceToType(type, getIteratorType(!1))) return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator = type.typeArguments[0] : typeAsIterator.iteratedTypeOfIterator = type.typeArguments[0]; var nextMethod = getTypeOfPropertyOfType(type, "next"); if (!isTypeAny(nextMethod)) { var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0) : ts.emptyArray; if (0 === nextMethodSignatures.length) return void (errorNode && error(errorNode, isAsyncIterator ? ts.Diagnostics.An_async_iterator_must_have_a_next_method : ts.Diagnostics.An_iterator_must_have_a_next_method)); var nextResult = getUnionType(ts.map(nextMethodSignatures, getReturnTypeOfSignature), 2); if (!(isTypeAny(nextResult) || isAsyncIterator && (nextResult = getAwaitedTypeOfPromise(nextResult, errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property), isTypeAny(nextResult)))) { var nextValue = nextResult && getTypeOfPropertyOfType(nextResult, "value"); return nextValue ? isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator = nextValue : typeAsIterator.iteratedTypeOfIterator = nextValue : void (errorNode && error(errorNode, isAsyncIterator ? ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property : ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property)) } } } } function getIteratedTypeOfGenerator(returnType, isAsyncGenerator) { if (!isTypeAny(returnType)) return getIteratedTypeOfIterable(returnType, void 0, isAsyncGenerator, !isAsyncGenerator, !1) || getIteratedTypeOfIterator(returnType, void 0, isAsyncGenerator) } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node) } function isGetAccessorWithAnnotatedSetAccessor(node) { return 155 === node.kind && void 0 !== ts.getEffectiveSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 156)) } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { var unwrappedReturnType = 2 === (3 & ts.getFunctionFlags(func)) ? getPromisedTypeOfPromise(returnType) : returnType; return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 2049) } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { var func = ts.getContainingFunction(node); if (!func) return void grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); var signature = getSignatureFromDeclaration(func), returnType = getReturnTypeOfSignature(signature), functionFlags = ts.getFunctionFlags(func), isGenerator = 1 & functionFlags; if (strictNullChecks || node.expression || 16384 & returnType.flags) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (isGenerator) return; if (156 === func.kind) node.expression && error(node, ts.Diagnostics.Setters_cannot_return_a_value); else if (154 === func.kind) node.expression && !checkTypeAssignableTo(exprType, returnType, node) && error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); else if (ts.getEffectiveReturnTypeNode(func) || isGetAccessorWithAnnotatedSetAccessor(func)) if (2 & functionFlags) { var promisedType = getPromisedTypeOfPromise(returnType), awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); promisedType && checkTypeAssignableTo(awaitedType, promisedType, node) } else checkTypeAssignableTo(exprType, returnType, node) } else 154 === func.kind || !compilerOptions.noImplicitReturns || isUnwrappedReturnTypeVoidOrAny(func, returnType) || isGenerator || error(node, ts.Diagnostics.Not_all_code_paths_return_a_value) } } function checkWithStatement(node) { checkGrammarStatementInAmbientContext(node) || 16384 & node.flags && grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block), checkExpression(node.expression); var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { var start = ts.getSpanOfTokenAtPosition(sourceFile, node.pos).start, end = node.statement.pos; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any) } } function checkSwitchStatement(node) { checkGrammarStatementInAmbientContext(node); var firstDefaultClause, hasDuplicateDefaultClause = !1, expressionType = checkExpression(node.expression), expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { if (266 === clause.kind && !hasDuplicateDefaultClause) if (void 0 === firstDefaultClause) firstDefaultClause = clause; else { var sourceFile = ts.getSourceFileOfNode(node), start = ts.skipTrivia(sourceFile.text, clause.pos), end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement), hasDuplicateDefaultClause = !0 } if (produceDiagnostics && 265 === clause.kind) { var caseType = checkExpression(clause.expression), caseIsLiteral = isLiteralType(caseType), comparedExpressionType = expressionType; caseIsLiteral && expressionIsLiteral || (caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType, comparedExpressionType = getBaseTypeOfLiteralType(expressionType)), isTypeEqualityComparableTo(comparedExpressionType, caseType) || checkTypeComparableTo(caseType, comparedExpressionType, clause.expression, void 0) } ts.forEach(clause.statements, checkSourceElement) }), node.caseBlock.locals && registerForUnusedIdentifiersCheck(node.caseBlock) } function checkLabeledStatement(node) { checkGrammarStatementInAmbientContext(node) || ts.findAncestor(node.parent, function (current) { return ts.isFunctionLike(current) ? "quit" : 227 === current.kind && current.label.escapedText === node.label.escapedText ? (grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)), !0) : void 0 }), checkSourceElement(node.statement) } function checkThrowStatement(node) { checkGrammarStatementInAmbientContext(node) || void 0 === node.expression && grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here), node.expression && checkExpression(node.expression) } function checkTryStatement(node) { checkGrammarStatementInAmbientContext(node), checkBlock(node.tryBlock); var catchClause = node.catchClause; if (catchClause) { if (catchClause.variableDeclaration) if (catchClause.variableDeclaration.type) grammarErrorOnFirstToken(catchClause.variableDeclaration.type, ts.Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation); else if (catchClause.variableDeclaration.initializer) grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); else { var blockLocals_1 = catchClause.block.locals; blockLocals_1 && ts.forEachKey(catchClause.locals, function (caughtName) { var blockLocal = blockLocals_1.get(caughtName); blockLocal && 0 !== (2 & blockLocal.flags) && grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName) }) } checkBlock(catchClause.block) } node.finallyBlock && checkBlock(node.finallyBlock) } function checkIndexConstraints(type) { function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) { if (indexType && !ts.isKnownSymbol(prop)) { var propDeclaration = prop.valueDeclaration; if (1 !== indexKind || (propDeclaration ? isNumericName(ts.getNameOfDeclaration(propDeclaration)) : isNumericLiteralName(prop.escapedName))) { var errorNode; if (!propDeclaration || 199 !== propDeclaration.kind && 146 !== ts.getNameOfDeclaration(propDeclaration).kind && prop.parent !== containingType.symbol) { if (indexDeclaration) errorNode = indexDeclaration; else if (2 & ts.getObjectFlags(containingType)) { var someBaseClassHasBothPropertyAndIndexer = ts.forEach(getBaseTypes(containingType), function (base) { return getPropertyOfObjectType(base, prop.escapedName) && getIndexTypeOfType(base, indexKind) }); errorNode = someBaseClassHasBothPropertyAndIndexer ? void 0 : containingType.symbol.declarations[0] } } else errorNode = propDeclaration; if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { var errorMessage = 0 === indexKind ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)) } } } } var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1), declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0), stringIndexType = getIndexTypeOfType(type, 0), numberIndexType = getIndexTypeOfType(type, 1); if ((stringIndexType || numberIndexType) && (ts.forEach(getPropertiesOfObjectType(type), function (prop) { var propType = getTypeOfSymbol(prop); checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0), checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1) }), 1 & ts.getObjectFlags(type) && ts.isClassLike(type.symbol.valueDeclaration))) for (var classDeclaration = type.symbol.valueDeclaration, _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; if (!ts.hasModifier(member, 32) && hasNonBindableDynamicName(member)) { var symbol = getSymbolOfNode(member), propType = getTypeOfSymbol(symbol); checkIndexConstraintForProperty(symbol, propType, type, declaredStringIndexer, stringIndexType, 0), checkIndexConstraintForProperty(symbol, propType, type, declaredNumberIndexer, numberIndexType, 1) } } var errorNode; if (stringIndexType && numberIndexType && (errorNode = declaredNumberIndexer || declaredStringIndexer, !errorNode && 2 & ts.getObjectFlags(type))) { var someBaseTypeHasBothIndexers = ts.forEach(getBaseTypes(type), function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1) }); errorNode = someBaseTypeHasBothIndexers ? void 0 : type.symbol.declarations[0] } errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType) && error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)) } function checkTypeNameIsReserved(name, message) { switch (name.escapedText) { case "any": case "number": case "boolean": case "string": case "symbol": case "void": case "object": error(name, message, name.escapedText) } } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) for (var seenDefault = !1, i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; if (checkTypeParameter(node), produceDiagnostics) { node.default ? seenDefault = !0 : seenDefault && error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); for (var j = 0; j < i; j++)typeParameterDeclarations[j].symbol === node.symbol && error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)) } } } function checkTypeParameterListsIdentical(symbol) { if (1 !== symbol.declarations.length) { var links = getSymbolLinks(symbol); if (!links.typeParametersChecked) { links.typeParametersChecked = !0; var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); if (declarations.length <= 1) return; var type = getDeclaredTypeOfSymbol(symbol); if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) for (var name = symbolToString(symbol), _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { var declaration = declarations_6[_i]; error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name) } } } } function areTypeParametersIdentical(declarations, targetParameters) { for (var maxTypeArgumentCount = ts.length(targetParameters), minTypeArgumentCount = getMinTypeArgumentCount(targetParameters), _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { var declaration = declarations_7[_i], sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration), numTypeParameters = sourceParameters.length; if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) return !1; for (var i = 0; i < numTypeParameters; i++) { var source = sourceParameters[i], target = targetParameters[i]; if (source.name.escapedText !== target.symbol.escapedName) return !1; var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint), targetConstraint = getConstraintFromTypeParameter(target); if (sourceConstraint && (!targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) return !1; var sourceDefault = source.default && getTypeFromTypeNode(source.default), targetDefault = getDefaultFromTypeParameter(target); if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) return !1 } } return !0 } function checkClassExpression(node) { return checkClassLikeDeclaration(node), checkNodeDeferred(node), getTypeOfSymbol(getSymbolOfNode(node)) } function checkClassExpressionDeferred(node) { ts.forEach(node.members, checkSourceElement), registerForUnusedIdentifiersCheck(node) } function checkClassDeclaration(node) { node.name || ts.hasModifier(node, 512) || grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name), checkClassLikeDeclaration(node), ts.forEach(node.members, checkSourceElement), registerForUnusedIdentifiersCheck(node) } function checkClassLikeDeclaration(node) { checkGrammarClassLikeDeclaration(node), checkDecorators(node), node.name && (checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0), checkCollisionWithRequireExportsInGeneratedCode(node, node.name), checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name)), checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node)), checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node), type = getDeclaredTypeOfSymbol(symbol), typeWithThis = getTypeWithThisArgument(type), staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(symbol), checkClassForDuplicateDeclarations(node), 4194304 & node.flags || checkClassForStaticPropertyNameConflicts(node); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { languageVersion < 2 && checkExternalEmitHelpers(baseTypeNode.parent, 1); var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0], baseConstructorType = getBaseConstructorTypeOfClass(type), staticBaseType = getApparentType(baseConstructorType); if (checkBaseTypeAccessibility(staticBaseType, baseTypeNode), checkSourceElement(baseTypeNode.expression), ts.some(baseTypeNode.typeArguments)) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) { var constructor = _a[_i]; if (!checkTypeArgumentConstraints(baseTypeNode, constructor.typeParameters)) break } } var baseWithThis = getTypeWithThisArgument(baseType_1, type.thisType); if (checkTypeAssignableTo(typeWithThis, baseWithThis, void 0) || issueMemberSpecificError(node, typeWithThis, baseWithThis, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1), checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1), 1081344 & baseConstructorType.flags && !isMixinConstructorType(staticType) && error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any), !(staticBaseType.symbol && 32 & staticBaseType.symbol.flags || 1081344 & baseConstructorType.flags)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1 }) && error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type) } checkKindsOfPropertyMemberOverrides(type, baseType_1) } } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) { var typeRefNode = implementedTypeNodes_1[_b]; if (ts.isEntityNameExpression(typeRefNode.expression) || error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments), checkTypeReferenceNode(typeRefNode), produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) if (isValidBaseType(t)) { var genericDiag = t.symbol && 32 & t.symbol.flags ? ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass : ts.Diagnostics.Class_0_incorrectly_implements_interface_1, baseWithThis = getTypeWithThisArgument(t, type.thisType); checkTypeAssignableTo(typeWithThis, baseWithThis, void 0) || issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag) } else error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface) } } produceDiagnostics && (checkIndexConstraints(type), checkTypeForDuplicateIndexSignatures(node), checkPropertyInitialization(node)) } function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { for (var issuedMemberError = !1, _loop_8 = function (member) { if (ts.hasStaticModifier(member)) return "continue"; var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); if (declaredProp) { var prop = getPropertyOfType(typeWithThis, declaredProp.escapedName), baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); if (prop && baseProp) { var rootChain = function () { return ts.chainDiagnosticMessages(void 0, ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, symbolToString(declaredProp), typeToString(typeWithThis), typeToString(baseWithThis)) }; checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(baseProp), member.name || member, void 0, rootChain) || (issuedMemberError = !0) } } }, _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; _loop_8(member) } issuedMemberError || checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag) } function checkBaseTypeAccessibility(type, node) { var signatures = getSignaturesOfType(type, 1); if (signatures.length) { var declaration = signatures[0].declaration; if (declaration && ts.hasModifier(declaration, 8)) { var typeClassDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); isNodeWithinClass(node, typeClassDeclaration) || error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)) } } } function getTargetSymbol(s) { return 1 & ts.getCheckFlags(s) ? s.target : s } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { return 234 === d.kind || 235 === d.kind }) } function checkKindsOfPropertyMemberOverrides(type, baseType) { for (var baseProperties = getPropertiesOfType(baseType), _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i], base = getTargetSymbol(baseProperty); if (!(4194304 & base.flags)) { var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName)), baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base); if (ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."), derived) if (derived === base) { var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol); !(128 & baseDeclarationFlags) || derivedClassDecl && ts.hasModifier(derivedClassDecl, 128) || (204 === derivedClassDecl.kind ? error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)) : error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType))) } else { var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived); if (8 & baseDeclarationFlags || 8 & derivedDeclarationFlags) continue; if (isPrototypeProperty(base) && isPrototypeProperty(derived) || 98308 & base.flags && 98308 & derived.flags) continue; var errorMessage = void 0; errorMessage = isPrototypeProperty(base) ? 98304 & derived.flags ? ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor : ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property : 98304 & base.flags ? ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function : ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function, error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)) } } } } function checkInheritedPropertiesAreIdentical(type, typeNode) { var baseTypes = getBaseTypes(type); if (baseTypes.length < 2) return !0; var seen = ts.createUnderscoreEscapedMap(); ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.escapedName, { prop: p, containingType: type }) }); for (var ok = !0, _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++)for (var base = baseTypes_2[_i], properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)), _a = 0, properties_8 = properties; _a < properties_8.length; _a++) { var prop = properties_8[_a], existing = seen.get(prop.escapedName); if (existing) { var isInheritedProperty = existing.containingType !== type; if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { ok = !1; var typeName1 = typeToString(existing.containingType), typeName2 = typeToString(base), errorInfo = ts.chainDiagnosticMessages(void 0, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2), diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)) } } else seen.set(prop.escapedName, { prop: prop, containingType: base }) } return ok } function checkPropertyInitialization(node) { if (strictNullChecks && strictPropertyInitialization && !(4194304 & node.flags)) for (var constructor = findConstructorDeclaration(node), _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (isInstancePropertyWithoutInitializer(member)) { var propName = member.name; if (ts.isIdentifier(propName)) { var type = getTypeOfSymbol(getSymbolOfNode(member)); 1 & type.flags || 4096 & getFalsyFlags(type) || constructor && isPropertyInitializedInConstructor(propName, type, constructor) || error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName)) } } } } function isInstancePropertyWithoutInitializer(node) { return 151 === node.kind && !ts.hasModifier(node, 160) && !node.exclamationToken && !node.initializer } function isPropertyInitializedInConstructor(propName, propType, constructor) { var reference = ts.createPropertyAccess(ts.createThis(), propName); reference.flowNode = constructor.returnFlowNode; var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType)); return !(4096 & getFalsyFlags(flowType)) } function checkInterfaceDeclaration(node) { if (checkGrammarDecoratorsAndModifiers(node) || checkGrammarInterfaceDeclaration(node), checkTypeParameters(node.typeParameters), produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0), checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 235); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol), typeWithThis = getTypeWithThisArgument(type); if (checkInheritedPropertiesAreIdentical(type, node.name)) { for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { var baseType = _a[_i]; checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1) } checkIndexConstraints(type) } } checkObjectTypeForDuplicateDeclarations(node) } ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { ts.isEntityNameExpression(heritageElement.expression) || error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments), checkTypeReferenceNode(heritageElement) }), ts.forEach(node.members, checkSourceElement), produceDiagnostics && (checkTypeForDuplicateIndexSignatures(node), registerForUnusedIdentifiersCheck(node)) } function checkTypeAliasDeclaration(node) { checkGrammarDecoratorsAndModifiers(node), checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0), checkTypeParameters(node.typeParameters), checkSourceElement(node.type), registerForUnusedIdentifiersCheck(node) } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); if (!(16384 & nodeLinks.flags)) { nodeLinks.flags |= 16384; for (var autoValue = 0, _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i], value = computeMemberValue(member, autoValue); getNodeLinks(member).enumMemberValue = value, autoValue = "number" == typeof value ? value + 1 : void 0 } } } function computeMemberValue(member, autoValue) { if (isComputedNonLiteralName(member.name)) error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); else { var text = ts.getTextOfPropertyName(member.name); isNumericLiteralName(text) && !isInfinityOrNaNString(text) && error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name) } if (member.initializer) return computeConstantValue(member); if (!(4194304 & member.parent.flags) || ts.isConst(member.parent)) return void 0 !== autoValue ? autoValue : void error(member.name, ts.Diagnostics.Enum_member_must_have_initializer) } function computeConstantValue(member) { function evaluate(expr) { switch (expr.kind) { case 197: var value_2 = evaluate(expr.operand); if ("number" == typeof value_2) switch (expr.operator) { case 37: return value_2; case 38: return -value_2; case 52: return ~value_2 }break; case 199: var left = evaluate(expr.left), right = evaluate(expr.right); if ("number" == typeof left && "number" == typeof right) switch (expr.operatorToken.kind) { case 49: return left | right; case 48: return left & right; case 46: return left >> right; case 47: return left >>> right; case 45: return left << right; case 50: return left ^ right; case 39: return left * right; case 41: return left / right; case 37: return left + right; case 38: return left - right; case 42: return left % right; case 40: return Math.pow(left, right) } else if ("string" == typeof left && "string" == typeof right && 37 === expr.operatorToken.kind) return left + right; break; case 9: return expr.text; case 8: return checkGrammarNumericLiteral(expr), +expr.text; case 190: return evaluate(expr.expression); case 71: return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.escapedText); case 185: case 184: var ex = expr; if (isConstantMemberAccess(ex)) { var type = getTypeOfExpression(ex.expression); if (type.symbol && 384 & type.symbol.flags) { var name = void 0; if (184 === ex.kind) name = ex.name.escapedText; else { var argument = ex.argumentExpression; ts.Debug.assert(ts.isLiteralExpression(argument)), name = ts.escapeLeadingUnderscores(argument.text) } return evaluateEnumMember(expr, type.symbol, name) } } } } function evaluateEnumMember(expr, enumSymbol, name) { var memberSymbol = enumSymbol.exports.get(name); if (memberSymbol) { var declaration = memberSymbol.valueDeclaration; if (declaration !== member) return isBlockScopedNameDeclaredBeforeUse(declaration, member) ? getEnumMemberValue(declaration) : (error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums), 0) } } var enumKind = getEnumKind(getSymbolOfNode(member.parent)), isConstEnum = ts.isConst(member.parent), initializer = member.initializer, value = 1 !== enumKind || isLiteralEnumMember(member) ? evaluate(initializer) : void 0; if (void 0 !== value) isConstEnum && "number" == typeof value && !isFinite(value) && error(initializer, isNaN(value) ? ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); else { if (1 === enumKind) return error(initializer, ts.Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members), 0; isConstEnum ? error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression) : 4194304 & member.parent.flags ? error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression) : checkTypeAssignableTo(checkExpression(initializer), getDeclaredTypeOfSymbol(getSymbolOfNode(member.parent)), initializer, void 0) } return value } function isConstantMemberAccess(node) { return 71 === node.kind || 184 === node.kind && isConstantMemberAccess(node.expression) || 185 === node.kind && isConstantMemberAccess(node.expression) && 9 === node.argumentExpression.kind } function checkEnumDeclaration(node) { if (produceDiagnostics) { checkGrammarDecoratorsAndModifiers(node), checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0), checkCollisionWithRequireExportsInGeneratedCode(node, node.name), checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name), checkExportsOnMergedDeclarations(node), computeEnumMemberValues(node); var enumIsConst = ts.isConst(node); compilerOptions.isolatedModules && enumIsConst && 4194304 & node.flags && error(node.name, ts.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided); var enumSymbol = getSymbolOfNode(node), firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { enumSymbol.declarations.length > 1 && ts.forEach(enumSymbol.declarations, function (decl) { ts.isConstEnumDeclaration(decl) !== enumIsConst && error(ts.getNameOfDeclaration(decl), ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const) }); var seenEnumMissingInitialInitializer_1 = !1; ts.forEach(enumSymbol.declarations, function (declaration) { if (237 !== declaration.kind) return !1; var enumDeclaration = declaration; if (!enumDeclaration.members.length) return !1; var firstEnumMember = enumDeclaration.members[0]; firstEnumMember.initializer || (seenEnumMissingInitialInitializer_1 ? error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element) : seenEnumMissingInitialInitializer_1 = !0) }) } } } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { for (var declarations = symbol.declarations, _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { var declaration = declarations_8[_i]; if ((234 === declaration.kind || 233 === declaration.kind && ts.nodeIsPresent(declaration.body)) && !(4194304 & declaration.flags)) return declaration } } function inSameLexicalScope(node1, node2) { var container1 = ts.getEnclosingBlockScopeContainer(node1), container2 = ts.getEnclosingBlockScopeContainer(node2); return isGlobalSourceFile(container1) ? isGlobalSourceFile(container2) : !isGlobalSourceFile(container2) && container1 === container2 } function checkModuleDeclaration(node) { if (produceDiagnostics) { var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node), inAmbientContext = 4194304 & node.flags; isGlobalAugmentation && !inAmbientContext && error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); var isAmbientExternalModule = ts.isAmbientModule(node), contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; if (checkGrammarModuleElementContext(node, contextErrorMessage)) return; checkGrammarDecoratorsAndModifiers(node) || inAmbientContext || 9 !== node.name.kind || grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names), ts.isIdentifier(node.name) && (checkCollisionWithRequireExportsInGeneratedCode(node, node.name), checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name)), checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); if (512 & symbol.flags && symbol.declarations.length > 1 && !inAmbientContext && isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); firstNonAmbientClassOrFunc && (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc) ? error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged) : node.pos < firstNonAmbientClassOrFunc.pos && error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged)); var mergedClass = ts.getDeclarationOfKind(symbol, 234); mergedClass && inSameLexicalScope(node, mergedClass) && (getNodeLinks(node).flags |= 32768) } if (isAmbientExternalModule) if (ts.isExternalModuleAugmentation(node)) { var checkBody = isGlobalAugmentation || 33554432 & getSymbolOfNode(node).flags; if (checkBody && node.body) for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { var statement = _a[_i]; checkModuleAugmentationElement(statement, isGlobalAugmentation) } } else isGlobalSourceFile(node.parent) ? isGlobalAugmentation ? error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations) : ts.isExternalModuleNameRelative(ts.getTextOfIdentifierOrLiteral(node.name)) && error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name) : isGlobalAugmentation ? error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations) : error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces) } node.body && (checkSourceElement(node.body), ts.isGlobalScopeAugmentation(node) || registerForUnusedIdentifiersCheck(node)) } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { case 213: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation) } break; case 248: case 249: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; case 242: case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; case 181: case 231: var name = node.name; if (ts.isBindingPattern(name)) { for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation) } break } case 234: case 237: case 233: case 235: case 238: case 236: if (isGlobalAugmentation) return; var symbol = getSymbolOfNode(node); if (symbol) { var reportError = !(33554432 & symbol.flags); reportError || (reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0])) } } } function getFirstIdentifier(node) { switch (node.kind) { case 71: return node; case 145: do node = node.left; while (71 !== node.kind); return node; case 184: do node = node.expression; while (71 !== node.kind); return node } } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); if (ts.nodeIsMissing(moduleName)) return !1; if (!ts.isStringLiteral(moduleName)) return error(moduleName, ts.Diagnostics.String_literal_expected), !1; var inAmbientExternalModule = 239 === node.parent.kind && ts.isAmbientModule(node.parent.parent); return 273 === node.parent.kind || inAmbientExternalModule ? !(inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text) && !isTopLevelInExternalModuleAugmentation(node)) || (error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name), !1) : (error(moduleName, 249 === node.kind ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module), !1) } function checkAliasSymbol(node) { var symbol = getSymbolOfNode(node), target = resolveAlias(symbol); if (target !== unknownSymbol) { var excludedMeanings = (68264895 & symbol.flags ? 67216319 : 0) | (67901928 & symbol.flags ? 67901928 : 0) | (1920 & symbol.flags ? 1920 : 0); if (target.flags & excludedMeanings) { var message = 251 === node.kind ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)) } !compilerOptions.isolatedModules || 251 !== node.kind || 67216319 & target.flags || 4194304 & node.flags || error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided) } } function checkImportBinding(node) { checkCollisionWithRequireExportsInGeneratedCode(node, node.name), checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name), checkAliasSymbol(node) } function checkImportDeclaration(node) { if (!checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module) && (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node) && grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers), checkExternalImportOrExportDeclaration(node))) { var importClause = node.importClause; if (importClause && (importClause.name && checkImportBinding(importClause), importClause.namedBindings)) if (245 === importClause.namedBindings.kind) checkImportBinding(importClause.namedBindings); else { var moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier); moduleExisted && ts.forEach(importClause.namedBindings.elements, checkImportBinding) } } } function checkImportEqualsDeclaration(node) { if (!checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module) && (checkGrammarDecoratorsAndModifiers(node), ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node))) if (checkImportBinding(node), ts.hasModifier(node, 1) && markExportAsReferenced(node), 253 !== node.moduleReference.kind) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (67216319 & target.flags) { var moduleName = getFirstIdentifier(node.moduleReference); 1920 & resolveEntityName(moduleName, 67217343).flags || error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)) } 67901928 & target.flags && checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0) } } else moduleKind >= ts.ModuleKind.ES2015 && !(4194304 & node.flags) && grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead) } function checkExportDeclaration(node) { if (!checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module) && (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node) && grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers), !node.moduleSpecifier || checkExternalImportOrExportDeclaration(node))) if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); var inAmbientExternalModule = 239 === node.parent.kind && ts.isAmbientModule(node.parent.parent), inAmbientNamespaceDeclaration = !inAmbientExternalModule && 239 === node.parent.kind && !node.moduleSpecifier && 4194304 & node.flags; 273 === node.parent.kind || inAmbientExternalModule || inAmbientNamespaceDeclaration || error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace) } else { var moduleSymbol_2 = resolveExternalModuleName(node, node.moduleSpecifier); moduleSymbol_2 && hasExportAssignmentSymbol(moduleSymbol_2) && error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol_2)), moduleKind !== ts.ModuleKind.System && moduleKind !== ts.ModuleKind.ES2015 && moduleKind !== ts.ModuleKind.ESNext && checkExternalEmitHelpers(node, 32768) } } function checkGrammarModuleElementContext(node, errorMessage) { var isInAppropriateContext = 273 === node.parent.kind || 239 === node.parent.kind || 238 === node.parent.kind; return isInAppropriateContext || grammarErrorOnFirstToken(node, errorMessage), !isInAppropriateContext } function checkExportSpecifier(node) { if (checkAliasSymbol(node), compilerOptions.declaration && collectLinkedAliases(node.propertyName || node.name, !0), !node.parent.parent.moduleSpecifier) { var exportedName = node.propertyName || node.name, symbol = resolveName(exportedName, exportedName.escapedText, 70107135, void 0, void 0, !0); symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0]))) ? error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName)) : markExportAsReferenced(node) } } function checkExportAssignment(node) { if (!checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { var container = 273 === node.parent.kind ? node.parent : node.parent.parent; if (238 === container.kind && !ts.isAmbientModule(container)) return void (node.isExportEquals ? error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace) : error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module)); !checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node) && grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers), 71 === node.expression.kind ? (markExportAsReferenced(node), compilerOptions.declaration && collectLinkedAliases(node.expression, !0)) : checkExpressionCached(node.expression), checkExternalModuleExports(container), 4194304 & node.flags && !ts.isEntityNameExpression(node.expression) && grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context), !node.isExportEquals || 4194304 & node.flags || (moduleKind >= ts.ModuleKind.ES2015 ? grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead) : moduleKind === ts.ModuleKind.System && grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system)) } } function hasExportedMembers(moduleSymbol) { return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return "export=" !== id }) } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node), links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; isTopLevelInExternalModuleAugmentation(declaration) || ts.isInJavaScriptFile(declaration) || error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements) } var exports_1 = getExportsOfModule(moduleSymbol); exports_1 && exports_1.forEach(function (_a, id) { var declarations = _a.declarations, flags = _a.flags; if ("__export" !== id && !(1984 & flags)) { var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverloadAndNotAccessor); if (!(524288 & flags && exportedDeclarationsCount <= 2) && exportedDeclarationsCount > 1) for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; isNotOverload(declaration) && diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, ts.unescapeLeadingUnderscores(id))) } } }), links.exportsChecked = !0 } } function isNotAccessor(declaration) { return !ts.isAccessor(declaration) } function isNotOverload(declaration) { return 233 !== declaration.kind && 153 !== declaration.kind || !!declaration.body } function checkSourceElement(node) { if (node) { if (ts.isInJavaScriptFile(node) && node.jsDoc) for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var tags = _a[_i].tags; ts.forEach(tags, checkSourceElement) } var kind = node.kind; if (cancellationToken) switch (kind) { case 238: case 234: case 235: case 233: cancellationToken.throwIfCancellationRequested() }switch (kind) { case 147: return checkTypeParameter(node); case 148: return checkParameter(node); case 151: case 150: return checkPropertyDeclaration(node); case 162: case 163: case 157: case 158: case 159: return checkSignatureDeclaration(node); case 153: case 152: return checkMethodDeclaration(node); case 154: return checkConstructorDeclaration(node); case 155: case 156: return checkAccessorDeclaration(node); case 161: return checkTypeReferenceNode(node); case 160: return checkTypePredicate(node); case 164: return checkTypeQuery(node); case 165: return checkTypeLiteral(node); case 166: return checkArrayType(node); case 167: return checkTupleType(node); case 168: case 169: return checkUnionOrIntersectionType(node); case 172: return checkSourceElement(node.type); case 174: return checkTypeOperator(node); case 170: return checkConditionalType(node); case 171: return checkInferType(node); case 178: return checkImportType(node); case 289: return checkJSDocAugmentsTag(node); case 296: case 291: return checkJSDocTypeAliasTag(node); case 292: return checkJSDocParameterTag(node); case 283: checkSignatureDeclaration(node); case 281: case 280: case 278: case 279: case 286: return checkJSDocTypeIsInJsFile(node), void ts.forEachChild(node, checkSourceElement); case 284: return void checkJSDocVariadicType(node); case 277: return checkSourceElement(node.type); case 175: return checkIndexedAccessType(node); case 176: return checkMappedType(node); case 233: return checkFunctionDeclaration(node); case 212: case 239: return checkBlock(node); case 213: return checkVariableStatement(node); case 215: return checkExpressionStatement(node); case 216: return checkIfStatement(node); case 217: return checkDoStatement(node); case 218: return checkWhileStatement(node); case 219: return checkForStatement(node); case 220: return checkForInStatement(node); case 221: return checkForOfStatement(node); case 222: case 223: return checkBreakOrContinueStatement(node); case 224: return checkReturnStatement(node); case 225: return checkWithStatement(node); case 226: return checkSwitchStatement(node); case 227: return checkLabeledStatement(node); case 228: return checkThrowStatement(node); case 229: return checkTryStatement(node); case 231: return checkVariableDeclaration(node); case 181: return checkBindingElement(node); case 234: return checkClassDeclaration(node); case 235: return checkInterfaceDeclaration(node); case 236: return checkTypeAliasDeclaration(node); case 237: return checkEnumDeclaration(node); case 238: return checkModuleDeclaration(node); case 243: return checkImportDeclaration(node); case 242: return checkImportEqualsDeclaration(node); case 249: return checkExportDeclaration(node); case 248: return checkExportAssignment(node); case 214: case 230: return void checkGrammarStatementInAmbientContext(node); case 252: return checkMissingDeclaration(node) } } } function checkJSDocTypeIsInJsFile(node) { ts.isInJavaScriptFile(node) || grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments) } function checkJSDocVariadicType(node) { checkJSDocTypeIsInJsFile(node), checkSourceElement(node.type); var parent = node.parent; if (ts.isParameter(parent) && ts.isJSDocFunctionType(parent.parent)) return void (ts.last(parent.parent.parameters) !== parent && error(node, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list)); ts.isJSDocTypeExpression(parent) || error(node, ts.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); var paramTag = parent.parent; if (!ts.isJSDocParameterTag(paramTag)) return void error(node, ts.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); var param = ts.getParameterSymbolFromJSDoc(paramTag); if (param) { var host = ts.getHostSignatureFromJSDoc(paramTag); host && ts.last(host.parameters).symbol === param || error(node, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list) } } function getTypeFromJSDocVariadicType(node) { var type = getTypeFromTypeNode(node.type), parent = node.parent, paramTag = parent.parent; if (ts.isJSDocTypeExpression(parent) && ts.isJSDocParameterTag(paramTag)) { var host_1 = ts.getHostSignatureFromJSDoc(paramTag); if (host_1) { var lastParamDeclaration = ts.lastOrUndefined(host_1.parameters), symbol = ts.getParameterSymbolFromJSDoc(paramTag); if (!lastParamDeclaration || symbol && lastParamDeclaration.symbol === symbol && ts.isRestParameter(lastParamDeclaration)) return createArrayType(type) } } return ts.isParameter(parent) && ts.isJSDocFunctionType(parent.parent) ? createArrayType(type) : addOptionality(type) } function checkNodeDeferred(node) { deferredNodes && deferredNodes.push(node) } function checkDeferredNodes() { for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { case 191: case 192: case 153: case 152: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; case 155: case 156: checkAccessorDeclaration(node); break; case 204: checkClassExpressionDeferred(node) } } } function checkSourceFile(node) { ts.performance.mark("beforeCheck"), checkSourceFileWorker(node), ts.performance.mark("afterCheck"), ts.performance.measure("Check", "beforeCheck", "afterCheck") } function unusedIsError(kind) { switch (kind) { case 0: return compilerOptions.noUnusedLocals; case 1: return compilerOptions.noUnusedParameters; default: return ts.Debug.assertNever(kind) } } function getPotentiallyUnusedIdentifiers(sourceFile) { return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || ts.emptyArray } function checkSourceFileWorker(node) { var links = getNodeLinks(node); if (!(1 & links.flags)) { if (compilerOptions.skipLibCheck && node.isDeclarationFile || compilerOptions.skipDefaultLibCheck && node.hasNoDefaultLib) return; checkGrammarSourceFile(node), ts.clear(potentialThisCollisions), ts.clear(potentialNewTargetCollisions), deferredNodes = [], ts.forEach(node.statements, checkSourceElement), checkDeferredNodes(), ts.isExternalOrCommonJsModule(node) && registerForUnusedIdentifiersCheck(node), node.isDeclarationFile || !compilerOptions.noUnusedLocals && !compilerOptions.noUnusedParameters || checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (kind, diag) { unusedIsError(kind) && diagnostics.add(diag) }), deferredNodes = void 0, ts.isExternalOrCommonJsModule(node) && checkExternalModuleExports(node), potentialThisCollisions.length && (ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope), ts.clear(potentialThisCollisions)), potentialNewTargetCollisions.length && (ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope), ts.clear(potentialNewTargetCollisions)), links.flags |= 1 } } function getDiagnostics(sourceFile, ct) { try { return cancellationToken = ct, getDiagnosticsWorker(sourceFile) } finally { cancellationToken = void 0 } } function getDiagnosticsWorker(sourceFile) { if (throwIfNonDiagnosticsProducing(), sourceFile) { var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics(), previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length; checkSourceFile(sourceFile); var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName), currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); if (currentGlobalDiagnostics !== previousGlobalDiagnostics) { var deferredGlobalDiagnostics = ts.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts.compareDiagnostics); return ts.concatenate(deferredGlobalDiagnostics, semanticDiagnostics) } return 0 === previousGlobalDiagnosticsSize && currentGlobalDiagnostics.length > 0 ? ts.concatenate(currentGlobalDiagnostics, semanticDiagnostics) : semanticDiagnostics } return ts.forEach(host.getSourceFiles(), checkSourceFile), diagnostics.getDiagnostics() } function getGlobalDiagnostics() { return throwIfNonDiagnosticsProducing(), diagnostics.getGlobalDiagnostics() } function throwIfNonDiagnosticsProducing() { if (!produceDiagnostics) throw new Error("Trying to get diagnostics from a type checker that does not produce them.") } function getSymbolsInScope(location, meaning) { function populateSymbols() { for (; location;) { switch (location.locals && !isGlobalSourceFile(location) && copySymbols(location.locals, meaning), location.kind) { case 238: copySymbols(getSymbolOfNode(location).exports, 2623475 & meaning); break; case 237: copySymbols(getSymbolOfNode(location).exports, 8 & meaning); break; case 204: var className = location.name; className && copySymbol(location.symbol, meaning); case 234: case 235: isStatic || copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), 67901928 & meaning); break; case 191: var funcName = location.name; funcName && copySymbol(location.symbol, meaning) }ts.introducesArgumentsExoticObject(location) && copySymbol(argumentsSymbol, meaning), isStatic = ts.hasModifier(location, 32), location = location.parent } copySymbols(globals, meaning) } function copySymbol(symbol, meaning) { if (ts.getCombinedLocalAndExportSymbolFlags(symbol) & meaning) { var id = symbol.escapedName; symbols.has(id) || symbols.set(id, symbol) } } function copySymbols(source, meaning) { meaning && source.forEach(function (symbol) { copySymbol(symbol, meaning) }) } if (8388608 & location.flags) return []; var symbols = ts.createSymbolTable(), isStatic = !1; return populateSymbols(), symbolsToArray(symbols) } function isTypeDeclarationName(name) { return 71 === name.kind && isTypeDeclaration(name.parent) && name.parent.name === name } function isTypeDeclaration(node) { switch (node.kind) { case 147: case 234: case 235: case 236: case 237: return !0 } } function isTypeReferenceIdentifier(entityName) { for (var node = entityName; node.parent && 145 === node.parent.kind;)node = node.parent; return node.parent && 161 === node.parent.kind } function isHeritageClauseElementIdentifier(entityName) { for (var node = entityName; node.parent && 184 === node.parent.kind;)node = node.parent; return node.parent && 206 === node.parent.kind } function forEachEnclosingClass(node, callback) { for (var result; ;) { if (node = ts.getContainingClass(node), !node) break; if (result = callback(node)) break } return result } function isNodeWithinConstructorOfClass(node, classDeclaration) { return ts.findAncestor(node, function (element) { return !(!ts.isConstructorDeclaration(element) || !ts.nodeIsPresent(element.body) || element.parent !== classDeclaration) || !(element !== classDeclaration && !ts.isFunctionLikeDeclaration(element)) && "quit" }) } function isNodeWithinClass(node, classDeclaration) { return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration }) } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { for (; 145 === nodeOnRightSide.parent.kind;)nodeOnRightSide = nodeOnRightSide.parent; return 242 === nodeOnRightSide.parent.kind ? nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent : 248 === nodeOnRightSide.parent.kind ? nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent : void 0 } function isInRightSideOfImportOrExportAssignment(node) { return void 0 !== getLeftSideOfImportEqualsOrExportAssignment(node) } function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1: case 3: return getSymbolOfNode(entityName.parent); case 4: case 2: case 5: return getSymbolOfNode(entityName.parent.parent) } } function isImportTypeQualifierPart(node) { for (var parent = node.parent; ts.isQualifiedName(parent);)node = parent, parent = parent.parent; if (parent && 178 === parent.kind && parent.qualifier === node) return parent } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) return getSymbolOfNode(entityName.parent); if (ts.isInJavaScriptFile(entityName) && 184 === entityName.parent.kind && entityName.parent === entityName.parent.parent.left) { var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); if (specialPropertyAssignmentSymbol) return specialPropertyAssignmentSymbol } if (248 === entityName.parent.kind && ts.isEntityNameExpression(entityName)) { var success = resolveEntityName(entityName, 70107135, !0); if (success && success !== unknownSymbol) return success } else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) { var importEqualsDeclaration = ts.getAncestor(entityName, 242); return ts.Debug.assert(void 0 !== importEqualsDeclaration), getSymbolOfPartOfRightHandSideOfImportEquals(entityName, !0) } if (!ts.isPropertyAccessExpression(entityName)) { var possibleImportNode = isImportTypeQualifierPart(entityName); if (possibleImportNode) { getTypeFromTypeNode(possibleImportNode); var sym = getNodeLinks(entityName).resolvedSymbol; return sym === unknownSymbol ? void 0 : sym } } for (; ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName);)entityName = entityName.parent; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; 206 === entityName.parent.kind ? (meaning = 67901928, ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) && (meaning |= 67216319)) : meaning = 1920, meaning |= 2097152; var entityNameSymbol = ts.isEntityNameExpression(entityName) ? resolveEntityName(entityName, meaning) : void 0; if (entityNameSymbol) return entityNameSymbol } if (292 === entityName.parent.kind) return ts.getParameterSymbolFromJSDoc(entityName.parent); if (147 === entityName.parent.kind && 295 === entityName.parent.parent.kind) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol } if (ts.isExpressionNode(entityName)) { if (ts.nodeIsMissing(entityName)) return; if (71 === entityName.kind) { if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { var symbol = getIntrinsicTagSymbol(entityName.parent); return symbol === unknownSymbol ? void 0 : symbol } return resolveEntityName(entityName, 67216319, !1, !0) } if (184 === entityName.kind || 145 === entityName.kind) { var links = getNodeLinks(entityName); return links.resolvedSymbol ? links.resolvedSymbol : (184 === entityName.kind ? checkPropertyAccessExpression(entityName) : checkQualifiedName(entityName), links.resolvedSymbol) } } else { if (isTypeReferenceIdentifier(entityName)) { var meaning = 161 === entityName.parent.kind ? 67901928 : 1920; return resolveEntityName(entityName, meaning, !1, !0) } if (261 === entityName.parent.kind) return getJsxAttributePropertySymbol(entityName.parent) } return 160 === entityName.parent.kind ? resolveEntityName(entityName, 1) : void 0 } function getSymbolAtLocation(node) { if (273 === node.kind) return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : void 0; if (!(8388608 & node.flags)) { if (isDeclarationNameOrImportPropertyName(node)) return getSymbolOfNode(node.parent); if (ts.isLiteralComputedPropertyDeclarationName(node)) return getSymbolOfNode(node.parent.parent); if (71 === node.kind) { if (isInRightSideOfImportOrExportAssignment(node)) return getSymbolOfEntityNameOrPropertyAccessExpression(node); if (181 === node.parent.kind && 179 === node.parent.parent.kind && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent), propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.escapedText); if (propertyDeclaration) return propertyDeclaration } } switch (node.kind) { case 71: case 184: case 145: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 99: var container = ts.getThisContainer(node, !1); if (ts.isFunctionLike(container)) { var sig = getSignatureFromDeclaration(container); if (sig.thisParameter) return sig.thisParameter } if (ts.isInExpressionContext(node)) return checkExpression(node).symbol; case 173: return getTypeFromThisTypeNode(node).symbol; case 97: return checkExpression(node).symbol; case 123: var constructorDeclaration = node.parent; if (constructorDeclaration && 154 === constructorDeclaration.kind) return constructorDeclaration.parent.symbol; return; case 9: case 13: if (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (243 === node.parent.kind || 249 === node.parent.kind) && node.parent.moduleSpecifier === node || ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, !1) || ts.isImportCall(node.parent) || ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent) return resolveExternalModuleName(node, node); case 8: var objectType = ts.isElementAccessExpression(node.parent) ? node.parent.argumentExpression === node ? getTypeOfExpression(node.parent.expression) : void 0 : ts.isLiteralTypeNode(node.parent) && ts.isIndexedAccessTypeNode(node.parent.parent) ? getTypeFromTypeNode(node.parent.parent.objectType) : void 0; return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text)); case 79: case 89: case 36: return getSymbolOfNode(node.parent); case 178: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : void 0; default: return } } } function getShorthandAssignmentValueSymbol(location) { if (location && 270 === location.kind) return resolveEntityName(location.name, 69313471) } function getExportSpecifierLocalTargetSymbol(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 70107135) } function getTypeOfNode(node) { if (8388608 & node.flags) return unknownType; if (ts.isPartOfTypeNode(node)) { var typeFromTypeNode = getTypeFromTypeNode(node); if (typeFromTypeNode && ts.isExpressionWithTypeArgumentsInClassImplementsClause(node)) { var containingClass = ts.getContainingClass(node), classType = getTypeOfNode(containingClass); typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType) } return typeFromTypeNode } if (ts.isExpressionNode(node)) return getRegularTypeOfExpression(node); if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { var classNode = ts.getContainingClass(node), classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)), baseType = getBaseTypes(classType)[0]; return baseType && getTypeWithThisArgument(baseType, classType.thisType) } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol) } if (isTypeDeclarationName(node)) { var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol) } if (ts.isDeclaration(node)) { var symbol = getSymbolOfNode(node); return getTypeOfSymbol(symbol) } if (isDeclarationNameOrImportPropertyName(node)) { var symbol = getSymbolAtLocation(node); return symbol && getTypeOfSymbol(symbol) } if (ts.isBindingPattern(node)) return getTypeForVariableLikeDeclaration(node.parent, !0); if (isInRightSideOfImportOrExportAssignment(node)) { var symbol = getSymbolAtLocation(node); if (symbol) { var declaredType = getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol) } } return unknownType } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { if (ts.Debug.assert(183 === expr.kind || 182 === expr.kind), 221 === expr.parent.kind) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType) } if (199 === expr.parent.kind) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType) } if (269 === expr.parent.kind) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent) } ts.Debug.assert(182 === expr.parent.kind); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent), elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, !1, !1) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || unknownType) } function getPropertySymbolOfDestructuringAssignment(location) { var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText) } function getRegularTypeOfExpression(expr) { return ts.isRightSideOfQualifiedNameOrPropertyAccess(expr) && (expr = expr.parent), getRegularTypeOfLiteralType(getTypeOfExpression(expr)) } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); return ts.hasModifier(node, 32) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol) } function getAugmentedPropertiesOfType(type) { type = getApparentType(type); var propsByName = ts.createSymbolTable(getPropertiesOfType(type)); return typeHasCallOrConstructSignatures(type) && ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { propsByName.has(p.escapedName) || propsByName.set(p.escapedName, p) }), getNamedMembers(propsByName) } function typeHasCallOrConstructSignatures(type) { return ts.typeHasCallOrConstructSignatures(type, checker) } function getRootSymbols(symbol) { var roots = getImmediateRootSymbols(symbol); return roots ? ts.flatMap(roots, getRootSymbols) : [symbol] } function getImmediateRootSymbols(symbol) { if (6 & ts.getCheckFlags(symbol)) return ts.mapDefined(getSymbolLinks(symbol).containingType.types, function (type) { return getPropertyOfType(type, symbol.escapedName) }); if (33554432 & symbol.flags) { var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin; return leftSpread ? [leftSpread, rightSpread] : syntheticOrigin ? [syntheticOrigin] : ts.singleElementArray(tryGetAliasTarget(symbol)) } } function tryGetAliasTarget(symbol) { for (var target, next = symbol; next = getSymbolLinks(next).target;)target = next; return target } function isArgumentsLocalBinding(node) { if (!ts.isGeneratedIdentifier(node) && (node = ts.getParseTreeNode(node, ts.isIdentifier))) { var isPropertyName_1 = 184 === node.parent.kind && node.parent.name === node; return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol } return !1 } function moduleExportsSomeValue(moduleReferenceExpression) { function isValue(s) { return s = resolveSymbol(s), s && !!(67216319 & s.flags) } var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) return !0; var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); var symbolLinks = getSymbolLinks(moduleSymbol); return void 0 === symbolLinks.exportsSomeValue && (symbolLinks.exportsSomeValue = hasExportAssignment ? !!(67216319 & moduleSymbol.flags) : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue)), symbolLinks.exportsSomeValue } function isNameOfModuleOrEnumDeclaration(node) { var parent = node.parent; return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name } function getReferencedExportContainer(node, prefixLocals) { if (node = ts.getParseTreeNode(node, ts.isIdentifier)) { var symbol = getReferencedValueSymbol(node, isNameOfModuleOrEnumDeclaration(node)); if (symbol) { if (1048576 & symbol.flags) { var exportSymbol = getMergedSymbol(symbol.exportSymbol); if (!prefixLocals && 944 & exportSymbol.flags && !(3 & exportSymbol.flags)) return; symbol = exportSymbol } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { if (512 & parentSymbol_1.flags && 273 === parentSymbol_1.valueDeclaration.kind) { var symbolFile = parentSymbol_1.valueDeclaration, referenceFile = ts.getSourceFileOfNode(node), symbolIsUmdExport = symbolFile !== referenceFile; return symbolIsUmdExport ? void 0 : symbolFile } return ts.findAncestor(node.parent, function (n) { return ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1 }) } } } } function getReferencedImportDeclaration(node) { if (node = ts.getParseTreeNode(node, ts.isIdentifier)) { var symbol = getReferencedValueSymbol(node); if (isNonLocalAlias(symbol, 67216319)) return getDeclarationOfAliasSymbol(symbol) } } function isSymbolOfDeclarationWithCollidingName(symbol) { if (418 & symbol.flags) { var links = getSymbolLinks(symbol); if (void 0 === links.isDeclarationWithCollidingName) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (ts.isStatementWithLocals(container)) { var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); if (resolveName(container.parent, symbol.escapedName, 67216319, void 0, void 0, !1)) links.isDeclarationWithCollidingName = !0; else if (131072 & nodeLinks_1.flags) { var isDeclaredInLoop = 262144 & nodeLinks_1.flags, inLoopInitializer = ts.isIterationStatement(container, !1), inLoopBodyBlock = 212 === container.kind && ts.isIterationStatement(container.parent, !1); links.isDeclarationWithCollidingName = !(ts.isBlockScopedContainerTopLevel(container) || isDeclaredInLoop && (inLoopInitializer || inLoopBodyBlock)) } else links.isDeclarationWithCollidingName = !1 } } return links.isDeclarationWithCollidingName } return !1 } function getReferencedDeclarationWithCollidingName(node) { if (!ts.isGeneratedIdentifier(node) && (node = ts.getParseTreeNode(node, ts.isIdentifier))) { var symbol = getReferencedValueSymbol(node); if (symbol && isSymbolOfDeclarationWithCollidingName(symbol)) return symbol.valueDeclaration } } function isDeclarationWithCollidingName(node) { if (node = ts.getParseTreeNode(node, ts.isDeclaration)) { var symbol = getSymbolOfNode(node); if (symbol) return isSymbolOfDeclarationWithCollidingName(symbol) } return !1 } function isValueAliasDeclaration(node) { switch (node.kind) { case 242: case 244: case 245: case 247: case 251: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); case 249: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); case 248: return !node.expression || 71 !== node.expression.kind || isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) }return !1 } function isTopLevelValueImportEqualsWithEntityName(node) { if (node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration), void 0 === node || 273 !== node.parent.kind || !ts.isInternalModuleImportEqualsDeclaration(node)) return !1; var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference) } function isAliasResolvedToValue(symbol) { var target = resolveAlias(symbol); return target === unknownSymbol || 67216319 & target.flags && (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)) } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule } function isReferencedAliasDeclaration(node, checkChildren) { if (ts.isAliasSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node); if (symbol && getSymbolLinks(symbol).referenced) return !0; var target = getSymbolLinks(symbol).target; if (target && 1 & ts.getModifierFlags(node) && 67216319 & target.flags) return !0 } return !!checkChildren && ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren) }) } function isImplementationOfOverload(node) { if (ts.nodeIsPresent(node.body)) { if (ts.isGetAccessor(node) || ts.isSetAccessor(node)) return !1; var symbol = getSymbolOfNode(node), signaturesOfSymbol = getSignaturesOfSymbol(symbol); return signaturesOfSymbol.length > 1 || 1 === signaturesOfSymbol.length && signaturesOfSymbol[0].declaration !== node } return !1 } function isRequiredInitializedParameter(parameter) { return strictNullChecks && !isOptionalParameter(parameter) && !ts.isJSDocParameterTag(parameter) && parameter.initializer && !ts.hasModifier(parameter, 92) } function isOptionalUninitializedParameterProperty(parameter) { return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && ts.hasModifier(parameter, 92) } function getNodeCheckFlags(node) { return getNodeLinks(node).flags } function getEnumMemberValue(node) { return computeEnumMemberValues(node.parent), getNodeLinks(node).enumMemberValue } function canHaveConstantValue(node) { switch (node.kind) { case 272: case 184: case 185: return !0 }return !1 } function getConstantValue(node) { if (272 === node.kind) return getEnumMemberValue(node); var symbol = getNodeLinks(node).resolvedSymbol; return symbol && 8 & symbol.flags && ts.isConstEnumDeclaration(symbol.valueDeclaration.parent) ? getEnumMemberValue(symbol.valueDeclaration) : void 0 } function isFunctionType(type) { return 65536 & type.flags && getSignaturesOfType(type, 0).length > 0 } function getTypeReferenceSerializationKind(typeName, location) { if (typeName = ts.getParseTreeNode(typeName, ts.isEntityName), !typeName) return ts.TypeReferenceSerializationKind.Unknown; if (location && (location = ts.getParseTreeNode(location), !location)) return ts.TypeReferenceSerializationKind.Unknown; var valueSymbol = resolveEntityName(typeName, 67216319, !0, !1, location), typeSymbol = resolveEntityName(typeName, 67901928, !0, !1, location); if (valueSymbol && valueSymbol === typeSymbol) { var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(!1); if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) return ts.TypeReferenceSerializationKind.Promise; var constructorType = getTypeOfSymbol(valueSymbol); if (constructorType && isConstructorType(constructorType)) return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue } if (!typeSymbol) return ts.TypeReferenceSerializationKind.Unknown; var type = getDeclaredTypeOfSymbol(typeSymbol); return type === unknownType ? ts.TypeReferenceSerializationKind.Unknown : 1 & type.flags ? ts.TypeReferenceSerializationKind.ObjectType : isTypeAssignableToKind(type, 30720) ? ts.TypeReferenceSerializationKind.VoidNullableOrNeverType : isTypeAssignableToKind(type, 136) ? ts.TypeReferenceSerializationKind.BooleanType : isTypeAssignableToKind(type, 84) ? ts.TypeReferenceSerializationKind.NumberLikeType : isTypeAssignableToKind(type, 34) ? ts.TypeReferenceSerializationKind.StringLikeType : isTupleType(type) ? ts.TypeReferenceSerializationKind.ArrayLikeType : isTypeAssignableToKind(type, 1536) ? ts.TypeReferenceSerializationKind.ESSymbolType : isFunctionType(type) ? ts.TypeReferenceSerializationKind.TypeWithCallSignature : isArrayType(type) ? ts.TypeReferenceSerializationKind.ArrayLikeType : ts.TypeReferenceSerializationKind.ObjectType } function createTypeOfDeclaration(declaration, enclosingDeclaration, flags, tracker, addUndefined) { if (declaration = ts.getParseTreeNode(declaration, ts.isVariableLikeOrAccessor), !declaration) return ts.createToken(119); var symbol = getSymbolOfNode(declaration), type = !symbol || 133120 & symbol.flags ? unknownType : getWidenedLiteralType(getTypeOfSymbol(symbol)); return 1024 & type.flags && type.symbol === symbol && (flags |= 1048576), addUndefined && (type = getOptionalType(type)), nodeBuilder.typeToTypeNode(type, enclosingDeclaration, 1024 | flags, tracker) } function createReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, tracker) { if (signatureDeclaration = ts.getParseTreeNode(signatureDeclaration, ts.isFunctionLike), !signatureDeclaration) return ts.createToken(119); var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, 1024 | flags, tracker) } function createTypeOfExpression(expr, enclosingDeclaration, flags, tracker) { if (expr = ts.getParseTreeNode(expr, ts.isExpression), !expr) return ts.createToken(119); var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, 1024 | flags, tracker) } function hasGlobalName(name) { return globals.has(ts.escapeLeadingUnderscores(name)) } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; if (resolvedSymbol) return resolvedSymbol; var location = reference; if (startInDeclarationContainer) { var parent = reference.parent; ts.isDeclaration(parent) && reference === parent.name && (location = getDeclarationContainer(parent)) } return resolveName(location, reference.escapedText, 70362047, void 0, void 0, !0) } function getReferencedValueDeclaration(reference) { if (!ts.isGeneratedIdentifier(reference) && (reference = ts.getParseTreeNode(reference, ts.isIdentifier))) { var symbol = getReferencedValueSymbol(reference); if (symbol) return getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration } } function isLiteralConstDeclaration(node) { if (ts.isConst(node)) { var type = getTypeOfSymbol(getSymbolOfNode(node)); return !!(96 & type.flags && 8388608 & type.flags) } return !1 } function literalTypeToNode(type) { return ts.createLiteral(type.value) } function createLiteralConstValue(node) { var type = getTypeOfSymbol(getSymbolOfNode(node)); return literalTypeToNode(type) } function createResolver() { function isInHeritageClause(node) { return node.parent && 206 === node.parent.kind && node.parent.parent && 267 === node.parent.parent.kind } function getTypeReferenceDirectivesForEntityName(node) { if (fileToDirective) { var meaning = 67903464; (71 === node.kind && isInTypeQuery(node) || 184 === node.kind && !isInHeritageClause(node)) && (meaning = 68264895); var symbol = resolveEntityName(node, meaning, !0); return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : void 0 } } function getTypeReferenceDirectivesForSymbol(symbol, meaning) { if (fileToDirective && isSymbolFromTypeDeclarationFile(symbol)) { for (var typeReferenceDirectives, _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; if (decl.symbol && decl.symbol.flags & meaning) { var file_5 = ts.getSourceFileOfNode(decl), typeReferenceDirective = fileToDirective.get(file_5.path); if (!typeReferenceDirective) return; (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective) } } return typeReferenceDirectives } } function isSymbolFromTypeDeclarationFile(symbol) { if (!symbol.declarations) return !1; for (var current = symbol; ;) { var parent = getParentOfSymbol(current); if (!parent) break; current = parent } if (current.valueDeclaration && 273 === current.valueDeclaration.kind && 512 & current.flags) return !1; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i], file_6 = ts.getSourceFileOfNode(decl); if (fileToDirective.has(file_6.path)) return !0 } return !1 } var fileToDirective, resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); return resolvedTypeReferenceDirectives && (fileToDirective = ts.createMap(), resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (resolvedDirective && resolvedDirective.resolvedFileName) { var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key) } })), { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, isDeclarationWithCollidingName: isDeclarationWithCollidingName, isValueAliasDeclaration: function (node) { return node = ts.getParseTreeNode(node), !node || isValueAliasDeclaration(node) }, hasGlobalName: hasGlobalName, isReferencedAliasDeclaration: function (node, checkChildren) { return node = ts.getParseTreeNode(node), !node || isReferencedAliasDeclaration(node, checkChildren) }, getNodeCheckFlags: function (node) { return node = ts.getParseTreeNode(node), node ? getNodeCheckFlags(node) : void 0 }, isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, isRequiredInitializedParameter: isRequiredInitializedParameter, isOptionalUninitializedParameterProperty: isOptionalUninitializedParameterProperty, createTypeOfDeclaration: createTypeOfDeclaration, createReturnTypeOfSignatureDeclaration: createReturnTypeOfSignatureDeclaration, createTypeOfExpression: createTypeOfExpression, createLiteralConstValue: createLiteralConstValue, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: function (node) { return node = ts.getParseTreeNode(node, canHaveConstantValue), node ? getConstantValue(node) : void 0 }, collectLinkedAliases: collectLinkedAliases, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter, moduleExportsSomeValue: moduleExportsSomeValue, isArgumentsLocalBinding: isArgumentsLocalBinding, getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration, getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName, getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol, isLiteralConstDeclaration: isLiteralConstDeclaration, isLateBound: function (node) { node = ts.getParseTreeNode(node, ts.isDeclaration); var symbol = node && getSymbolOfNode(node); return !!(symbol && 1024 & ts.getCheckFlags(symbol)) }, getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity) : _jsxFactoryEntity }, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); var otherKind = 156 === accessor.kind ? 155 : 156, otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind), firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor, secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor, setAccessor = 156 === accessor.kind ? accessor : otherAccessor, getAccessor = 155 === accessor.kind ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, setAccessor: setAccessor, getAccessor: getAccessor } } } } function getExternalModuleFileFromDeclaration(declaration) { var specifier = 238 === declaration.kind ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration), moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, void 0); if (moduleSymbol) return ts.getDeclarationOfKind(moduleSymbol, 273) } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { var file_7 = _a[_i]; ts.bindSourceFile(file_7, compilerOptions) } for (var augmentations, _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file_8 = _c[_b]; if (ts.isExternalOrCommonJsModule(file_8) || mergeSymbolTable(globals, file_8.locals), file_8.patternAmbientModules && file_8.patternAmbientModules.length && (patternAmbientModules = ts.concatenate(patternAmbientModules, file_8.patternAmbientModules)), file_8.moduleAugmentations.length && (augmentations || (augmentations = [])).push(file_8.moduleAugmentations), file_8.symbol && file_8.symbol.globalExports) { var source = file_8.symbol.globalExports; source.forEach(function (sourceSymbol, id) { globals.has(id) || globals.set(id, sourceSymbol) }) } } if (augmentations) for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++)for (var list = augmentations_1[_d], _e = 0, list_1 = list; _e < list_1.length; _e++) { var augmentation = list_1[_e]; ts.isGlobalScopeAugmentation(augmentation.parent) && mergeModuleAugmentation(augmentation) } if (addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0), getSymbolLinks(undefinedSymbol).type = undefinedWideningType, getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", 0, !0), getSymbolLinks(unknownSymbol).type = unknownType, globalArrayType = getGlobalType("Array", 1, !0), globalObjectType = getGlobalType("Object", 0, !0), globalFunctionType = getGlobalType("Function", 0, !0), globalStringType = getGlobalType("String", 0, !0), globalNumberType = getGlobalType("Number", 0, !0), globalBooleanType = getGlobalType("Boolean", 0, !0), globalRegExpType = getGlobalType("RegExp", 0, !0), anyArrayType = createArrayType(anyType), autoArrayType = createArrayType(autoType), autoArrayType === emptyObjectType && (autoArrayType = createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0)), globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", 1), anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType, globalThisType = getGlobalTypeOrUndefined("ThisType", 1), augmentations) for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++)for (var list = augmentations_2[_f], _g = 0, list_2 = list; _g < list_2.length; _g++) { var augmentation = list_2[_g]; ts.isGlobalScopeAugmentation(augmentation.parent) || mergeModuleAugmentation(augmentation) } } function checkExternalEmitHelpers(location, helpers) { if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { var sourceFile = ts.getSourceFileOfNode(location); if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(4194304 & location.flags)) { var helpersModule = resolveHelpersModule(sourceFile, location); if (helpersModule !== unknownSymbol) for (var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers, helper = 1; helper <= 65536; helper <<= 1)if (uncheckedHelpers & helper) { var name = getHelperName(helper), symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 67216319); symbol || error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name) } requestedExternalEmitHelpers |= helpers } } } function getHelperName(helper) { switch (helper) { case 1: return "__extends"; case 2: return "__assign"; case 4: return "__rest"; case 8: return "__decorate"; case 16: return "__metadata"; case 32: return "__param"; case 64: return "__awaiter"; case 128: return "__generator"; case 256: return "__values"; case 512: return "__read"; case 1024: return "__spread"; case 2048: return "__await"; case 4096: return "__asyncGenerator"; case 8192: return "__asyncDelegator"; case 16384: return "__asyncValues"; case 32768: return "__exportStar"; case 65536: return "__makeTemplateObject"; default: ts.Debug.fail("Unrecognized helper") } } function resolveHelpersModule(node, errorNode) { return externalHelpersModule || (externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol), externalHelpersModule } function checkGrammarDecoratorsAndModifiers(node) { return checkGrammarDecorators(node) || checkGrammarModifiers(node) } function checkGrammarDecorators(node) { if (!node.decorators) return !1; if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) return 153 !== node.kind || ts.nodeIsPresent(node.body) ? grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here) : grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); if (155 === node.kind || 156 === node.kind) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name) } return !1 } function checkGrammarModifiers(node) { var quickResult = reportObviousModifierErrors(node); if (void 0 !== quickResult) return quickResult; for (var lastStatic, lastDeclare, lastAsync, lastReadonly, flags = 0, _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (132 !== modifier.kind) { if (150 === node.kind || 152 === node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); if (159 === node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)) } switch (modifier.kind) { case 76: if (237 !== node.kind && 234 === node.parent.kind) return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(76)); break; case 114: case 113: case 112: var text = visibilityToString(ts.modifierToFlag(modifier.kind)); if (28 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); if (32 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); if (64 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); if (256 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); if (239 === node.parent.kind || 273 === node.parent.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); if (128 & flags) return 112 === modifier.kind ? grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract") : grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract"); flags |= ts.modifierToFlag(modifier.kind); break; case 115: if (32 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); if (64 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); if (256 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); if (239 === node.parent.kind || 273 === node.parent.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); if (148 === node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); if (128 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); flags |= 32, lastStatic = modifier; break; case 132: if (64 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); if (151 !== node.kind && 150 !== node.kind && 159 !== node.kind && 148 !== node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); flags |= 64, lastReadonly = modifier; break; case 84: if (1 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); if (2 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); if (128 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); if (256 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); if (234 === node.parent.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); if (148 === node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); flags |= 1; break; case 79: var container = 273 === node.parent.kind ? node.parent : node.parent.parent; if (238 === container.kind && !ts.isAmbientModule(container)) return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); flags |= 512; break; case 124: if (2 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); if (256 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); if (234 === node.parent.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); if (148 === node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); if (4194304 & node.parent.flags && 239 === node.parent.kind) return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); flags |= 2, lastDeclare = modifier; break; case 117: if (128 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); if (234 !== node.kind) { if (153 !== node.kind && 151 !== node.kind && 155 !== node.kind && 156 !== node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); if (234 !== node.parent.kind || !ts.hasModifier(node.parent, 128)) return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); if (32 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); if (8 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract") } flags |= 128; break; case 120: if (256 & flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); if (2 & flags || 4194304 & node.parent.flags) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); if (148 === node.kind) return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); flags |= 256, lastAsync = modifier } } return 154 !== node.kind ? (243 === node.kind || 242 === node.kind) && 2 & flags ? grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare") : 148 === node.kind && 92 & flags && ts.isBindingPattern(node.name) ? grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern) : 148 === node.kind && 92 & flags && node.dotDotDotToken ? grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter) : 256 & flags ? checkGrammarAsyncModifier(node, lastAsync) : void 0 : 32 & flags ? grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static") : 128 & flags ? grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract") : 256 & flags ? grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async") : 64 & flags ? grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly") : void 0 } function reportObviousModifierErrors(node) { return !!node.modifiers && (shouldReportBadModifier(node) ? grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here) : void 0) } function shouldReportBadModifier(node) { switch (node.kind) { case 155: case 156: case 154: case 151: case 150: case 153: case 152: case 159: case 238: case 243: case 242: case 249: case 248: case 191: case 192: case 148: return !1; default: if (239 === node.parent.kind || 273 === node.parent.kind) return !1; switch (node.kind) { case 233: return nodeHasAnyModifiersExcept(node, 120); case 234: return nodeHasAnyModifiersExcept(node, 117); case 235: case 213: case 236: return !0; case 237: return nodeHasAnyModifiersExcept(node, 76); default: return ts.Debug.fail(), !1 } } } function nodeHasAnyModifiersExcept(node, allowedModifier) { return node.modifiers.length > 1 || node.modifiers[0].kind !== allowedModifier } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 153: case 233: case 191: case 192: return !1 }return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async") } function checkGrammarForDisallowedTrailingComma(list, diag) { if (void 0 === diag && (diag = ts.Diagnostics.Trailing_comma_not_allowed), list && list.hasTrailingComma) return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag) } function checkGrammarTypeParameterList(typeParameters, file) { if (typeParameters && 0 === typeParameters.length) { var start = typeParameters.pos - "<".length, end = ts.skipTrivia(file.text, typeParameters.end) + ">".length; return grammarErrorAtPos(file, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty) } } function checkGrammarParameterList(parameters) { for (var seenOptionalParameter = !1, parameterCount = parameters.length, i = 0; i < parameterCount; i++) { var parameter = parameters[i]; if (parameter.dotDotDotToken) { if (i !== parameterCount - 1) return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); if (4194304 & parameter.flags || checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma), ts.isBindingPattern(parameter.name)) return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); if (parameter.questionToken) return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional); if (parameter.initializer) return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer) } else if (parameter.questionToken) { if (seenOptionalParameter = !0, parameter.initializer) return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer) } else if (seenOptionalParameter && !parameter.initializer) return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter) } } function checkGrammarFunctionLikeDeclaration(node) { var file = ts.getSourceFileOfNode(node); return checkGrammarDecoratorsAndModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file) } function checkGrammarClassLikeDeclaration(node) { var file = ts.getSourceFileOfNode(node); return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file) } function checkGrammarArrowFunction(node, file) { if (!ts.isArrowFunction(node)) return !1; var equalsGreaterThanToken = node.equalsGreaterThanToken, startLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line, endLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line; return startLine !== endLine && grammarErrorOnNode(equalsGreaterThanToken, ts.Diagnostics.Line_terminator_not_permitted_before_arrow) } function checkGrammarIndexSignatureParameters(node) { var parameter = node.parameters[0]; if (1 !== node.parameters.length) return parameter ? grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter) : grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); if (parameter.dotDotDotToken) return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); if (ts.hasModifiers(parameter)) return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); if (parameter.questionToken) return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); if (parameter.initializer) return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); if (!parameter.type) return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); if (137 !== parameter.type.kind && 134 !== parameter.type.kind) { var type = getTypeFromTypeNode(parameter.type); return 2 & type.flags || 4 & type.flags ? grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type))) : 131072 & type.flags && allTypesAssignableToKind(type, 32, !0) ? grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead) : grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number) } return node.type ? void 0 : grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation) } function checkGrammarIndexSignature(node) { return checkGrammarDecoratorsAndModifiers(node) || checkGrammarIndexSignatureParameters(node) } function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { if (typeArguments && 0 === typeArguments.length) { var sourceFile = ts.getSourceFileOfNode(node), start = typeArguments.pos - "<".length, end = ts.skipTrivia(sourceFile.text, typeArguments.end) + ">".length; return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty) } } function checkGrammarTypeArguments(node, typeArguments) { return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments) } function checkGrammarForOmittedArgument(args) { if (args) for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { var arg = args_5[_i]; if (205 === arg.kind) return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected) } } function checkGrammarArguments(args) { return checkGrammarForOmittedArgument(args) } function checkGrammarHeritageClause(node) { var types = node.types; if (checkGrammarForDisallowedTrailingComma(types)) return !0; if (types && 0 === types.length) { var listType = ts.tokenToString(node.token); return grammarErrorAtPos(node, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType); } return ts.forEach(types, checkGrammarExpressionWithTypeArguments) } function checkGrammarExpressionWithTypeArguments(node) { return checkGrammarTypeArguments(node, node.typeArguments) } function checkGrammarClassDeclarationHeritageClauses(node) { var seenExtendsClause = !1, seenImplementsClause = !1; if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (85 === heritageClause.token) { if (seenExtendsClause) return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); if (seenImplementsClause) return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause); if (heritageClause.types.length > 1) return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class); seenExtendsClause = !0 } else { if (ts.Debug.assert(108 === heritageClause.token), seenImplementsClause) return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); seenImplementsClause = !0 } checkGrammarHeritageClause(heritageClause) } } function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = !1; if (node.heritageClauses) for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; if (85 !== heritageClause.token) return ts.Debug.assert(108 === heritageClause.token), grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); if (seenExtendsClause) return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); seenExtendsClause = !0, checkGrammarHeritageClause(heritageClause) } return !1 } function checkGrammarComputedPropertyName(node) { if (146 !== node.kind) return !1; var computedPropertyName = node; return 199 === computedPropertyName.expression.kind && 26 === computedPropertyName.expression.operatorToken.kind ? grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name) : void 0 } function checkGrammarForGenerator(node) { if (node.asteriskToken) { if (ts.Debug.assert(233 === node.kind || 191 === node.kind || 153 === node.kind), 4194304 & node.flags) return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); if (!node.body) return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator) } } function checkGrammarForInvalidQuestionMark(questionToken, message) { if (questionToken) return grammarErrorOnNode(questionToken, message) } function checkGrammarObjectLiteralExpression(node, inDestructuring) { var Flags; !function (Flags) { Flags[Flags.Property = 1] = "Property", Flags[Flags.GetAccessor = 2] = "GetAccessor", Flags[Flags.SetAccessor = 4] = "SetAccessor", Flags[Flags.GetOrSetAccessor = 6] = "GetOrSetAccessor" }(Flags || (Flags = {})); for (var seen = ts.createUnderscoreEscapedMap(), _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; if (271 !== prop.kind) { var name = prop.name; if (146 === name.kind && checkGrammarComputedPropertyName(name), 270 === prop.kind && !inDestructuring && prop.objectAssignmentInitializer) return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); if (prop.modifiers) for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; 120 === mod.kind && 153 === prop.kind || grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)) } var currentKind = void 0; switch (prop.kind) { case 269: case 270: checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional), 8 === name.kind && checkGrammarNumericLiteral(name); case 153: currentKind = 1; break; case 155: currentKind = 2; break; case 156: currentKind = 4; break; default: ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind) }var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (void 0 !== effectiveName) { var existingKind = seen.get(effectiveName); if (existingKind) if (1 === currentKind && 1 === existingKind) grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); else { if (!(6 & currentKind && 6 & existingKind)) return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); if (6 === existingKind || currentKind === existingKind) return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); seen.set(effectiveName, currentKind | existingKind) } else seen.set(effectiveName, currentKind) } } } } function checkGrammarJsxElement(node) { checkGrammarTypeArguments(node, node.typeArguments); for (var seen = ts.createUnderscoreEscapedMap(), _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; if (263 !== attr.kind) { var name = attr.name, initializer = attr.initializer; if (seen.get(name.escapedText)) return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); if (seen.set(name.escapedText, !0), initializer && 264 === initializer.kind && !initializer.expression) return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression) } } } function checkGrammarForInOrForOfStatement(forInOrOfStatement) { if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) return !0; if (221 === forInOrOfStatement.kind && forInOrOfStatement.awaitModifier && 0 === (16384 & forInOrOfStatement.flags)) return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); if (232 === forInOrOfStatement.initializer.kind) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; if (!declarations.length) return !1; if (declarations.length > 1) { var diagnostic = 220 === forInOrOfStatement.kind ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic) } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { var diagnostic = 220 === forInOrOfStatement.kind ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic) } if (firstDeclaration.type) { var diagnostic = 220 === forInOrOfStatement.kind ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic) } } } return !1 } function checkGrammarAccessor(accessor) { var kind = accessor.kind; if (languageVersion < 1) return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); if (4194304 & accessor.flags) return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); if (void 0 === accessor.body && !ts.hasModifier(accessor, 128)) return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); if (accessor.body && ts.hasModifier(accessor, 128)) return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); if (accessor.typeParameters) return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); if (!doesAccessorHaveCorrectParameterCount(accessor)) return grammarErrorOnNode(accessor.name, 155 === kind ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); if (156 === kind) { if (accessor.type) return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); var parameter = accessor.parameters[0]; if (parameter.dotDotDotToken) return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); if (parameter.questionToken) return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); if (parameter.initializer) return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer) } } function doesAccessorHaveCorrectParameterCount(accessor) { return getAccessorThisParameter(accessor) || accessor.parameters.length === (155 === accessor.kind ? 0 : 1) } function getAccessorThisParameter(accessor) { if (accessor.parameters.length === (155 === accessor.kind ? 1 : 2)) return ts.getThisParameter(accessor) } function checkGrammarTypeOperatorNode(node) { if (141 === node.operator) { if (138 !== node.type.kind) return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(138)); var parent = ts.walkUpParenthesizedTypes(node.parent); switch (parent.kind) { case 231: var decl = parent; if (71 !== decl.name.kind) return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); if (!ts.isVariableDeclarationInVariableStatement(decl)) return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement); if (!(2 & decl.parent.flags)) return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); break; case 151: if (!ts.hasModifier(parent, 32) || !ts.hasModifier(parent, 64)) return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); break; case 150: if (!ts.hasModifier(parent, 64)) return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); break; default: return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here) } } } function checkGrammarForInvalidDynamicName(node, message) { if (isNonBindableDynamicName(node)) return grammarErrorOnNode(node, message) } function checkGrammarMethod(node) { if (checkGrammarFunctionLikeDeclaration(node)) return !0; if (153 === node.kind) { if (183 === node.parent.kind) { if (node.modifiers && (1 !== node.modifiers.length || 120 !== ts.first(node.modifiers).kind)) return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) return !0; if (void 0 === node.body) return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{") } if (checkGrammarForGenerator(node)) return !0 } if (ts.isClassLike(node.parent)) { if (4194304 & node.flags) return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); if (153 === node.kind && !node.body) return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type) } else { if (235 === node.parent.kind) return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); if (165 === node.parent.kind) return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type) } } function checkGrammarBreakOrContinueStatement(node) { for (var current = node; current;) { if (ts.isFunctionLike(current)) return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); switch (current.kind) { case 227: if (node.label && current.label.escapedText === node.label.escapedText) { var isMisplacedContinueLabel = 222 === node.kind && !ts.isIterationStatement(current.statement, !0); return !!isMisplacedContinueLabel && grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement) } break; case 226: if (223 === node.kind && !node.label) return !1; break; default: if (ts.isIterationStatement(current, !1) && !node.label) return !1 }current = current.parent } if (node.label) { var message = 223 === node.kind ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message) } var message = 223 === node.kind ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message) } function checkGrammarBindingElement(node) { if (node.dotDotDotToken) { var elements = node.parent.elements; if (node !== ts.last(elements)) return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); if (checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma), 180 === node.name.kind || 179 === node.name.kind) return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); if (node.propertyName) return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_have_a_property_name); if (node.initializer) return grammarErrorAtPos(node, node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer) } } function isStringOrNumberLiteralExpression(expr) { return 9 === expr.kind || 8 === expr.kind || 197 === expr.kind && 38 === expr.operator && 8 === expr.operand.kind } function checkGrammarVariableDeclaration(node) { if (220 !== node.parent.parent.kind && 221 !== node.parent.parent.kind) if (4194304 & node.flags) { if (node.initializer) { if (!ts.isConst(node) || node.type) { var equalsTokenLength = "=".length; return grammarErrorAtPos(node, node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts) } if (!isStringOrNumberLiteralExpression(node.initializer)) return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal) } if (node.initializer && (!ts.isConst(node) || !isStringOrNumberLiteralExpression(node.initializer))) { var equalsTokenLength = "=".length; return grammarErrorAtPos(node, node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts) } } else if (!node.initializer) { if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer); if (ts.isConst(node)) return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized) } if (node.exclamationToken && (213 !== node.parent.parent.kind || !node.type || node.initializer || 4194304 & node.flags)) return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); compilerOptions.module === ts.ModuleKind.ES2015 || compilerOptions.module === ts.ModuleKind.ESNext || compilerOptions.module === ts.ModuleKind.System || compilerOptions.noEmit || 4194304 & node.parent.parent.flags || !ts.hasModifier(node.parent.parent, 1) || checkESModuleMarker(node.name); var checkLetConstNames = ts.isLet(node) || ts.isConst(node); return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name) } function checkESModuleMarker(name) { if (71 === name.kind) { if ("__esModule" === ts.idText(name)) return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules) } else for (var elements = name.elements, _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var element = elements_1[_i]; if (!ts.isOmittedExpression(element)) return checkESModuleMarker(element.name) } } function checkGrammarNameInLetOrConstDeclarations(name) { if (71 === name.kind) { if (110 === name.originalKeywordKind) return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations) } else for (var elements = name.elements, _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { var element = elements_2[_i]; ts.isOmittedExpression(element) || checkGrammarNameInLetOrConstDeclarations(element.name) } } function checkGrammarVariableDeclarationList(declarationList) { var declarations = declarationList.declarations; return !!checkGrammarForDisallowedTrailingComma(declarationList.declarations) || (declarationList.declarations.length ? void 0 : grammarErrorAtPos(declarationList, declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty)) } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { case 216: case 217: case 218: case 225: case 219: case 220: case 221: return !1; case 227: return allowLetAndConstDeclarations(parent.parent) }return !0 } function checkGrammarForDisallowedLetOrConstStatement(node) { if (!allowLetAndConstDeclarations(node.parent)) { if (ts.isLet(node.declarationList)) return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block); if (ts.isConst(node.declarationList)) return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block) } } function checkGrammarMetaProperty(node) { var escapedText = node.name.escapedText; switch (node.keywordToken) { case 94: if ("target" !== escapedText) return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target"); break; case 91: if ("meta" !== escapedText) return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta") } } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0 } function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); return diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2)), !0 } } function grammarErrorAtPos(nodeForSourceFile, start, length, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(nodeForSourceFile); if (!hasParseDiagnostics(sourceFile)) return diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)), !0 } function grammarErrorOnNode(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) return diagnostics.add(ts.createDiagnosticForNode(node, message, arg0, arg1, arg2)), !0 } function checkGrammarConstructorTypeParameters(node) { var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); if (ts.isNodeArray(typeParameters)) { var pos = typeParameters.pos, end = typeParameters.end; return grammarErrorAtPos(node, pos, end - pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration) } } function checkGrammarConstructorTypeAnnotation(node) { var type = ts.getEffectiveReturnTypeNode(node); if (type) return grammarErrorOnNode(type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration) } function checkGrammarProperty(node) { if (ts.isClassLike(node.parent)) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) return !0 } else if (235 === node.parent.kind) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) return !0; if (node.initializer) return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer) } else if (165 === node.parent.kind) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) return !0; if (node.initializer) return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer) } return 4194304 & node.flags && node.initializer ? grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts) : ts.isPropertyDeclaration(node) && node.exclamationToken && (!ts.isClassLike(node.parent) || !node.type || node.initializer || 4194304 & node.flags || ts.hasModifier(node, 160)) ? grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context) : void 0 } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { return 235 !== node.kind && 236 !== node.kind && 243 !== node.kind && 242 !== node.kind && 249 !== node.kind && 248 !== node.kind && 241 !== node.kind && !ts.hasModifier(node, 515) && grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file) } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; if ((ts.isDeclaration(decl) || 213 === decl.kind) && checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) return !0 } } function checkGrammarSourceFile(node) { return !!(4194304 & node.flags) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node) } function checkGrammarStatementInAmbientContext(node) { if (4194304 & node.flags) { if (ts.isAccessor(node.parent)) return getNodeLinks(node).hasReportedStatementInAmbientContext = !0; var links = getNodeLinks(node); if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); if (212 === node.parent.kind || 239 === node.parent.kind || 273 === node.parent.kind) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts) } } } function checkGrammarNumericLiteral(node) { if (32 & node.numericLiteralFlags) { var diagnosticMessage = void 0; if (languageVersion >= 1 ? diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0 : ts.isChildOfNodeWithKind(node, 177) ? diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0 : ts.isChildOfNodeWithKind(node, 272) && (diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0), diagnosticMessage) { var withMinus = ts.isPrefixUnaryExpression(node.parent) && 38 === node.parent.operator, literal = (withMinus ? "-" : "") + "0o" + node.text; return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal) } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); return diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), 0, message, arg0, arg1, arg2)), !0 } } function getAmbientModules() { return ambientModulesCache || (ambientModulesCache = [], globals.forEach(function (global, sym) { ambientModuleSymbolRegex.test(sym) && ambientModulesCache.push(global) })), ambientModulesCache } function checkGrammarImportCallExpression(node) { if (moduleKind === ts.ModuleKind.ES2015) return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext); if (node.typeArguments) return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments); var nodeArguments = node.arguments; return 1 !== nodeArguments.length ? grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_must_have_one_specifier_as_an_argument) : ts.isSpreadElement(nodeArguments[0]) ? grammarErrorOnNode(nodeArguments[0], ts.Diagnostics.Specifier_of_dynamic_import_cannot_be_spread_element) : void 0 } var cancellationToken, requestedExternalEmitHelpers, externalHelpersModule, Symbol = ts.objectAllocator.getSymbolConstructor(), Type = ts.objectAllocator.getTypeConstructor(), Signature = ts.objectAllocator.getSignatureConstructor(), typeCount = 0, symbolCount = 0, enumCount = 0, symbolInstantiationDepth = 0, emptySymbols = ts.createSymbolTable(), identityMapper = ts.identity, compilerOptions = host.getCompilerOptions(), languageVersion = ts.getEmitScriptTarget(compilerOptions), moduleKind = ts.getEmitModuleKind(compilerOptions), allowSyntheticDefaultImports = ts.getAllowSyntheticDefaultImports(compilerOptions), strictNullChecks = ts.getStrictOptionValue(compilerOptions, "strictNullChecks"), strictFunctionTypes = ts.getStrictOptionValue(compilerOptions, "strictFunctionTypes"), strictPropertyInitialization = ts.getStrictOptionValue(compilerOptions, "strictPropertyInitialization"), noImplicitAny = ts.getStrictOptionValue(compilerOptions, "noImplicitAny"), noImplicitThis = ts.getStrictOptionValue(compilerOptions, "noImplicitThis"), keyofStringsOnly = !!compilerOptions.keyofStringsOnly, emitResolver = createResolver(), nodeBuilder = createNodeBuilder(), undefinedSymbol = createSymbol(4, "undefined"); undefinedSymbol.declarations = []; var apparentArgumentCount, argumentsSymbol = createSymbol(4, "arguments"), requireSymbol = createSymbol(4, "require"), moduleSymbol = createSymbol(4, "module"), checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount") }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount") }, getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount }, getTypeCount: function () { return typeCount }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol }, getMergedSymbol: getMergedSymbol, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: function (symbol, location) { return location = ts.getParseTreeNode(location), location ? getTypeOfSymbolAtLocation(symbol, location) : unknownType }, getSymbolsOfParameterPropertyDeclaration: function (parameter, parameterName) { return parameter = ts.getParseTreeNode(parameter, ts.isParameter), ts.Debug.assert(void 0 !== parameter, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."), getSymbolsOfParameterPropertyDeclaration(parameter, ts.escapeLeadingUnderscores(parameterName)) }, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: function (type, name) { return getPropertyOfType(type, ts.escapeLeadingUnderscores(name)) }, getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getBaseTypeOfLiteralType: getBaseTypeOfLiteralType, getWidenedType: getWidenedType, getTypeFromTypeNode: function (node) { return node = ts.getParseTreeNode(node, ts.isTypeNode), node ? getTypeFromTypeNode(node) : unknownType }, getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNullableType: getNullableType, getNonNullableType: getNonNullableType, typeToTypeNode: nodeBuilder.typeToTypeNode, indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, getSymbolsInScope: function (location, meaning) { return location = ts.getParseTreeNode(location), location ? getSymbolsInScope(location, meaning) : [] }, getSymbolAtLocation: function (node) { return node = ts.getParseTreeNode(node), node ? getSymbolAtLocation(node) : void 0 }, getShorthandAssignmentValueSymbol: function (node) { return node = ts.getParseTreeNode(node), node ? getShorthandAssignmentValueSymbol(node) : void 0 }, getExportSpecifierLocalTargetSymbol: function (node) { return node = ts.getParseTreeNode(node, ts.isExportSpecifier), node ? getExportSpecifierLocalTargetSymbol(node) : void 0 }, getExportSymbolOfSymbol: function (symbol) { return getMergedSymbol(symbol.exportSymbol || symbol) }, getTypeAtLocation: function (node) { return node = ts.getParseTreeNode(node), node ? getTypeOfNode(node) : unknownType }, getPropertySymbolOfDestructuringAssignment: function (location) { return location = ts.getParseTreeNode(location, ts.isIdentifier), location ? getPropertySymbolOfDestructuringAssignment(location) : void 0 }, signatureToString: function (signature, enclosingDeclaration, flags, kind) { return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind) }, typeToString: function (type, enclosingDeclaration, flags) { return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags) }, symbolToString: function (symbol, enclosingDeclaration, meaning, flags) { return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning, flags) }, typePredicateToString: function (predicate, enclosingDeclaration, flags) { return typePredicateToString(predicate, ts.getParseTreeNode(enclosingDeclaration), flags) }, writeSignature: function (signature, enclosingDeclaration, flags, kind, writer) { return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind, writer) }, writeType: function (type, enclosingDeclaration, flags, writer) { return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags, writer) }, writeSymbol: function (symbol, enclosingDeclaration, meaning, flags, writer) { return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning, flags, writer) }, writeTypePredicate: function (predicate, enclosingDeclaration, flags, writer) { return typePredicateToString(predicate, ts.getParseTreeNode(enclosingDeclaration), flags, writer) }, getSymbolDisplayBuilder: getSymbolDisplayBuilder, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, getContextualType: function (node) { return node = ts.getParseTreeNode(node, ts.isExpression), node ? getContextualType(node) : void 0 }, getContextualTypeForArgumentAtIndex: function (node, argIndex) { return node = ts.getParseTreeNode(node, ts.isCallLikeExpression), node && getContextualTypeForArgumentAtIndex(node, argIndex) }, getContextualTypeForJsxAttribute: function (node) { return node = ts.getParseTreeNode(node, ts.isJsxAttributeLike), node && getContextualTypeForJsxAttribute(node) }, isContextSensitive: isContextSensitive, getFullyQualifiedName: getFullyQualifiedName, getResolvedSignature: function (node, candidatesOutArray, theArgumentCount) { node = ts.getParseTreeNode(node, ts.isCallLikeExpression), apparentArgumentCount = theArgumentCount; var res = node ? getResolvedSignature(node, candidatesOutArray) : void 0; return apparentArgumentCount = void 0, res }, getConstantValue: function (node) { return node = ts.getParseTreeNode(node, canHaveConstantValue), node ? getConstantValue(node) : void 0 }, isValidPropertyAccess: function (node, propertyName) { return node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode), !!node && isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName)) }, isValidPropertyAccessForCompletions: function (node, type, property) { return node = ts.getParseTreeNode(node, ts.isPropertyAccessExpression), !!node && isValidPropertyAccessForCompletions(node, type, property) }, getSignatureFromDeclaration: function (declaration) { return declaration = ts.getParseTreeNode(declaration, ts.isFunctionLike), declaration ? getSignatureFromDeclaration(declaration) : void 0 }, isImplementationOfOverload: function (node) { var parsed = ts.getParseTreeNode(node, ts.isFunctionLike); return parsed ? isImplementationOfOverload(parsed) : void 0 }, getImmediateAliasedSymbol: function (symbol) { ts.Debug.assert(0 !== (2097152 & symbol.flags), "Should only get Alias here."); var links = getSymbolLinks(symbol); if (!links.immediateTarget) { var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node), links.immediateTarget = getTargetOfAliasDeclaration(node, !0) } return links.immediateTarget; }, getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getSymbolWalker: ts.createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getIndexTypeOfStructuredType, getConstraintFromTypeParameter, getFirstIdentifier), getAmbientModules: getAmbientModules, getAllAttributesTypeFromJsxOpeningLikeElement: function (node) { return node = ts.getParseTreeNode(node, ts.isJsxOpeningLikeElement), node ? getAllAttributesTypeFromJsxOpeningLikeElement(node) : void 0 }, getJsxIntrinsicTagNamesAt: getJsxIntrinsicTagNamesAt, isOptionalParameter: function (node) { return node = ts.getParseTreeNode(node, ts.isParameter), !!node && isOptionalParameter(node) }, tryGetMemberInModuleExports: function (name, symbol) { return tryGetMemberInModuleExports(ts.escapeLeadingUnderscores(name), symbol) }, tryGetMemberInModuleExportsAndProperties: function (name, symbol) { return tryGetMemberInModuleExportsAndProperties(ts.escapeLeadingUnderscores(name), symbol) }, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, !1) }, getApparentType: getApparentType, getUnionType: getUnionType, createAnonymousType: createAnonymousType, createSignature: createSignature, createSymbol: createSymbol, createIndexInfo: createIndexInfo, getAnyType: function () { return anyType }, getStringType: function () { return stringType }, getNumberType: function () { return numberType }, createPromiseType: createPromiseType, createArrayType: createArrayType, getBooleanType: function () { return booleanType }, getVoidType: function () { return voidType }, getUndefinedType: function () { return undefinedType }, getNullType: function () { return nullType }, getESSymbolType: function () { return esSymbolType }, getNeverType: function () { return neverType }, isSymbolAccessible: isSymbolAccessible, isArrayLikeType: isArrayLikeType, getAllPossiblePropertiesOfTypes: getAllPossiblePropertiesOfTypes, getSuggestionForNonexistentProperty: function (node, type) { return getSuggestionForNonexistentProperty(node, type) }, getSuggestionForNonexistentSymbol: function (location, name, meaning) { return getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning) }, getSuggestionForNonexistentModule: function (node, target) { return getSuggestionForNonexistentModule(node, target) }, getBaseConstraintOfType: getBaseConstraintOfType, getDefaultFromTypeParameter: function (type) { return type && 32768 & type.flags ? getDefaultFromTypeParameter(type) : void 0 }, resolveName: function (name, location, meaning, excludeGlobals) { return resolveName(location, ts.escapeLeadingUnderscores(name), meaning, void 0, void 0, !1, excludeGlobals) }, getJsxNamespace: function (n) { return ts.unescapeLeadingUnderscores(getJsxNamespace(n)) }, getAccessibleSymbolChain: getAccessibleSymbolChain, getTypePredicateOfSignature: getTypePredicateOfSignature, resolveExternalModuleSymbol: resolveExternalModuleSymbol, tryGetThisTypeAt: function (node) { return node = ts.getParseTreeNode(node), node && tryGetThisTypeAt(node) }, getTypeArgumentConstraint: function (node) { return node = ts.getParseTreeNode(node, ts.isTypeNode), node && getTypeArgumentConstraint(node) }, getSuggestionDiagnostics: function (file) { function getUnusedDiagnostics() { if (file.isDeclarationFile) return ts.emptyArray; checkSourceFile(file); var diagnostics = []; return ts.Debug.assert(!!(1 & getNodeLinks(file).flags)), checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (kind, diag) { unusedIsError(kind) || diagnostics.push(__assign({}, diag, { category: ts.DiagnosticCategory.Suggestion })) }), diagnostics } return (suggestionDiagnostics.get(file.fileName) || ts.emptyArray).concat(getUnusedDiagnostics()) }, runWithCancellationToken: function (token, callback) { try { return cancellationToken = token, callback(checker) } finally { cancellationToken = void 0 } } }, tupleTypes = [], unionTypes = ts.createMap(), intersectionTypes = ts.createMap(), literalTypes = ts.createMap(), indexedAccessTypes = ts.createMap(), evolvingArrayTypes = [], undefinedProperties = ts.createMap(), unknownSymbol = createSymbol(4, "unknown"), resolvingSymbol = createSymbol(0, "__resolving__"), anyType = createIntrinsicType(1, "any"), autoType = createIntrinsicType(1, "any"), wildcardType = createIntrinsicType(1, "any"), unknownType = createIntrinsicType(1, "unknown"), undefinedType = createIntrinsicType(4096, "undefined"), undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(16781312, "undefined"), nullType = createIntrinsicType(8192, "null"), nullWideningType = strictNullChecks ? nullType : createIntrinsicType(16785408, "null"), stringType = createIntrinsicType(2, "string"), numberType = createIntrinsicType(4, "number"), trueType = createIntrinsicType(128, "true"), falseType = createIntrinsicType(128, "false"), booleanType = createBooleanType([trueType, falseType]), esSymbolType = createIntrinsicType(512, "symbol"), voidType = createIntrinsicType(2048, "void"), neverType = createIntrinsicType(16384, "never"), silentNeverType = createIntrinsicType(16384, "never"), implicitNeverType = createIntrinsicType(16384, "never"), nonPrimitiveType = createIntrinsicType(134217728, "object"), stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]), keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType, emptyObjectType = createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0), emptyTypeLiteralSymbol = createSymbol(2048, "__type"); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0), emptyGenericType = createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0); emptyGenericType.instantiations = ts.createMap(); var anyFunctionType = createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0); anyFunctionType.flags |= 67108864; var noConstraintType = createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0), circularConstraintType = createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0), resolvingDefaultType = createAnonymousType(void 0, emptySymbols, ts.emptyArray, ts.emptyArray, void 0, void 0), markerSuperType = createType(32768), markerSubType = createType(32768); markerSubType.constraint = markerSuperType; var ambientModulesCache, patternAmbientModules, globalObjectType, globalFunctionType, globalArrayType, globalReadonlyArrayType, globalStringType, globalNumberType, globalBooleanType, globalRegExpType, globalThisType, anyArrayType, autoArrayType, anyReadonlyArrayType, deferredGlobalNonNullableTypeAlias, deferredGlobalESSymbolConstructorSymbol, deferredGlobalESSymbolType, deferredGlobalTypedPropertyDescriptorType, deferredGlobalPromiseType, deferredGlobalPromiseConstructorSymbol, deferredGlobalPromiseConstructorLikeType, deferredGlobalIterableType, deferredGlobalIteratorType, deferredGlobalIterableIteratorType, deferredGlobalAsyncIterableType, deferredGlobalAsyncIteratorType, deferredGlobalAsyncIterableIteratorType, deferredGlobalTemplateStringsArrayType, deferredGlobalImportMetaType, deferredGlobalExtractSymbol, deferredNodes, TypeFacts, markerOtherType = createType(32768), noTypePredicate = createIdentifierTypePredicate("<>", 0, anyType), anySignature = createSignature(void 0, void 0, void 0, ts.emptyArray, anyType, void 0, 0, !1, !1), unknownSignature = createSignature(void 0, void 0, void 0, ts.emptyArray, unknownType, void 0, 0, !1, !1), resolvingSignature = createSignature(void 0, void 0, void 0, ts.emptyArray, anyType, void 0, 0, !1, !1), silentNeverSignature = createSignature(void 0, void 0, void 0, ts.emptyArray, silentNeverType, void 0, 0, !1, !1), resolvingSignaturesArray = [resolvingSignature], enumNumberIndexInfo = createIndexInfo(stringType, !0), jsObjectLiteralIndexInfo = createIndexInfo(anyType, !1), globals = ts.createSymbolTable(), reverseMappedCache = ts.createMap(), allPotentiallyUnusedIdentifiers = ts.createMap(), flowLoopStart = 0, flowLoopCount = 0, sharedFlowCount = 0, flowAnalysisDisabled = !1, emptyStringType = getLiteralType(""), zeroType = getLiteralType(0), resolutionTargets = [], resolutionResults = [], resolutionPropertyNames = [], suggestionCount = 0, maximumSuggestionCount = 10, mergedSymbols = [], symbolLinks = [], nodeLinks = [], flowLoopCaches = [], flowLoopNodes = [], flowLoopKeys = [], flowLoopTypes = [], sharedFlowNodes = [], sharedFlowTypes = [], potentialThisCollisions = [], potentialNewTargetCollisions = [], awaitedTypeStack = [], diagnostics = ts.createDiagnosticCollection(), suggestionDiagnostics = ts.createMultiMap(); !function (TypeFacts) { TypeFacts[TypeFacts.None = 0] = "None", TypeFacts[TypeFacts.TypeofEQString = 1] = "TypeofEQString", TypeFacts[TypeFacts.TypeofEQNumber = 2] = "TypeofEQNumber", TypeFacts[TypeFacts.TypeofEQBoolean = 4] = "TypeofEQBoolean", TypeFacts[TypeFacts.TypeofEQSymbol = 8] = "TypeofEQSymbol", TypeFacts[TypeFacts.TypeofEQObject = 16] = "TypeofEQObject", TypeFacts[TypeFacts.TypeofEQFunction = 32] = "TypeofEQFunction", TypeFacts[TypeFacts.TypeofEQHostObject = 64] = "TypeofEQHostObject", TypeFacts[TypeFacts.TypeofNEString = 128] = "TypeofNEString", TypeFacts[TypeFacts.TypeofNENumber = 256] = "TypeofNENumber", TypeFacts[TypeFacts.TypeofNEBoolean = 512] = "TypeofNEBoolean", TypeFacts[TypeFacts.TypeofNESymbol = 1024] = "TypeofNESymbol", TypeFacts[TypeFacts.TypeofNEObject = 2048] = "TypeofNEObject", TypeFacts[TypeFacts.TypeofNEFunction = 4096] = "TypeofNEFunction", TypeFacts[TypeFacts.TypeofNEHostObject = 8192] = "TypeofNEHostObject", TypeFacts[TypeFacts.EQUndefined = 16384] = "EQUndefined", TypeFacts[TypeFacts.EQNull = 32768] = "EQNull", TypeFacts[TypeFacts.EQUndefinedOrNull = 65536] = "EQUndefinedOrNull", TypeFacts[TypeFacts.NEUndefined = 131072] = "NEUndefined", TypeFacts[TypeFacts.NENull = 262144] = "NENull", TypeFacts[TypeFacts.NEUndefinedOrNull = 524288] = "NEUndefinedOrNull", TypeFacts[TypeFacts.Truthy = 1048576] = "Truthy", TypeFacts[TypeFacts.Falsy = 2097152] = "Falsy", TypeFacts[TypeFacts.All = 4194303] = "All", TypeFacts[TypeFacts.BaseStringStrictFacts = 933633] = "BaseStringStrictFacts", TypeFacts[TypeFacts.BaseStringFacts = 3145473] = "BaseStringFacts", TypeFacts[TypeFacts.StringStrictFacts = 4079361] = "StringStrictFacts", TypeFacts[TypeFacts.StringFacts = 4194049] = "StringFacts", TypeFacts[TypeFacts.EmptyStringStrictFacts = 3030785] = "EmptyStringStrictFacts", TypeFacts[TypeFacts.EmptyStringFacts = 3145473] = "EmptyStringFacts", TypeFacts[TypeFacts.NonEmptyStringStrictFacts = 1982209] = "NonEmptyStringStrictFacts", TypeFacts[TypeFacts.NonEmptyStringFacts = 4194049] = "NonEmptyStringFacts", TypeFacts[TypeFacts.BaseNumberStrictFacts = 933506] = "BaseNumberStrictFacts", TypeFacts[TypeFacts.BaseNumberFacts = 3145346] = "BaseNumberFacts", TypeFacts[TypeFacts.NumberStrictFacts = 4079234] = "NumberStrictFacts", TypeFacts[TypeFacts.NumberFacts = 4193922] = "NumberFacts", TypeFacts[TypeFacts.ZeroStrictFacts = 3030658] = "ZeroStrictFacts", TypeFacts[TypeFacts.ZeroFacts = 3145346] = "ZeroFacts", TypeFacts[TypeFacts.NonZeroStrictFacts = 1982082] = "NonZeroStrictFacts", TypeFacts[TypeFacts.NonZeroFacts = 4193922] = "NonZeroFacts", TypeFacts[TypeFacts.BaseBooleanStrictFacts = 933252] = "BaseBooleanStrictFacts", TypeFacts[TypeFacts.BaseBooleanFacts = 3145092] = "BaseBooleanFacts", TypeFacts[TypeFacts.BooleanStrictFacts = 4078980] = "BooleanStrictFacts", TypeFacts[TypeFacts.BooleanFacts = 4193668] = "BooleanFacts", TypeFacts[TypeFacts.FalseStrictFacts = 3030404] = "FalseStrictFacts", TypeFacts[TypeFacts.FalseFacts = 3145092] = "FalseFacts", TypeFacts[TypeFacts.TrueStrictFacts = 1981828] = "TrueStrictFacts", TypeFacts[TypeFacts.TrueFacts = 4193668] = "TrueFacts", TypeFacts[TypeFacts.SymbolStrictFacts = 1981320] = "SymbolStrictFacts", TypeFacts[TypeFacts.SymbolFacts = 4193160] = "SymbolFacts", TypeFacts[TypeFacts.ObjectStrictFacts = 1972176] = "ObjectStrictFacts", TypeFacts[TypeFacts.ObjectFacts = 4184016] = "ObjectFacts", TypeFacts[TypeFacts.FunctionStrictFacts = 1970144] = "FunctionStrictFacts", TypeFacts[TypeFacts.FunctionFacts = 4181984] = "FunctionFacts", TypeFacts[TypeFacts.UndefinedFacts = 2457472] = "UndefinedFacts", TypeFacts[TypeFacts.NullFacts = 2340752] = "NullFacts" }(TypeFacts || (TypeFacts = {})); var _jsxNamespace, _jsxFactoryEntity, TypeSystemPropertyName, typeofEQFacts = ts.createMapFromTemplate({ string: 1, number: 2, boolean: 4, symbol: 8, undefined: 16384, object: 16, function: 32 }), typeofNEFacts = ts.createMapFromTemplate({ string: 128, number: 256, boolean: 512, symbol: 1024, undefined: 131072, object: 2048, function: 4096 }), typeofTypesByName = ts.createMapFromTemplate({ string: stringType, number: numberType, boolean: booleanType, symbol: esSymbolType, undefined: undefinedType }), typeofType = createTypeofType(), subtypeRelation = ts.createMap(), assignableRelation = ts.createMap(), definitelyAssignableRelation = ts.createMap(), comparableRelation = ts.createMap(), identityRelation = ts.createMap(), enumRelation = ts.createMap(); !function (TypeSystemPropertyName) { TypeSystemPropertyName[TypeSystemPropertyName.Type = 0] = "Type", TypeSystemPropertyName[TypeSystemPropertyName.ResolvedBaseConstructorType = 1] = "ResolvedBaseConstructorType", TypeSystemPropertyName[TypeSystemPropertyName.DeclaredType = 2] = "DeclaredType", TypeSystemPropertyName[TypeSystemPropertyName.ResolvedReturnType = 3] = "ResolvedReturnType", TypeSystemPropertyName[TypeSystemPropertyName.ResolvedBaseConstraint = 4] = "ResolvedBaseConstraint" }(TypeSystemPropertyName || (TypeSystemPropertyName = {})); var CheckMode; !function (CheckMode) { CheckMode[CheckMode.Normal = 0] = "Normal", CheckMode[CheckMode.SkipContextSensitive = 1] = "SkipContextSensitive", CheckMode[CheckMode.Inferential = 2] = "Inferential", CheckMode[CheckMode.Contextual = 3] = "Contextual" }(CheckMode || (CheckMode = {})); var CallbackCheck; !function (CallbackCheck) { CallbackCheck[CallbackCheck.None = 0] = "None", CallbackCheck[CallbackCheck.Bivariant = 1] = "Bivariant", CallbackCheck[CallbackCheck.Strict = 2] = "Strict" }(CallbackCheck || (CallbackCheck = {})); var MappedTypeModifiers; !function (MappedTypeModifiers) { MappedTypeModifiers[MappedTypeModifiers.IncludeReadonly = 1] = "IncludeReadonly", MappedTypeModifiers[MappedTypeModifiers.ExcludeReadonly = 2] = "ExcludeReadonly", MappedTypeModifiers[MappedTypeModifiers.IncludeOptional = 4] = "IncludeOptional", MappedTypeModifiers[MappedTypeModifiers.ExcludeOptional = 8] = "ExcludeOptional" }(MappedTypeModifiers || (MappedTypeModifiers = {})); var ExpandingFlags; !function (ExpandingFlags) { ExpandingFlags[ExpandingFlags.None = 0] = "None", ExpandingFlags[ExpandingFlags.Source = 1] = "Source", ExpandingFlags[ExpandingFlags.Target = 2] = "Target", ExpandingFlags[ExpandingFlags.Both = 3] = "Both" }(ExpandingFlags || (ExpandingFlags = {})); var MembersOrExportsResolutionKind; !function (MembersOrExportsResolutionKind) { MembersOrExportsResolutionKind.resolvedExports = "resolvedExports", MembersOrExportsResolutionKind.resolvedMembers = "resolvedMembers" }(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {})); var UnusedKind; !function (UnusedKind) { UnusedKind[UnusedKind.Local = 0] = "Local", UnusedKind[UnusedKind.Parameter = 1] = "Parameter" }(UnusedKind || (UnusedKind = {})); var builtinGlobals = ts.createSymbolTable(); builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol); var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor); return initializeTypeChecker(), checker } function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { case 247: case 251: return ts.isIdentifier(name); default: return ts.isDeclarationName(name) } } function isSomeImportDeclaration(decl) { switch (decl.kind) { case 244: case 242: case 245: case 247: return !0; case 71: return 247 === decl.parent.kind; default: return !1 } } var ambientModuleSymbolRegex = /^".+"$/, nextSymbolId = 1, nextNodeId = 1, nextMergeId = 1, nextFlowId = 1; ts.getNodeId = getNodeId, ts.getSymbolId = getSymbolId, ts.isInstantiatedModule = isInstantiatedModule, ts.createTypeChecker = createTypeChecker; var JsxNames; !function (JsxNames) { JsxNames.JSX = "JSX", JsxNames.IntrinsicElements = "IntrinsicElements", JsxNames.ElementClass = "ElementClass", JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty", JsxNames.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute", JsxNames.Element = "Element", JsxNames.IntrinsicAttributes = "IntrinsicAttributes", JsxNames.IntrinsicClassAttributes = "IntrinsicClassAttributes" }(JsxNames || (JsxNames = {})) }(ts || (ts = {})); var ts; !function (ts) { function createSynthesizedNode(kind) { var node = ts.createNode(kind, -1, -1); return node.flags |= 8, node } function updateNode(updated, original) { return updated !== original && (setOriginalNode(updated, original), setTextRange(updated, original), ts.aggregateTransformFlags(updated)), updated } function createNodeArray(elements, hasTrailingComma) { if (elements && elements !== ts.emptyArray) { if (ts.isNodeArray(elements)) return elements } else elements = []; var array = elements; return array.pos = -1, array.end = -1, array.hasTrailingComma = hasTrailingComma, array } function getSynthesizedClone(node) { if (void 0 !== node) { var clone = createSynthesizedNode(node.kind); clone.flags |= node.flags, setOriginalNode(clone, node); for (var key in node) !clone.hasOwnProperty(key) && node.hasOwnProperty(key) && (clone[key] = node[key]); return clone } } function createLiteral(value, isSingleQuote) { if ("number" == typeof value) return createNumericLiteral(value + ""); if ("boolean" == typeof value) return value ? createTrue() : createFalse(); if (ts.isString(value)) { var res = createStringLiteral(value); return isSingleQuote && (res.singleQuote = !0), res } return createLiteralFromNode(value) } function createNumericLiteral(value) { var node = createSynthesizedNode(8); return node.text = value, node.numericLiteralFlags = 0, node } function createStringLiteral(text) { var node = createSynthesizedNode(9); return node.text = text, node } function createRegularExpressionLiteral(text) { var node = createSynthesizedNode(12); return node.text = text, node } function createLiteralFromNode(sourceNode) { var node = createStringLiteral(ts.getTextOfIdentifierOrLiteral(sourceNode)); return node.textSourceNode = sourceNode, node } function createIdentifier(text, typeArguments) { var node = createSynthesizedNode(71); return node.escapedText = ts.escapeLeadingUnderscores(text), node.originalKeywordKind = text ? ts.stringToToken(text) : 0, node.autoGenerateFlags = 0, node.autoGenerateId = 0, typeArguments && (node.typeArguments = createNodeArray(typeArguments)), node } function updateIdentifier(node, typeArguments) { return node.typeArguments !== typeArguments ? updateNode(createIdentifier(ts.idText(node), typeArguments), node) : node } function createTempVariable(recordTempVariable, reservedInNestedScopes) { var name = createIdentifier(""); return name.autoGenerateFlags = 1, name.autoGenerateId = nextAutoGenerateId, nextAutoGenerateId++ , recordTempVariable && recordTempVariable(name), reservedInNestedScopes && (name.autoGenerateFlags |= 8), name } function createLoopVariable() { var name = createIdentifier(""); return name.autoGenerateFlags = 2, name.autoGenerateId = nextAutoGenerateId, nextAutoGenerateId++ , name } function createUniqueName(text) { var name = createIdentifier(text); return name.autoGenerateFlags = 3, name.autoGenerateId = nextAutoGenerateId, nextAutoGenerateId++ , name } function createOptimisticUniqueName(text) { var name = createIdentifier(text); return name.autoGenerateFlags = 19, name.autoGenerateId = nextAutoGenerateId, nextAutoGenerateId++ , name } function createFileLevelUniqueName(text) { var name = createOptimisticUniqueName(text); return name.autoGenerateFlags |= 32, name } function getGeneratedNameForNode(node, flags) { var name = createIdentifier(ts.isIdentifier(node) ? ts.idText(node) : ""); return name.autoGenerateFlags = 4 | flags, name.autoGenerateId = nextAutoGenerateId, name.original = node, nextAutoGenerateId++ , name } function createToken(token) { return createSynthesizedNode(token) } function createSuper() { return createSynthesizedNode(97) } function createThis() { return createSynthesizedNode(99) } function createNull() { return createSynthesizedNode(95) } function createTrue() { return createSynthesizedNode(101) } function createFalse() { return createSynthesizedNode(86) } function createModifier(kind) { return createToken(kind) } function createModifiersFromModifierFlags(flags) { var result = []; return 1 & flags && result.push(createModifier(84)), 2 & flags && result.push(createModifier(124)), 512 & flags && result.push(createModifier(79)), 2048 & flags && result.push(createModifier(76)), 4 & flags && result.push(createModifier(114)), 8 & flags && result.push(createModifier(112)), 16 & flags && result.push(createModifier(113)), 128 & flags && result.push(createModifier(117)), 32 & flags && result.push(createModifier(115)), 64 & flags && result.push(createModifier(132)), 256 & flags && result.push(createModifier(120)), result } function createQualifiedName(left, right) { var node = createSynthesizedNode(145); return node.left = left, node.right = asName(right), node } function updateQualifiedName(node, left, right) { return node.left !== left || node.right !== right ? updateNode(createQualifiedName(left, right), node) : node } function parenthesizeForComputedName(expression) { return ts.isBinaryExpression(expression) && 26 === expression.operatorToken.kind || 301 === expression.kind ? createParen(expression) : expression } function createComputedPropertyName(expression) { var node = createSynthesizedNode(146); return node.expression = parenthesizeForComputedName(expression), node } function updateComputedPropertyName(node, expression) { return node.expression !== expression ? updateNode(createComputedPropertyName(expression), node) : node } function createTypeParameterDeclaration(name, constraint, defaultType) { var node = createSynthesizedNode(147); return node.name = asName(name), node.constraint = constraint, node.default = defaultType, node } function updateTypeParameterDeclaration(node, name, constraint, defaultType) { return node.name !== name || node.constraint !== constraint || node.default !== defaultType ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) : node } function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { var node = createSynthesizedNode(148); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.dotDotDotToken = dotDotDotToken, node.name = asName(name), node.questionToken = questionToken, node.type = type, node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : void 0, node } function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { return node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type || node.initializer !== initializer ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer), node) : node } function createDecorator(expression) { var node = createSynthesizedNode(149); return node.expression = ts.parenthesizeForAccess(expression), node } function updateDecorator(node, expression) { return node.expression !== expression ? updateNode(createDecorator(expression), node) : node } function createPropertySignature(modifiers, name, questionToken, type, initializer) { var node = createSynthesizedNode(150); return node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.questionToken = questionToken, node.type = type, node.initializer = initializer, node } function updatePropertySignature(node, modifiers, name, questionToken, type, initializer) { return node.modifiers !== modifiers || node.name !== name || node.questionToken !== questionToken || node.type !== type || node.initializer !== initializer ? updateNode(createPropertySignature(modifiers, name, questionToken, type, initializer), node) : node } function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) { var node = createSynthesizedNode(151); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.questionToken = void 0 !== questionOrExclamationToken && 55 === questionOrExclamationToken.kind ? questionOrExclamationToken : void 0, node.exclamationToken = void 0 !== questionOrExclamationToken && 51 === questionOrExclamationToken.kind ? questionOrExclamationToken : void 0, node.type = type, node.initializer = initializer, node } function updateProperty(node, decorators, modifiers, name, questionOrExclamationToken, type, initializer) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.questionToken !== (void 0 !== questionOrExclamationToken && 55 === questionOrExclamationToken.kind ? questionOrExclamationToken : void 0) || node.exclamationToken !== (void 0 !== questionOrExclamationToken && 51 === questionOrExclamationToken.kind ? questionOrExclamationToken : void 0) || node.type !== type || node.initializer !== initializer ? updateNode(createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer), node) : node } function createMethodSignature(typeParameters, parameters, type, name, questionToken) { var node = createSignatureDeclaration(152, typeParameters, parameters, type); return node.name = asName(name), node.questionToken = questionToken, node } function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.name !== name || node.questionToken !== questionToken ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) : node } function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { var node = createSynthesizedNode(153); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.asteriskToken = asteriskToken, node.name = asName(name), node.questionToken = questionToken, node.typeParameters = asNodeArray(typeParameters), node.parameters = createNodeArray(parameters), node.type = type, node.body = body, node } function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { return node.decorators !== decorators || node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.name !== name || node.questionToken !== questionToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? updateNode(createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) : node } function createConstructor(decorators, modifiers, parameters, body) { var node = createSynthesizedNode(154); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.typeParameters = void 0, node.parameters = createNodeArray(parameters), node.type = void 0, node.body = body, node } function updateConstructor(node, decorators, modifiers, parameters, body) { return node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) : node } function createGetAccessor(decorators, modifiers, name, parameters, type, body) { var node = createSynthesizedNode(155); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.typeParameters = void 0, node.parameters = createNodeArray(parameters), node.type = type, node.body = body, node } function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) : node } function createSetAccessor(decorators, modifiers, name, parameters, body) { var node = createSynthesizedNode(156); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.typeParameters = void 0, node.parameters = createNodeArray(parameters), node.body = body, node } function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) : node } function createCallSignature(typeParameters, parameters, type) { return createSignatureDeclaration(157, typeParameters, parameters, type) } function updateCallSignature(node, typeParameters, parameters, type) { return updateSignatureDeclaration(node, typeParameters, parameters, type) } function createConstructSignature(typeParameters, parameters, type) { return createSignatureDeclaration(158, typeParameters, parameters, type) } function updateConstructSignature(node, typeParameters, parameters, type) { return updateSignatureDeclaration(node, typeParameters, parameters, type) } function createIndexSignature(decorators, modifiers, parameters, type) { var node = createSynthesizedNode(159); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.parameters = createNodeArray(parameters), node.type = type, node } function updateIndexSignature(node, decorators, modifiers, parameters, type) { return node.parameters !== parameters || node.type !== type || node.decorators !== decorators || node.modifiers !== modifiers ? updateNode(createIndexSignature(decorators, modifiers, parameters, type), node) : node } function createSignatureDeclaration(kind, typeParameters, parameters, type, typeArguments) { var node = createSynthesizedNode(kind); return node.typeParameters = asNodeArray(typeParameters), node.parameters = asNodeArray(parameters), node.type = type, node.typeArguments = asNodeArray(typeArguments), node } function updateSignatureDeclaration(node, typeParameters, parameters, type) { return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) : node } function createKeywordTypeNode(kind) { return createSynthesizedNode(kind) } function createTypePredicateNode(parameterName, type) { var node = createSynthesizedNode(160); return node.parameterName = asName(parameterName), node.type = type, node } function updateTypePredicateNode(node, parameterName, type) { return node.parameterName !== parameterName || node.type !== type ? updateNode(createTypePredicateNode(parameterName, type), node) : node } function createTypeReferenceNode(typeName, typeArguments) { var node = createSynthesizedNode(161); return node.typeName = asName(typeName), node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments), node } function updateTypeReferenceNode(node, typeName, typeArguments) { return node.typeName !== typeName || node.typeArguments !== typeArguments ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) : node } function createFunctionTypeNode(typeParameters, parameters, type) { return createSignatureDeclaration(162, typeParameters, parameters, type) } function updateFunctionTypeNode(node, typeParameters, parameters, type) { return updateSignatureDeclaration(node, typeParameters, parameters, type) } function createConstructorTypeNode(typeParameters, parameters, type) { return createSignatureDeclaration(163, typeParameters, parameters, type) } function updateConstructorTypeNode(node, typeParameters, parameters, type) { return updateSignatureDeclaration(node, typeParameters, parameters, type) } function createTypeQueryNode(exprName) { var node = createSynthesizedNode(164); return node.exprName = exprName, node } function updateTypeQueryNode(node, exprName) { return node.exprName !== exprName ? updateNode(createTypeQueryNode(exprName), node) : node } function createTypeLiteralNode(members) { var node = createSynthesizedNode(165); return node.members = createNodeArray(members), node } function updateTypeLiteralNode(node, members) { return node.members !== members ? updateNode(createTypeLiteralNode(members), node) : node } function createArrayTypeNode(elementType) { var node = createSynthesizedNode(166); return node.elementType = ts.parenthesizeArrayTypeMember(elementType), node } function updateArrayTypeNode(node, elementType) { return node.elementType !== elementType ? updateNode(createArrayTypeNode(elementType), node) : node } function createTupleTypeNode(elementTypes) { var node = createSynthesizedNode(167); return node.elementTypes = createNodeArray(elementTypes), node } function updateTypleTypeNode(node, elementTypes) { return node.elementTypes !== elementTypes ? updateNode(createTupleTypeNode(elementTypes), node) : node } function createUnionTypeNode(types) { return createUnionOrIntersectionTypeNode(168, types) } function updateUnionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types) } function createIntersectionTypeNode(types) { return createUnionOrIntersectionTypeNode(169, types) } function updateIntersectionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types) } function createUnionOrIntersectionTypeNode(kind, types) { var node = createSynthesizedNode(kind); return node.types = ts.parenthesizeElementTypeMembers(types), node } function updateUnionOrIntersectionTypeNode(node, types) { return node.types !== types ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) : node; } function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { var node = createSynthesizedNode(170); return node.checkType = ts.parenthesizeConditionalTypeMember(checkType), node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType), node.trueType = trueType, node.falseType = falseType, node } function updateConditionalTypeNode(node, checkType, extendsType, trueType, falseType) { return node.checkType !== checkType || node.extendsType !== extendsType || node.trueType !== trueType || node.falseType !== falseType ? updateNode(createConditionalTypeNode(checkType, extendsType, trueType, falseType), node) : node } function createInferTypeNode(typeParameter) { var node = createSynthesizedNode(171); return node.typeParameter = typeParameter, node } function updateInferTypeNode(node, typeParameter) { return node.typeParameter !== typeParameter ? updateNode(createInferTypeNode(typeParameter), node) : node } function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { var node = createSynthesizedNode(178); return node.argument = argument, node.qualifier = qualifier, node.typeArguments = asNodeArray(typeArguments), node.isTypeOf = isTypeOf, node } function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { return node.argument !== argument || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf ? updateNode(createImportTypeNode(argument, qualifier, typeArguments, isTypeOf), node) : node } function createParenthesizedType(type) { var node = createSynthesizedNode(172); return node.type = type, node } function updateParenthesizedType(node, type) { return node.type !== type ? updateNode(createParenthesizedType(type), node) : node } function createThisTypeNode() { return createSynthesizedNode(173) } function createTypeOperatorNode(operatorOrType, type) { var node = createSynthesizedNode(174); return node.operator = "number" == typeof operatorOrType ? operatorOrType : 128, node.type = ts.parenthesizeElementTypeMember("number" == typeof operatorOrType ? type : operatorOrType), node } function updateTypeOperatorNode(node, type) { return node.type !== type ? updateNode(createTypeOperatorNode(node.operator, type), node) : node } function createIndexedAccessTypeNode(objectType, indexType) { var node = createSynthesizedNode(175); return node.objectType = ts.parenthesizeElementTypeMember(objectType), node.indexType = indexType, node } function updateIndexedAccessTypeNode(node, objectType, indexType) { return node.objectType !== objectType || node.indexType !== indexType ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) : node } function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { var node = createSynthesizedNode(176); return node.readonlyToken = readonlyToken, node.typeParameter = typeParameter, node.questionToken = questionToken, node.type = type, node } function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { return node.readonlyToken !== readonlyToken || node.typeParameter !== typeParameter || node.questionToken !== questionToken || node.type !== type ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) : node } function createLiteralTypeNode(literal) { var node = createSynthesizedNode(177); return node.literal = literal, node } function updateLiteralTypeNode(node, literal) { return node.literal !== literal ? updateNode(createLiteralTypeNode(literal), node) : node } function createObjectBindingPattern(elements) { var node = createSynthesizedNode(179); return node.elements = createNodeArray(elements), node } function updateObjectBindingPattern(node, elements) { return node.elements !== elements ? updateNode(createObjectBindingPattern(elements), node) : node } function createArrayBindingPattern(elements) { var node = createSynthesizedNode(180); return node.elements = createNodeArray(elements), node } function updateArrayBindingPattern(node, elements) { return node.elements !== elements ? updateNode(createArrayBindingPattern(elements), node) : node } function createBindingElement(dotDotDotToken, propertyName, name, initializer) { var node = createSynthesizedNode(181); return node.dotDotDotToken = dotDotDotToken, node.propertyName = asName(propertyName), node.name = asName(name), node.initializer = initializer, node } function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { return node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) : node } function createArrayLiteral(elements, multiLine) { var node = createSynthesizedNode(182); return node.elements = ts.parenthesizeListElements(createNodeArray(elements)), multiLine && (node.multiLine = !0), node } function updateArrayLiteral(node, elements) { return node.elements !== elements ? updateNode(createArrayLiteral(elements, node.multiLine), node) : node } function createObjectLiteral(properties, multiLine) { var node = createSynthesizedNode(183); return node.properties = createNodeArray(properties), multiLine && (node.multiLine = !0), node } function updateObjectLiteral(node, properties) { return node.properties !== properties ? updateNode(createObjectLiteral(properties, node.multiLine), node) : node } function createPropertyAccess(expression, name) { var node = createSynthesizedNode(184); return node.expression = ts.parenthesizeForAccess(expression), node.name = asName(name), setEmitFlags(node, 131072), node } function updatePropertyAccess(node, expression, name) { return node.expression !== expression || node.name !== name ? updateNode(setEmitFlags(createPropertyAccess(expression, name), ts.getEmitFlags(node)), node) : node } function createElementAccess(expression, index) { var node = createSynthesizedNode(185); return node.expression = ts.parenthesizeForAccess(expression), node.argumentExpression = asExpression(index), node } function updateElementAccess(node, expression, argumentExpression) { return node.expression !== expression || node.argumentExpression !== argumentExpression ? updateNode(createElementAccess(expression, argumentExpression), node) : node } function createCall(expression, typeArguments, argumentsArray) { var node = createSynthesizedNode(186); return node.expression = ts.parenthesizeForAccess(expression), node.typeArguments = asNodeArray(typeArguments), node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)), node } function updateCall(node, expression, typeArguments, argumentsArray) { return node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? updateNode(createCall(expression, typeArguments, argumentsArray), node) : node } function createNew(expression, typeArguments, argumentsArray) { var node = createSynthesizedNode(187); return node.expression = ts.parenthesizeForNew(expression), node.typeArguments = asNodeArray(typeArguments), node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : void 0, node } function updateNew(node, expression, typeArguments, argumentsArray) { return node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? updateNode(createNew(expression, typeArguments, argumentsArray), node) : node } function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) { var node = createSynthesizedNode(188); return node.tag = ts.parenthesizeForAccess(tag), template ? (node.typeArguments = asNodeArray(typeArgumentsOrTemplate), node.template = template) : (node.typeArguments = void 0, node.template = typeArgumentsOrTemplate), node } function updateTaggedTemplate(node, tag, typeArgumentsOrTemplate, template) { return node.tag !== tag || (template ? node.typeArguments !== typeArgumentsOrTemplate || node.template !== template : void 0 !== node.typeArguments || node.template !== typeArgumentsOrTemplate) ? updateNode(createTaggedTemplate(tag, typeArgumentsOrTemplate, template), node) : node } function createTypeAssertion(type, expression) { var node = createSynthesizedNode(189); return node.type = type, node.expression = ts.parenthesizePrefixOperand(expression), node } function updateTypeAssertion(node, type, expression) { return node.type !== type || node.expression !== expression ? updateNode(createTypeAssertion(type, expression), node) : node } function createParen(expression) { var node = createSynthesizedNode(190); return node.expression = expression, node } function updateParen(node, expression) { return node.expression !== expression ? updateNode(createParen(expression), node) : node } function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { var node = createSynthesizedNode(191); return node.modifiers = asNodeArray(modifiers), node.asteriskToken = asteriskToken, node.name = asName(name), node.typeParameters = asNodeArray(typeParameters), node.parameters = createNodeArray(parameters), node.type = type, node.body = body, node } function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { return node.name !== name || node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node } function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { var node = createSynthesizedNode(192); return node.modifiers = asNodeArray(modifiers), node.typeParameters = asNodeArray(typeParameters), node.parameters = createNodeArray(parameters), node.type = type, node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(36), node.body = ts.parenthesizeConciseBody(body), node } function updateArrowFunction(node, modifiers, typeParameters, parameters, type, equalsGreaterThanTokenOrBody, bodyOrUndefined) { var equalsGreaterThanToken, body; return void 0 === bodyOrUndefined ? (equalsGreaterThanToken = node.equalsGreaterThanToken, body = ts.cast(equalsGreaterThanTokenOrBody, ts.isConciseBody)) : (equalsGreaterThanToken = ts.cast(equalsGreaterThanTokenOrBody, function (n) { return 36 === n.kind }), body = bodyOrUndefined), node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.equalsGreaterThanToken !== equalsGreaterThanToken || node.body !== body ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body), node) : node } function createDelete(expression) { var node = createSynthesizedNode(193); return node.expression = ts.parenthesizePrefixOperand(expression), node } function updateDelete(node, expression) { return node.expression !== expression ? updateNode(createDelete(expression), node) : node } function createTypeOf(expression) { var node = createSynthesizedNode(194); return node.expression = ts.parenthesizePrefixOperand(expression), node } function updateTypeOf(node, expression) { return node.expression !== expression ? updateNode(createTypeOf(expression), node) : node } function createVoid(expression) { var node = createSynthesizedNode(195); return node.expression = ts.parenthesizePrefixOperand(expression), node } function updateVoid(node, expression) { return node.expression !== expression ? updateNode(createVoid(expression), node) : node } function createAwait(expression) { var node = createSynthesizedNode(196); return node.expression = ts.parenthesizePrefixOperand(expression), node } function updateAwait(node, expression) { return node.expression !== expression ? updateNode(createAwait(expression), node) : node } function createPrefix(operator, operand) { var node = createSynthesizedNode(197); return node.operator = operator, node.operand = ts.parenthesizePrefixOperand(operand), node } function updatePrefix(node, operand) { return node.operand !== operand ? updateNode(createPrefix(node.operator, operand), node) : node } function createPostfix(operand, operator) { var node = createSynthesizedNode(198); return node.operand = ts.parenthesizePostfixOperand(operand), node.operator = operator, node } function updatePostfix(node, operand) { return node.operand !== operand ? updateNode(createPostfix(operand, node.operator), node) : node } function createBinary(left, operator, right) { var node = createSynthesizedNode(199), operatorToken = asToken(operator), operatorKind = operatorToken.kind; return node.left = ts.parenthesizeBinaryOperand(operatorKind, left, !0, void 0), node.operatorToken = operatorToken, node.right = ts.parenthesizeBinaryOperand(operatorKind, right, !1, node.left), node } function updateBinary(node, left, right, operator) { return node.left !== left || node.right !== right ? updateNode(createBinary(left, operator || node.operatorToken, right), node) : node } function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { var node = createSynthesizedNode(200); return node.condition = ts.parenthesizeForConditionalHead(condition), node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55), node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue), node.colonToken = whenFalse ? colonToken : createToken(56), node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse), node } function updateConditional(node, condition) { for (var args = [], _i = 2; _i < arguments.length; _i++)args[_i - 2] = arguments[_i]; if (2 === args.length) { var whenTrue_1 = args[0], whenFalse_1 = args[1]; return updateConditional(node, condition, node.questionToken, whenTrue_1, node.colonToken, whenFalse_1) } ts.Debug.assert(4 === args.length); var questionToken = args[0], whenTrue = args[1], colonToken = args[2], whenFalse = args[3]; return node.condition !== condition || node.questionToken !== questionToken || node.whenTrue !== whenTrue || node.colonToken !== colonToken || node.whenFalse !== whenFalse ? updateNode(createConditional(condition, questionToken, whenTrue, colonToken, whenFalse), node) : node } function createTemplateExpression(head, templateSpans) { var node = createSynthesizedNode(201); return node.head = head, node.templateSpans = createNodeArray(templateSpans), node } function updateTemplateExpression(node, head, templateSpans) { return node.head !== head || node.templateSpans !== templateSpans ? updateNode(createTemplateExpression(head, templateSpans), node) : node } function createTemplateHead(text) { var node = createSynthesizedNode(14); return node.text = text, node } function createTemplateMiddle(text) { var node = createSynthesizedNode(15); return node.text = text, node } function createTemplateTail(text) { var node = createSynthesizedNode(16); return node.text = text, node } function createNoSubstitutionTemplateLiteral(text) { var node = createSynthesizedNode(13); return node.text = text, node } function createYield(asteriskTokenOrExpression, expression) { var node = createSynthesizedNode(202); return node.asteriskToken = asteriskTokenOrExpression && 39 === asteriskTokenOrExpression.kind ? asteriskTokenOrExpression : void 0, node.expression = asteriskTokenOrExpression && 39 !== asteriskTokenOrExpression.kind ? asteriskTokenOrExpression : expression, node } function updateYield(node, asteriskToken, expression) { return node.expression !== expression || node.asteriskToken !== asteriskToken ? updateNode(createYield(asteriskToken, expression), node) : node } function createSpread(expression) { var node = createSynthesizedNode(203); return node.expression = ts.parenthesizeExpressionForList(expression), node } function updateSpread(node, expression) { return node.expression !== expression ? updateNode(createSpread(expression), node) : node } function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { var node = createSynthesizedNode(204); return node.decorators = void 0, node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.typeParameters = asNodeArray(typeParameters), node.heritageClauses = asNodeArray(heritageClauses), node.members = createNodeArray(members), node } function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) : node } function createOmittedExpression() { return createSynthesizedNode(205) } function createExpressionWithTypeArguments(typeArguments, expression) { var node = createSynthesizedNode(206); return node.expression = ts.parenthesizeForAccess(expression), node.typeArguments = asNodeArray(typeArguments), node } function updateExpressionWithTypeArguments(node, typeArguments, expression) { return node.typeArguments !== typeArguments || node.expression !== expression ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) : node } function createAsExpression(expression, type) { var node = createSynthesizedNode(207); return node.expression = expression, node.type = type, node } function updateAsExpression(node, expression, type) { return node.expression !== expression || node.type !== type ? updateNode(createAsExpression(expression, type), node) : node } function createNonNullExpression(expression) { var node = createSynthesizedNode(208); return node.expression = ts.parenthesizeForAccess(expression), node } function updateNonNullExpression(node, expression) { return node.expression !== expression ? updateNode(createNonNullExpression(expression), node) : node } function createMetaProperty(keywordToken, name) { var node = createSynthesizedNode(209); return node.keywordToken = keywordToken, node.name = name, node } function updateMetaProperty(node, name) { return node.name !== name ? updateNode(createMetaProperty(node.keywordToken, name), node) : node } function createTemplateSpan(expression, literal) { var node = createSynthesizedNode(210); return node.expression = expression, node.literal = literal, node } function updateTemplateSpan(node, expression, literal) { return node.expression !== expression || node.literal !== literal ? updateNode(createTemplateSpan(expression, literal), node) : node } function createSemicolonClassElement() { return createSynthesizedNode(211) } function createBlock(statements, multiLine) { var block = createSynthesizedNode(212); return block.statements = createNodeArray(statements), multiLine && (block.multiLine = multiLine), block } function createExpressionStatement(expression) { var node = createSynthesizedNode(215); return node.expression = expression, node } function updateBlock(node, statements) { return node.statements !== statements ? updateNode(createBlock(statements, node.multiLine), node) : node } function createVariableStatement(modifiers, declarationList) { var node = createSynthesizedNode(213); return node.decorators = void 0, node.modifiers = asNodeArray(modifiers), node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList, node } function updateVariableStatement(node, modifiers, declarationList) { return node.modifiers !== modifiers || node.declarationList !== declarationList ? updateNode(createVariableStatement(modifiers, declarationList), node) : node } function createEmptyStatement() { return createSynthesizedNode(214) } function createStatement(expression) { return createExpressionStatement(ts.parenthesizeExpressionForExpressionStatement(expression)) } function updateStatement(node, expression) { return node.expression !== expression ? updateNode(createStatement(expression), node) : node } function createIf(expression, thenStatement, elseStatement) { var node = createSynthesizedNode(216); return node.expression = expression, node.thenStatement = thenStatement, node.elseStatement = elseStatement, node } function updateIf(node, expression, thenStatement, elseStatement) { return node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement ? updateNode(createIf(expression, thenStatement, elseStatement), node) : node } function createDo(statement, expression) { var node = createSynthesizedNode(217); return node.statement = statement, node.expression = expression, node } function updateDo(node, statement, expression) { return node.statement !== statement || node.expression !== expression ? updateNode(createDo(statement, expression), node) : node } function createWhile(expression, statement) { var node = createSynthesizedNode(218); return node.expression = expression, node.statement = statement, node } function updateWhile(node, expression, statement) { return node.expression !== expression || node.statement !== statement ? updateNode(createWhile(expression, statement), node) : node } function createFor(initializer, condition, incrementor, statement) { var node = createSynthesizedNode(219); return node.initializer = initializer, node.condition = condition, node.incrementor = incrementor, node.statement = statement, node } function updateFor(node, initializer, condition, incrementor, statement) { return node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement ? updateNode(createFor(initializer, condition, incrementor, statement), node) : node } function createForIn(initializer, expression, statement) { var node = createSynthesizedNode(220); return node.initializer = initializer, node.expression = expression, node.statement = statement, node } function updateForIn(node, initializer, expression, statement) { return node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? updateNode(createForIn(initializer, expression, statement), node) : node } function createForOf(awaitModifier, initializer, expression, statement) { var node = createSynthesizedNode(221); return node.awaitModifier = awaitModifier, node.initializer = initializer, node.expression = expression, node.statement = statement, node } function updateForOf(node, awaitModifier, initializer, expression, statement) { return node.awaitModifier !== awaitModifier || node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) : node } function createContinue(label) { var node = createSynthesizedNode(222); return node.label = asName(label), node } function updateContinue(node, label) { return node.label !== label ? updateNode(createContinue(label), node) : node } function createBreak(label) { var node = createSynthesizedNode(223); return node.label = asName(label), node } function updateBreak(node, label) { return node.label !== label ? updateNode(createBreak(label), node) : node } function createReturn(expression) { var node = createSynthesizedNode(224); return node.expression = expression, node } function updateReturn(node, expression) { return node.expression !== expression ? updateNode(createReturn(expression), node) : node } function createWith(expression, statement) { var node = createSynthesizedNode(225); return node.expression = expression, node.statement = statement, node } function updateWith(node, expression, statement) { return node.expression !== expression || node.statement !== statement ? updateNode(createWith(expression, statement), node) : node } function createSwitch(expression, caseBlock) { var node = createSynthesizedNode(226); return node.expression = ts.parenthesizeExpressionForList(expression), node.caseBlock = caseBlock, node } function updateSwitch(node, expression, caseBlock) { return node.expression !== expression || node.caseBlock !== caseBlock ? updateNode(createSwitch(expression, caseBlock), node) : node } function createLabel(label, statement) { var node = createSynthesizedNode(227); return node.label = asName(label), node.statement = statement, node } function updateLabel(node, label, statement) { return node.label !== label || node.statement !== statement ? updateNode(createLabel(label, statement), node) : node } function createThrow(expression) { var node = createSynthesizedNode(228); return node.expression = expression, node } function updateThrow(node, expression) { return node.expression !== expression ? updateNode(createThrow(expression), node) : node } function createTry(tryBlock, catchClause, finallyBlock) { var node = createSynthesizedNode(229); return node.tryBlock = tryBlock, node.catchClause = catchClause, node.finallyBlock = finallyBlock, node } function updateTry(node, tryBlock, catchClause, finallyBlock) { return node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) : node } function createDebuggerStatement() { return createSynthesizedNode(230) } function createVariableDeclaration(name, type, initializer) { var node = createSynthesizedNode(231); return node.name = asName(name), node.type = type, node.initializer = void 0 !== initializer ? ts.parenthesizeExpressionForList(initializer) : void 0, node } function updateVariableDeclaration(node, name, type, initializer) { return node.name !== name || node.type !== type || node.initializer !== initializer ? updateNode(createVariableDeclaration(name, type, initializer), node) : node } function createVariableDeclarationList(declarations, flags) { var node = createSynthesizedNode(232); return node.flags |= 3 & flags, node.declarations = createNodeArray(declarations), node } function updateVariableDeclarationList(node, declarations) { return node.declarations !== declarations ? updateNode(createVariableDeclarationList(declarations, node.flags), node) : node } function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { var node = createSynthesizedNode(233); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.asteriskToken = asteriskToken, node.name = asName(name), node.typeParameters = asNodeArray(typeParameters), node.parameters = createNodeArray(parameters), node.type = type, node.body = body, node } function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { return node.decorators !== decorators || node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node } function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { var node = createSynthesizedNode(234); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.typeParameters = asNodeArray(typeParameters), node.heritageClauses = asNodeArray(heritageClauses), node.members = createNodeArray(members), node } function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) : node } function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { var node = createSynthesizedNode(235); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.typeParameters = asNodeArray(typeParameters), node.heritageClauses = asNodeArray(heritageClauses), node.members = createNodeArray(members), node } function updateInterfaceDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? updateNode(createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) : node } function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { var node = createSynthesizedNode(236); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.typeParameters = asNodeArray(typeParameters), node.type = type, node } function updateTypeAliasDeclaration(node, decorators, modifiers, name, typeParameters, type) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.type !== type ? updateNode(createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type), node) : node } function createEnumDeclaration(decorators, modifiers, name, members) { var node = createSynthesizedNode(237); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.members = createNodeArray(members), node } function updateEnumDeclaration(node, decorators, modifiers, name, members) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.members !== members ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) : node } function createModuleDeclaration(decorators, modifiers, name, body, flags) { var node = createSynthesizedNode(238); return node.flags |= 532 & flags, node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = name, node.body = body, node } function updateModuleDeclaration(node, decorators, modifiers, name, body) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.body !== body ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) : node } function createModuleBlock(statements) { var node = createSynthesizedNode(239); return node.statements = createNodeArray(statements), node } function updateModuleBlock(node, statements) { return node.statements !== statements ? updateNode(createModuleBlock(statements), node) : node } function createCaseBlock(clauses) { var node = createSynthesizedNode(240); return node.clauses = createNodeArray(clauses), node } function updateCaseBlock(node, clauses) { return node.clauses !== clauses ? updateNode(createCaseBlock(clauses), node) : node } function createNamespaceExportDeclaration(name) { var node = createSynthesizedNode(241); return node.name = asName(name), node } function updateNamespaceExportDeclaration(node, name) { return node.name !== name ? updateNode(createNamespaceExportDeclaration(name), node) : node } function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { var node = createSynthesizedNode(242); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.name = asName(name), node.moduleReference = moduleReference, node } function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.moduleReference !== moduleReference ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) : node } function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { var node = createSynthesizedNode(243); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.importClause = importClause, node.moduleSpecifier = moduleSpecifier, node } function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { return node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) : node } function createImportClause(name, namedBindings) { var node = createSynthesizedNode(244); return node.name = name, node.namedBindings = namedBindings, node } function updateImportClause(node, name, namedBindings) { return node.name !== name || node.namedBindings !== namedBindings ? updateNode(createImportClause(name, namedBindings), node) : node } function createNamespaceImport(name) { var node = createSynthesizedNode(245); return node.name = name, node } function updateNamespaceImport(node, name) { return node.name !== name ? updateNode(createNamespaceImport(name), node) : node } function createNamedImports(elements) { var node = createSynthesizedNode(246); return node.elements = createNodeArray(elements), node } function updateNamedImports(node, elements) { return node.elements !== elements ? updateNode(createNamedImports(elements), node) : node } function createImportSpecifier(propertyName, name) { var node = createSynthesizedNode(247); return node.propertyName = propertyName, node.name = name, node } function updateImportSpecifier(node, propertyName, name) { return node.propertyName !== propertyName || node.name !== name ? updateNode(createImportSpecifier(propertyName, name), node) : node } function createExportAssignment(decorators, modifiers, isExportEquals, expression) { var node = createSynthesizedNode(248); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.isExportEquals = isExportEquals, node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(58, expression, !1, void 0) : ts.parenthesizeDefaultExpression(expression), node } function updateExportAssignment(node, decorators, modifiers, expression) { return node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) : node } function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { var node = createSynthesizedNode(249); return node.decorators = asNodeArray(decorators), node.modifiers = asNodeArray(modifiers), node.exportClause = exportClause, node.moduleSpecifier = moduleSpecifier, node } function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { return node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) : node } function createNamedExports(elements) { var node = createSynthesizedNode(250); return node.elements = createNodeArray(elements), node } function updateNamedExports(node, elements) { return node.elements !== elements ? updateNode(createNamedExports(elements), node) : node } function createExportSpecifier(propertyName, name) { var node = createSynthesizedNode(251); return node.propertyName = asName(propertyName), node.name = asName(name), node } function updateExportSpecifier(node, propertyName, name) { return node.propertyName !== propertyName || node.name !== name ? updateNode(createExportSpecifier(propertyName, name), node) : node } function createExternalModuleReference(expression) { var node = createSynthesizedNode(253); return node.expression = expression, node } function updateExternalModuleReference(node, expression) { return node.expression !== expression ? updateNode(createExternalModuleReference(expression), node) : node } function createJsxElement(openingElement, children, closingElement) { var node = createSynthesizedNode(254); return node.openingElement = openingElement, node.children = createNodeArray(children), node.closingElement = closingElement, node } function updateJsxElement(node, openingElement, children, closingElement) { return node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement ? updateNode(createJsxElement(openingElement, children, closingElement), node) : node } function createJsxSelfClosingElement(tagName, typeArguments, attributes) { var node = createSynthesizedNode(255); return node.tagName = tagName, node.typeArguments = typeArguments && createNodeArray(typeArguments), node.attributes = attributes, node } function updateJsxSelfClosingElement(node, tagName, typeArguments, attributes) { return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? updateNode(createJsxSelfClosingElement(tagName, typeArguments, attributes), node) : node } function createJsxOpeningElement(tagName, typeArguments, attributes) { var node = createSynthesizedNode(256); return node.tagName = tagName, node.typeArguments = typeArguments && createNodeArray(typeArguments), node.attributes = attributes, node } function updateJsxOpeningElement(node, tagName, typeArguments, attributes) { return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? updateNode(createJsxOpeningElement(tagName, typeArguments, attributes), node) : node } function createJsxClosingElement(tagName) { var node = createSynthesizedNode(257); return node.tagName = tagName, node } function updateJsxClosingElement(node, tagName) { return node.tagName !== tagName ? updateNode(createJsxClosingElement(tagName), node) : node } function createJsxFragment(openingFragment, children, closingFragment) { var node = createSynthesizedNode(258); return node.openingFragment = openingFragment, node.children = createNodeArray(children), node.closingFragment = closingFragment, node } function updateJsxFragment(node, openingFragment, children, closingFragment) { return node.openingFragment !== openingFragment || node.children !== children || node.closingFragment !== closingFragment ? updateNode(createJsxFragment(openingFragment, children, closingFragment), node) : node } function createJsxAttribute(name, initializer) { var node = createSynthesizedNode(261); return node.name = name, node.initializer = initializer, node } function updateJsxAttribute(node, name, initializer) { return node.name !== name || node.initializer !== initializer ? updateNode(createJsxAttribute(name, initializer), node) : node } function createJsxAttributes(properties) { var node = createSynthesizedNode(262); return node.properties = createNodeArray(properties), node } function updateJsxAttributes(node, properties) { return node.properties !== properties ? updateNode(createJsxAttributes(properties), node) : node } function createJsxSpreadAttribute(expression) { var node = createSynthesizedNode(263); return node.expression = expression, node } function updateJsxSpreadAttribute(node, expression) { return node.expression !== expression ? updateNode(createJsxSpreadAttribute(expression), node) : node } function createJsxExpression(dotDotDotToken, expression) { var node = createSynthesizedNode(264); return node.dotDotDotToken = dotDotDotToken, node.expression = expression, node } function updateJsxExpression(node, expression) { return node.expression !== expression ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) : node } function createCaseClause(expression, statements) { var node = createSynthesizedNode(265); return node.expression = ts.parenthesizeExpressionForList(expression), node.statements = createNodeArray(statements), node } function updateCaseClause(node, expression, statements) { return node.expression !== expression || node.statements !== statements ? updateNode(createCaseClause(expression, statements), node) : node } function createDefaultClause(statements) { var node = createSynthesizedNode(266); return node.statements = createNodeArray(statements), node } function updateDefaultClause(node, statements) { return node.statements !== statements ? updateNode(createDefaultClause(statements), node) : node } function createHeritageClause(token, types) { var node = createSynthesizedNode(267); return node.token = token, node.types = createNodeArray(types), node } function updateHeritageClause(node, types) { return node.types !== types ? updateNode(createHeritageClause(node.token, types), node) : node } function createCatchClause(variableDeclaration, block) { var node = createSynthesizedNode(268); return node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration, node.block = block, node } function updateCatchClause(node, variableDeclaration, block) { return node.variableDeclaration !== variableDeclaration || node.block !== block ? updateNode(createCatchClause(variableDeclaration, block), node) : node } function createPropertyAssignment(name, initializer) { var node = createSynthesizedNode(269); return node.name = asName(name), node.questionToken = void 0, node.initializer = ts.parenthesizeExpressionForList(initializer), node } function updatePropertyAssignment(node, name, initializer) { return node.name !== name || node.initializer !== initializer ? updateNode(createPropertyAssignment(name, initializer), node) : node } function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { var node = createSynthesizedNode(270); return node.name = asName(name), node.objectAssignmentInitializer = void 0 !== objectAssignmentInitializer ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : void 0, node } function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { return node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer ? updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node) : node } function createSpreadAssignment(expression) { var node = createSynthesizedNode(271); return node.expression = void 0 !== expression ? ts.parenthesizeExpressionForList(expression) : void 0, node } function updateSpreadAssignment(node, expression) { return node.expression !== expression ? updateNode(createSpreadAssignment(expression), node) : node } function createEnumMember(name, initializer) { var node = createSynthesizedNode(272); return node.name = asName(name), node.initializer = initializer && ts.parenthesizeExpressionForList(initializer), node } function updateEnumMember(node, name, initializer) { return node.name !== name || node.initializer !== initializer ? updateNode(createEnumMember(name, initializer), node) : node } function updateSourceFileNode(node, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib) { if (node.statements !== statements || void 0 !== isDeclarationFile && node.isDeclarationFile !== isDeclarationFile || void 0 !== referencedFiles && node.referencedFiles !== referencedFiles || void 0 !== typeReferences && node.typeReferenceDirectives !== typeReferences || void 0 !== hasNoDefaultLib && node.hasNoDefaultLib !== hasNoDefaultLib) { var updated = createSynthesizedNode(273); return updated.flags |= node.flags, updated.statements = createNodeArray(statements), updated.endOfFileToken = node.endOfFileToken, updated.fileName = node.fileName, updated.path = node.path, updated.text = node.text, updated.isDeclarationFile = void 0 === isDeclarationFile ? node.isDeclarationFile : isDeclarationFile, updated.referencedFiles = void 0 === referencedFiles ? node.referencedFiles : referencedFiles, updated.typeReferenceDirectives = void 0 === typeReferences ? node.typeReferenceDirectives : typeReferences, updated.hasNoDefaultLib = void 0 === hasNoDefaultLib ? node.hasNoDefaultLib : hasNoDefaultLib, void 0 !== node.amdDependencies && (updated.amdDependencies = node.amdDependencies), void 0 !== node.moduleName && (updated.moduleName = node.moduleName), void 0 !== node.languageVariant && (updated.languageVariant = node.languageVariant), void 0 !== node.renamedDependencies && (updated.renamedDependencies = node.renamedDependencies), void 0 !== node.languageVersion && (updated.languageVersion = node.languageVersion), void 0 !== node.scriptKind && (updated.scriptKind = node.scriptKind), void 0 !== node.externalModuleIndicator && (updated.externalModuleIndicator = node.externalModuleIndicator), void 0 !== node.commonJsModuleIndicator && (updated.commonJsModuleIndicator = node.commonJsModuleIndicator), void 0 !== node.identifiers && (updated.identifiers = node.identifiers), void 0 !== node.nodeCount && (updated.nodeCount = node.nodeCount), void 0 !== node.identifierCount && (updated.identifierCount = node.identifierCount), void 0 !== node.symbolCount && (updated.symbolCount = node.symbolCount), void 0 !== node.parseDiagnostics && (updated.parseDiagnostics = node.parseDiagnostics), void 0 !== node.bindDiagnostics && (updated.bindDiagnostics = node.bindDiagnostics), void 0 !== node.bindSuggestionDiagnostics && (updated.bindSuggestionDiagnostics = node.bindSuggestionDiagnostics), void 0 !== node.lineMap && (updated.lineMap = node.lineMap), void 0 !== node.classifiableNames && (updated.classifiableNames = node.classifiableNames), void 0 !== node.resolvedModules && (updated.resolvedModules = node.resolvedModules), void 0 !== node.resolvedTypeReferenceDirectiveNames && (updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames), void 0 !== node.imports && (updated.imports = node.imports), void 0 !== node.moduleAugmentations && (updated.moduleAugmentations = node.moduleAugmentations), void 0 !== node.pragmas && (updated.pragmas = node.pragmas), void 0 !== node.localJsxFactory && (updated.localJsxFactory = node.localJsxFactory), void 0 !== node.localJsxNamespace && (updated.localJsxNamespace = node.localJsxNamespace), updateNode(updated, node) } return node } function getMutableClone(node) { var clone = getSynthesizedClone(node); return clone.pos = node.pos, clone.end = node.end, clone.parent = node.parent, clone } function createNotEmittedStatement(original) { var node = createSynthesizedNode(299); return node.original = original, setTextRange(node, original), node } function createEndOfDeclarationMarker(original) { var node = createSynthesizedNode(303); return node.emitNode = {}, node.original = original, node } function createMergeDeclarationMarker(original) { var node = createSynthesizedNode(302); return node.emitNode = {}, node.original = original, node } function createPartiallyEmittedExpression(expression, original) { var node = createSynthesizedNode(300); return node.expression = expression, node.original = original, setTextRange(node, original), node } function updatePartiallyEmittedExpression(node, expression) { return node.expression !== expression ? updateNode(createPartiallyEmittedExpression(expression, node.original), node) : node } function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { if (301 === node.kind) return node.elements; if (ts.isBinaryExpression(node) && 26 === node.operatorToken.kind) return [node.left, node.right] } return node } function createCommaList(elements) { var node = createSynthesizedNode(301); return node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)), node } function updateCommaList(node, elements) { return node.elements !== elements ? updateNode(createCommaList(elements), node) : node } function createBundle(sourceFiles, prepends) { void 0 === prepends && (prepends = ts.emptyArray); var node = ts.createNode(274); return node.prepends = prepends, node.sourceFiles = sourceFiles, node } function createUnparsedSourceFile(text) { var node = ts.createNode(275); return node.text = text, node } function createInputFiles(javascript, declaration) { var node = ts.createNode(276); return node.javascriptText = javascript, node.declarationText = declaration, node } function updateBundle(node, sourceFiles, prepends) { return void 0 === prepends && (prepends = ts.emptyArray), node.sourceFiles !== sourceFiles || node.prepends !== prepends ? createBundle(sourceFiles, prepends) : node } function createImmediatelyInvokedFunctionExpression(statements, param, paramValue) { return createCall(createFunctionExpression(void 0, void 0, void 0, void 0, param ? [param] : [], void 0, createBlock(statements, !0)), void 0, paramValue ? [paramValue] : []) } function createImmediatelyInvokedArrowFunction(statements, param, paramValue) { return createCall(createArrowFunction(void 0, void 0, param ? [param] : [], void 0, void 0, createBlock(statements, !0)), void 0, paramValue ? [paramValue] : []) } function createComma(left, right) { return createBinary(left, 26, right) } function createLessThan(left, right) { return createBinary(left, 27, right) } function createAssignment(left, right) { return createBinary(left, 58, right) } function createStrictEquality(left, right) { return createBinary(left, 34, right) } function createStrictInequality(left, right) { return createBinary(left, 35, right) } function createAdd(left, right) { return createBinary(left, 37, right) } function createSubtract(left, right) { return createBinary(left, 38, right) } function createPostfixIncrement(operand) { return createPostfix(operand, 43) } function createLogicalAnd(left, right) { return createBinary(left, 53, right) } function createLogicalOr(left, right) { return createBinary(left, 54, right) } function createLogicalNot(operand) { return createPrefix(51, operand) } function createVoidZero() { return createVoid(createLiteral(0)) } function createExportDefault(expression) { return createExportAssignment(void 0, void 0, !1, expression) } function createExternalModuleExport(exportName) { return createExportDeclaration(void 0, void 0, createNamedExports([createExportSpecifier(void 0, exportName)])) } function asName(name) { return ts.isString(name) ? createIdentifier(name) : name } function asExpression(value) { return ts.isString(value) || "number" == typeof value ? createLiteral(value) : value } function asNodeArray(array) { return array ? createNodeArray(array) : void 0 } function asToken(value) { return "number" == typeof value ? createToken(value) : value } function disposeEmitNodes(sourceFile) { sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); var emitNode = sourceFile && sourceFile.emitNode, annotatedNodes = emitNode && emitNode.annotatedNodes; if (annotatedNodes) for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { var node = annotatedNodes_1[_i]; node.emitNode = void 0 } } function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { if (273 === node.kind) return node.emitNode = { annotatedNodes: [node] }; var sourceFile = ts.getSourceFileOfNode(node); getOrCreateEmitNode(sourceFile).annotatedNodes.push(node) } node.emitNode = {} } return node.emitNode } function setTextRange(range, location) { return location && (range.pos = location.pos, range.end = location.end), range } function setEmitFlags(node, emitFlags) { return getOrCreateEmitNode(node).flags = emitFlags, node } function addEmitFlags(node, emitFlags) { var emitNode = getOrCreateEmitNode(node); return emitNode.flags = emitNode.flags | emitFlags, node } function getSourceMapRange(node) { var emitNode = node.emitNode; return emitNode && emitNode.sourceMapRange || node } function setSourceMapRange(node, range) { return getOrCreateEmitNode(node).sourceMapRange = range, node } function createSourceMapSource(fileName, text, skipTrivia) { return new (SourceMapSource || (SourceMapSource = ts.objectAllocator.getSourceMapSourceConstructor()))(fileName, text, skipTrivia) } function getTokenSourceMapRange(node, token) { var emitNode = node.emitNode, tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; return tokenSourceMapRanges && tokenSourceMapRanges[token] } function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node), tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); return tokenSourceMapRanges[token] = range, node } function getStartsOnNewLine(node) { var emitNode = node.emitNode; return emitNode && emitNode.startsOnNewLine } function setStartsOnNewLine(node, newLine) { return getOrCreateEmitNode(node).startsOnNewLine = newLine, node } function getCommentRange(node) { var emitNode = node.emitNode; return emitNode && emitNode.commentRange || node } function setCommentRange(node, range) { return getOrCreateEmitNode(node).commentRange = range, node } function getSyntheticLeadingComments(node) { var emitNode = node.emitNode; return emitNode && emitNode.leadingComments } function setSyntheticLeadingComments(node, comments) { return getOrCreateEmitNode(node).leadingComments = comments, node } function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })) } function getSyntheticTrailingComments(node) { var emitNode = node.emitNode; return emitNode && emitNode.trailingComments } function setSyntheticTrailingComments(node, comments) { return getOrCreateEmitNode(node).trailingComments = comments, node } function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })) } function moveSyntheticComments(node, original) { setSyntheticLeadingComments(node, getSyntheticLeadingComments(original)), setSyntheticTrailingComments(node, getSyntheticTrailingComments(original)); var emit = getOrCreateEmitNode(original); return emit.leadingComments = void 0, emit.trailingComments = void 0, node } function getConstantValue(node) { var emitNode = node.emitNode; return emitNode && emitNode.constantValue } function setConstantValue(node, value) { var emitNode = getOrCreateEmitNode(node); return emitNode.constantValue = value, node } function addEmitHelper(node, helper) { var emitNode = getOrCreateEmitNode(node); return emitNode.helpers = ts.append(emitNode.helpers, helper), node } function addEmitHelpers(node, helpers) { if (ts.some(helpers)) for (var emitNode = getOrCreateEmitNode(node), _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { var helper = helpers_1[_i]; emitNode.helpers = ts.appendIfUnique(emitNode.helpers, helper) } return node } function removeEmitHelper(node, helper) { var emitNode = node.emitNode; if (emitNode) { var helpers = emitNode.helpers; if (helpers) return ts.orderedRemoveItem(helpers, helper) } return !1 } function getEmitHelpers(node) { var emitNode = node.emitNode; return emitNode && emitNode.helpers } function moveEmitHelpers(source, target, predicate) { var sourceEmitNode = source.emitNode, sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; if (ts.some(sourceEmitHelpers)) { for (var targetEmitNode = getOrCreateEmitNode(target), helpersRemoved = 0, i = 0; i < sourceEmitHelpers.length; i++) { var helper = sourceEmitHelpers[i]; predicate(helper) ? (helpersRemoved++ , targetEmitNode.helpers = ts.appendIfUnique(targetEmitNode.helpers, helper)) : helpersRemoved > 0 && (sourceEmitHelpers[i - helpersRemoved] = helper) } helpersRemoved > 0 && (sourceEmitHelpers.length -= helpersRemoved) } } function compareEmitHelpers(x, y) { return x === y ? 0 : x.priority === y.priority ? 0 : void 0 === x.priority ? 1 : void 0 === y.priority ? -1 : ts.compareValues(x.priority, y.priority) } function setOriginalNode(node, original) { if (node.original = original, original) { var emitNode = original.emitNode; emitNode && (node.emitNode = mergeEmitNode(emitNode, node.emitNode)) } return node } function mergeEmitNode(sourceEmitNode, destEmitNode) { var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; return destEmitNode || (destEmitNode = {}), leadingComments && (destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments)), trailingComments && (destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments)), flags && (destEmitNode.flags = flags), commentRange && (destEmitNode.commentRange = commentRange), sourceMapRange && (destEmitNode.sourceMapRange = sourceMapRange), tokenSourceMapRanges && (destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges)), void 0 !== constantValue && (destEmitNode.constantValue = constantValue), helpers && (destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers)), void 0 !== startsOnNewLine && (destEmitNode.startsOnNewLine = startsOnNewLine), destEmitNode } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { destRanges || (destRanges = []); for (var key in sourceRanges) destRanges[key] = sourceRanges[key]; return destRanges } ts.updateNode = updateNode, ts.createNodeArray = createNodeArray, ts.getSynthesizedClone = getSynthesizedClone, ts.createLiteral = createLiteral, ts.createNumericLiteral = createNumericLiteral, ts.createStringLiteral = createStringLiteral, ts.createRegularExpressionLiteral = createRegularExpressionLiteral, ts.createIdentifier = createIdentifier, ts.updateIdentifier = updateIdentifier; var nextAutoGenerateId = 0; ts.createTempVariable = createTempVariable, ts.createLoopVariable = createLoopVariable, ts.createUniqueName = createUniqueName, ts.createOptimisticUniqueName = createOptimisticUniqueName, ts.createFileLevelUniqueName = createFileLevelUniqueName, ts.getGeneratedNameForNode = getGeneratedNameForNode, ts.createToken = createToken, ts.createSuper = createSuper, ts.createThis = createThis, ts.createNull = createNull, ts.createTrue = createTrue, ts.createFalse = createFalse, ts.createModifier = createModifier, ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags, ts.createQualifiedName = createQualifiedName, ts.updateQualifiedName = updateQualifiedName, ts.createComputedPropertyName = createComputedPropertyName, ts.updateComputedPropertyName = updateComputedPropertyName, ts.createTypeParameterDeclaration = createTypeParameterDeclaration, ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration, ts.createParameter = createParameter, ts.updateParameter = updateParameter, ts.createDecorator = createDecorator, ts.updateDecorator = updateDecorator, ts.createPropertySignature = createPropertySignature, ts.updatePropertySignature = updatePropertySignature, ts.createProperty = createProperty, ts.updateProperty = updateProperty, ts.createMethodSignature = createMethodSignature, ts.updateMethodSignature = updateMethodSignature, ts.createMethod = createMethod, ts.updateMethod = updateMethod, ts.createConstructor = createConstructor, ts.updateConstructor = updateConstructor, ts.createGetAccessor = createGetAccessor, ts.updateGetAccessor = updateGetAccessor, ts.createSetAccessor = createSetAccessor, ts.updateSetAccessor = updateSetAccessor, ts.createCallSignature = createCallSignature, ts.updateCallSignature = updateCallSignature, ts.createConstructSignature = createConstructSignature, ts.updateConstructSignature = updateConstructSignature, ts.createIndexSignature = createIndexSignature, ts.updateIndexSignature = updateIndexSignature, ts.createSignatureDeclaration = createSignatureDeclaration, ts.createKeywordTypeNode = createKeywordTypeNode, ts.createTypePredicateNode = createTypePredicateNode, ts.updateTypePredicateNode = updateTypePredicateNode, ts.createTypeReferenceNode = createTypeReferenceNode, ts.updateTypeReferenceNode = updateTypeReferenceNode, ts.createFunctionTypeNode = createFunctionTypeNode, ts.updateFunctionTypeNode = updateFunctionTypeNode, ts.createConstructorTypeNode = createConstructorTypeNode, ts.updateConstructorTypeNode = updateConstructorTypeNode, ts.createTypeQueryNode = createTypeQueryNode, ts.updateTypeQueryNode = updateTypeQueryNode, ts.createTypeLiteralNode = createTypeLiteralNode, ts.updateTypeLiteralNode = updateTypeLiteralNode, ts.createArrayTypeNode = createArrayTypeNode, ts.updateArrayTypeNode = updateArrayTypeNode, ts.createTupleTypeNode = createTupleTypeNode, ts.updateTypleTypeNode = updateTypleTypeNode, ts.createUnionTypeNode = createUnionTypeNode, ts.updateUnionTypeNode = updateUnionTypeNode, ts.createIntersectionTypeNode = createIntersectionTypeNode, ts.updateIntersectionTypeNode = updateIntersectionTypeNode, ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode, ts.createConditionalTypeNode = createConditionalTypeNode, ts.updateConditionalTypeNode = updateConditionalTypeNode, ts.createInferTypeNode = createInferTypeNode, ts.updateInferTypeNode = updateInferTypeNode, ts.createImportTypeNode = createImportTypeNode, ts.updateImportTypeNode = updateImportTypeNode, ts.createParenthesizedType = createParenthesizedType, ts.updateParenthesizedType = updateParenthesizedType, ts.createThisTypeNode = createThisTypeNode, ts.createTypeOperatorNode = createTypeOperatorNode, ts.updateTypeOperatorNode = updateTypeOperatorNode, ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode, ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode, ts.createMappedTypeNode = createMappedTypeNode, ts.updateMappedTypeNode = updateMappedTypeNode, ts.createLiteralTypeNode = createLiteralTypeNode, ts.updateLiteralTypeNode = updateLiteralTypeNode, ts.createObjectBindingPattern = createObjectBindingPattern, ts.updateObjectBindingPattern = updateObjectBindingPattern, ts.createArrayBindingPattern = createArrayBindingPattern, ts.updateArrayBindingPattern = updateArrayBindingPattern, ts.createBindingElement = createBindingElement, ts.updateBindingElement = updateBindingElement, ts.createArrayLiteral = createArrayLiteral, ts.updateArrayLiteral = updateArrayLiteral, ts.createObjectLiteral = createObjectLiteral, ts.updateObjectLiteral = updateObjectLiteral, ts.createPropertyAccess = createPropertyAccess, ts.updatePropertyAccess = updatePropertyAccess, ts.createElementAccess = createElementAccess, ts.updateElementAccess = updateElementAccess, ts.createCall = createCall, ts.updateCall = updateCall, ts.createNew = createNew, ts.updateNew = updateNew, ts.createTaggedTemplate = createTaggedTemplate, ts.updateTaggedTemplate = updateTaggedTemplate, ts.createTypeAssertion = createTypeAssertion, ts.updateTypeAssertion = updateTypeAssertion, ts.createParen = createParen, ts.updateParen = updateParen, ts.createFunctionExpression = createFunctionExpression, ts.updateFunctionExpression = updateFunctionExpression, ts.createArrowFunction = createArrowFunction, ts.updateArrowFunction = updateArrowFunction, ts.createDelete = createDelete, ts.updateDelete = updateDelete, ts.createTypeOf = createTypeOf, ts.updateTypeOf = updateTypeOf, ts.createVoid = createVoid, ts.updateVoid = updateVoid, ts.createAwait = createAwait, ts.updateAwait = updateAwait, ts.createPrefix = createPrefix, ts.updatePrefix = updatePrefix, ts.createPostfix = createPostfix, ts.updatePostfix = updatePostfix, ts.createBinary = createBinary, ts.updateBinary = updateBinary, ts.createConditional = createConditional, ts.updateConditional = updateConditional, ts.createTemplateExpression = createTemplateExpression, ts.updateTemplateExpression = updateTemplateExpression, ts.createTemplateHead = createTemplateHead, ts.createTemplateMiddle = createTemplateMiddle, ts.createTemplateTail = createTemplateTail, ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral, ts.createYield = createYield, ts.updateYield = updateYield, ts.createSpread = createSpread, ts.updateSpread = updateSpread, ts.createClassExpression = createClassExpression, ts.updateClassExpression = updateClassExpression, ts.createOmittedExpression = createOmittedExpression, ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments, ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments, ts.createAsExpression = createAsExpression, ts.updateAsExpression = updateAsExpression, ts.createNonNullExpression = createNonNullExpression, ts.updateNonNullExpression = updateNonNullExpression, ts.createMetaProperty = createMetaProperty, ts.updateMetaProperty = updateMetaProperty, ts.createTemplateSpan = createTemplateSpan, ts.updateTemplateSpan = updateTemplateSpan, ts.createSemicolonClassElement = createSemicolonClassElement, ts.createBlock = createBlock, ts.createExpressionStatement = createExpressionStatement, ts.updateBlock = updateBlock, ts.createVariableStatement = createVariableStatement, ts.updateVariableStatement = updateVariableStatement, ts.createEmptyStatement = createEmptyStatement, ts.createStatement = createStatement, ts.updateStatement = updateStatement, ts.createIf = createIf, ts.updateIf = updateIf, ts.createDo = createDo, ts.updateDo = updateDo, ts.createWhile = createWhile, ts.updateWhile = updateWhile, ts.createFor = createFor, ts.updateFor = updateFor, ts.createForIn = createForIn, ts.updateForIn = updateForIn, ts.createForOf = createForOf, ts.updateForOf = updateForOf, ts.createContinue = createContinue, ts.updateContinue = updateContinue, ts.createBreak = createBreak, ts.updateBreak = updateBreak, ts.createReturn = createReturn, ts.updateReturn = updateReturn, ts.createWith = createWith, ts.updateWith = updateWith, ts.createSwitch = createSwitch, ts.updateSwitch = updateSwitch, ts.createLabel = createLabel, ts.updateLabel = updateLabel, ts.createThrow = createThrow, ts.updateThrow = updateThrow, ts.createTry = createTry, ts.updateTry = updateTry, ts.createDebuggerStatement = createDebuggerStatement, ts.createVariableDeclaration = createVariableDeclaration, ts.updateVariableDeclaration = updateVariableDeclaration, ts.createVariableDeclarationList = createVariableDeclarationList, ts.updateVariableDeclarationList = updateVariableDeclarationList, ts.createFunctionDeclaration = createFunctionDeclaration, ts.updateFunctionDeclaration = updateFunctionDeclaration, ts.createClassDeclaration = createClassDeclaration, ts.updateClassDeclaration = updateClassDeclaration, ts.createInterfaceDeclaration = createInterfaceDeclaration, ts.updateInterfaceDeclaration = updateInterfaceDeclaration, ts.createTypeAliasDeclaration = createTypeAliasDeclaration; ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; ts.createEnumDeclaration = createEnumDeclaration, ts.updateEnumDeclaration = updateEnumDeclaration, ts.createModuleDeclaration = createModuleDeclaration, ts.updateModuleDeclaration = updateModuleDeclaration, ts.createModuleBlock = createModuleBlock, ts.updateModuleBlock = updateModuleBlock, ts.createCaseBlock = createCaseBlock, ts.updateCaseBlock = updateCaseBlock, ts.createNamespaceExportDeclaration = createNamespaceExportDeclaration, ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration, ts.createImportEqualsDeclaration = createImportEqualsDeclaration, ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration, ts.createImportDeclaration = createImportDeclaration, ts.updateImportDeclaration = updateImportDeclaration, ts.createImportClause = createImportClause, ts.updateImportClause = updateImportClause, ts.createNamespaceImport = createNamespaceImport, ts.updateNamespaceImport = updateNamespaceImport, ts.createNamedImports = createNamedImports, ts.updateNamedImports = updateNamedImports, ts.createImportSpecifier = createImportSpecifier, ts.updateImportSpecifier = updateImportSpecifier, ts.createExportAssignment = createExportAssignment, ts.updateExportAssignment = updateExportAssignment, ts.createExportDeclaration = createExportDeclaration, ts.updateExportDeclaration = updateExportDeclaration, ts.createNamedExports = createNamedExports, ts.updateNamedExports = updateNamedExports, ts.createExportSpecifier = createExportSpecifier, ts.updateExportSpecifier = updateExportSpecifier, ts.createExternalModuleReference = createExternalModuleReference, ts.updateExternalModuleReference = updateExternalModuleReference, ts.createJsxElement = createJsxElement, ts.updateJsxElement = updateJsxElement, ts.createJsxSelfClosingElement = createJsxSelfClosingElement, ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement, ts.createJsxOpeningElement = createJsxOpeningElement, ts.updateJsxOpeningElement = updateJsxOpeningElement, ts.createJsxClosingElement = createJsxClosingElement, ts.updateJsxClosingElement = updateJsxClosingElement, ts.createJsxFragment = createJsxFragment, ts.updateJsxFragment = updateJsxFragment, ts.createJsxAttribute = createJsxAttribute, ts.updateJsxAttribute = updateJsxAttribute, ts.createJsxAttributes = createJsxAttributes, ts.updateJsxAttributes = updateJsxAttributes, ts.createJsxSpreadAttribute = createJsxSpreadAttribute, ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute, ts.createJsxExpression = createJsxExpression, ts.updateJsxExpression = updateJsxExpression, ts.createCaseClause = createCaseClause, ts.updateCaseClause = updateCaseClause, ts.createDefaultClause = createDefaultClause, ts.updateDefaultClause = updateDefaultClause, ts.createHeritageClause = createHeritageClause, ts.updateHeritageClause = updateHeritageClause, ts.createCatchClause = createCatchClause, ts.updateCatchClause = updateCatchClause, ts.createPropertyAssignment = createPropertyAssignment, ts.updatePropertyAssignment = updatePropertyAssignment, ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment, ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment, ts.createSpreadAssignment = createSpreadAssignment, ts.updateSpreadAssignment = updateSpreadAssignment, ts.createEnumMember = createEnumMember, ts.updateEnumMember = updateEnumMember, ts.updateSourceFileNode = updateSourceFileNode, ts.getMutableClone = getMutableClone, ts.createNotEmittedStatement = createNotEmittedStatement, ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker, ts.createMergeDeclarationMarker = createMergeDeclarationMarker, ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression, ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression, ts.createCommaList = createCommaList, ts.updateCommaList = updateCommaList, ts.createBundle = createBundle, ts.createUnparsedSourceFile = createUnparsedSourceFile, ts.createInputFiles = createInputFiles, ts.updateBundle = updateBundle, ts.createImmediatelyInvokedFunctionExpression = createImmediatelyInvokedFunctionExpression, ts.createImmediatelyInvokedArrowFunction = createImmediatelyInvokedArrowFunction, ts.createComma = createComma, ts.createLessThan = createLessThan, ts.createAssignment = createAssignment, ts.createStrictEquality = createStrictEquality, ts.createStrictInequality = createStrictInequality, ts.createAdd = createAdd, ts.createSubtract = createSubtract, ts.createPostfixIncrement = createPostfixIncrement, ts.createLogicalAnd = createLogicalAnd, ts.createLogicalOr = createLogicalOr, ts.createLogicalNot = createLogicalNot, ts.createVoidZero = createVoidZero, ts.createExportDefault = createExportDefault, ts.createExternalModuleExport = createExternalModuleExport, ts.disposeEmitNodes = disposeEmitNodes, ts.getOrCreateEmitNode = getOrCreateEmitNode, ts.setTextRange = setTextRange, ts.setEmitFlags = setEmitFlags, ts.addEmitFlags = addEmitFlags, ts.getSourceMapRange = getSourceMapRange, ts.setSourceMapRange = setSourceMapRange; var SourceMapSource; ts.createSourceMapSource = createSourceMapSource, ts.getTokenSourceMapRange = getTokenSourceMapRange, ts.setTokenSourceMapRange = setTokenSourceMapRange, ts.getStartsOnNewLine = getStartsOnNewLine, ts.setStartsOnNewLine = setStartsOnNewLine, ts.getCommentRange = getCommentRange, ts.setCommentRange = setCommentRange, ts.getSyntheticLeadingComments = getSyntheticLeadingComments, ts.setSyntheticLeadingComments = setSyntheticLeadingComments, ts.addSyntheticLeadingComment = addSyntheticLeadingComment, ts.getSyntheticTrailingComments = getSyntheticTrailingComments, ts.setSyntheticTrailingComments = setSyntheticTrailingComments, ts.addSyntheticTrailingComment = addSyntheticTrailingComment, ts.moveSyntheticComments = moveSyntheticComments, ts.getConstantValue = getConstantValue, ts.setConstantValue = setConstantValue, ts.addEmitHelper = addEmitHelper, ts.addEmitHelpers = addEmitHelpers, ts.removeEmitHelper = removeEmitHelper, ts.getEmitHelpers = getEmitHelpers, ts.moveEmitHelpers = moveEmitHelpers, ts.compareEmitHelpers = compareEmitHelpers, ts.setOriginalNode = setOriginalNode }(ts || (ts = {})), function (ts) { function createTypeCheck(value, tag) { return "undefined" === tag ? ts.createStrictEquality(value, ts.createVoidZero()) : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)) } function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); var expression = ts.setTextRange(ts.isIdentifier(memberName) ? ts.createPropertyAccess(target, memberName) : ts.createElementAccess(target, memberName), memberName); return ts.getOrCreateEmitNode(expression).flags |= 64, expression } function createFunctionCall(func, thisArg, argumentsList, location) { return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), void 0, [thisArg].concat(argumentsList)), location) } function createFunctionApply(func, thisArg, argumentsExpression, location) { return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), void 0, [thisArg, argumentsExpression]), location) } function createArraySlice(array, start) { var argumentsList = []; return void 0 !== start && argumentsList.push("number" == typeof start ? ts.createLiteral(start) : start), ts.createCall(ts.createPropertyAccess(array, "slice"), void 0, argumentsList) } function createArrayConcat(array, values) { return ts.createCall(ts.createPropertyAccess(array, "concat"), void 0, values) } function createMathPow(left, right, location) { return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), void 0, [left, right]), location) } function createReactNamespace(reactNamespace, parent) { var react = ts.createIdentifier(reactNamespace || "React"); return react.flags &= -9, react.parent = ts.getParseTreeNode(parent), react } function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), right = ts.createIdentifier(ts.idText(jsxFactory.right)); return right.escapedText = jsxFactory.right.escapedText, ts.createPropertyAccess(left, right) } return createReactNamespace(ts.idText(jsxFactory), parent) } function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement") } function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { var argumentsList = [tagName]; if (props && argumentsList.push(props), children && children.length > 0) if (props || argumentsList.push(ts.createNull()), children.length > 1) for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { var child = children_1[_i]; startOnNewLine(child), argumentsList.push(child) } else argumentsList.push(children[0]); return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), void 0, argumentsList), location) } function createExpressionForJsxFragment(jsxFactoryEntity, reactNamespace, children, parentElement, location) { var tagName = ts.createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "Fragment"), argumentsList = [tagName]; if (argumentsList.push(ts.createNull()), children && children.length > 0) if (children.length > 1) for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { var child = children_2[_i]; startOnNewLine(child), argumentsList.push(child) } else argumentsList.push(children[0]); return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), void 0, argumentsList), location) } function getHelperName(name) { return ts.setEmitFlags(ts.createIdentifier(name), 4098) } function createValuesHelper(context, expression, location) { return context.requestEmitHelper(valuesHelper), ts.setTextRange(ts.createCall(getHelperName("__values"), void 0, [expression]), location) } function createReadHelper(context, iteratorRecord, count, location) { return context.requestEmitHelper(readHelper), ts.setTextRange(ts.createCall(getHelperName("__read"), void 0, void 0 !== count ? [iteratorRecord, ts.createLiteral(count)] : [iteratorRecord]), location) } function createSpreadHelper(context, argumentList, location) { return context.requestEmitHelper(readHelper), context.requestEmitHelper(spreadHelper), ts.setTextRange(ts.createCall(getHelperName("__spread"), void 0, argumentList), location) } function createForOfBindingStatement(node, boundValue) { if (ts.isVariableDeclarationList(node)) { var firstDeclaration = ts.firstOrUndefined(node.declarations), updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, void 0, boundValue); return ts.setTextRange(ts.createVariableStatement(void 0, ts.updateVariableDeclarationList(node, [updatedDeclaration])), node) } var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), node); return ts.setTextRange(ts.createStatement(updatedExpression), node) } function insertLeadingStatement(dest, source) { return ts.isBlock(dest) ? ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)) : ts.createBlock(ts.createNodeArray([dest, source]), !0) } function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { if (!outermostLabeledStatement) return node; var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, 227 === outermostLabeledStatement.statement.kind ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); return afterRestoreLabelCallback && afterRestoreLabelCallback(outermostLabeledStatement), updated } function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = ts.skipParentheses(node); switch (target.kind) { case 71: return cacheIdentifiers; case 99: case 8: case 9: return !1; case 182: var elements = target.elements; return 0 !== elements.length; case 183: return target.properties.length > 0; default: return !0 } } function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) { var thisArg, target, callee = skipOuterExpressions(expression, 7); if (ts.isSuperProperty(callee)) thisArg = ts.createThis(), target = callee; else if (97 === callee.kind) thisArg = ts.createThis(), target = languageVersion < 2 ? ts.setTextRange(ts.createIdentifier("_super"), callee) : callee; else if (4096 & ts.getEmitFlags(callee)) thisArg = ts.createVoidZero(), target = parenthesizeForAccess(callee); else switch (callee.kind) { case 184: shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers) ? (thisArg = ts.createTempVariable(recordTempVariable), target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name), ts.setTextRange(target, callee)) : (thisArg = callee.expression, target = callee); break; case 185: shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers) ? (thisArg = ts.createTempVariable(recordTempVariable), target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression), ts.setTextRange(target, callee)) : (thisArg = callee.expression, target = callee); break; default: thisArg = ts.createVoidZero(), target = parenthesizeForAccess(expression) }return { target: target, thisArg: thisArg } } function inlineExpressions(expressions) { return expressions.length > 10 ? ts.createCommaList(expressions) : ts.reduceLeft(expressions, ts.createComma) } function createExpressionFromEntityName(node) { if (ts.isQualifiedName(node)) { var left = createExpressionFromEntityName(node.left), right = ts.getMutableClone(node.right); return ts.setTextRange(ts.createPropertyAccess(left, right), node) } return ts.getMutableClone(node) } function createExpressionForPropertyName(memberName) { return ts.isIdentifier(memberName) ? ts.createLiteral(memberName) : ts.isComputedPropertyName(memberName) ? ts.getMutableClone(memberName.expression) : ts.getMutableClone(memberName) } function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { case 155: case 156: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); case 269: return createExpressionForPropertyAssignment(property, receiver); case 270: return createExpressionForShorthandPropertyAssignment(property, receiver); case 153: return createExpressionForMethodDeclaration(property, receiver) } } function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) { var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; if (property === firstAccessor) { var properties_9 = []; if (getAccessor) { var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, void 0, void 0, void 0, getAccessor.parameters, void 0, getAccessor.body); ts.setTextRange(getterFunction, getAccessor), ts.setOriginalNode(getterFunction, getAccessor); var getter = ts.createPropertyAssignment("get", getterFunction); properties_9.push(getter) } if (setAccessor) { var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, void 0, void 0, void 0, setAccessor.parameters, void 0, setAccessor.body); ts.setTextRange(setterFunction, setAccessor), ts.setOriginalNode(setterFunction, setAccessor); var setter = ts.createPropertyAssignment("set", setterFunction); properties_9.push(setter) } properties_9.push(ts.createPropertyAssignment("enumerable", ts.createTrue())), properties_9.push(ts.createPropertyAssignment("configurable", ts.createTrue())); var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), void 0, [receiver, createExpressionForPropertyName(property.name), ts.createObjectLiteral(properties_9, multiLine)]), firstAccessor); return ts.aggregateTransformFlags(expression) } } function createExpressionForPropertyAssignment(property, receiver) { return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer), property), property)) } function createExpressionForShorthandPropertyAssignment(property, receiver) { return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), ts.getSynthesizedClone(property.name)), property), property)) } function createExpressionForMethodDeclaration(method, receiver) { return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, void 0, void 0, method.parameters, void 0, method.body), method), method)), method), method)) } function getInternalName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 49152) } function isInternalName(node) { return 0 !== (32768 & ts.getEmitFlags(node)) } function getLocalName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 16384) } function isLocalName(node) { return 0 !== (16384 & ts.getEmitFlags(node)) } function getExportName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 8192) } function isExportName(node) { return 0 !== (8192 & ts.getEmitFlags(node)) } function getDeclarationName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps) } function getName(node, allowComments, allowSourceMaps, emitFlags) { var nodeName = ts.getNameOfDeclaration(node); if (nodeName && ts.isIdentifier(nodeName) && !ts.isGeneratedIdentifier(nodeName)) { var name = ts.getMutableClone(nodeName); return emitFlags |= ts.getEmitFlags(nodeName), allowSourceMaps || (emitFlags |= 48), allowComments || (emitFlags |= 1536), emitFlags && ts.setEmitFlags(name, emitFlags), name } return ts.getGeneratedNameForNode(node) } function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { return ns && ts.hasModifier(node, 1) ? getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps) : getExportName(node, allowComments, allowSourceMaps) } function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); ts.setTextRange(qualifiedName, name); var emitFlags; return allowSourceMaps || (emitFlags |= 48), allowComments || (emitFlags |= 1536), emitFlags && ts.setEmitFlags(qualifiedName, emitFlags), qualifiedName } function convertToFunctionBody(node, multiLine) { return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node) } function convertFunctionDeclarationToExpression(node) { ts.Debug.assert(!!node.body); var updated = ts.createFunctionExpression(node.modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body); return ts.setOriginalNode(updated, node), ts.setTextRange(updated, node), ts.getStartsOnNewLine(node) && ts.setStartsOnNewLine(updated, !0), ts.aggregateTransformFlags(updated), updated } function isUseStrictPrologue(node) { return ts.isStringLiteral(node.expression) && "use strict" === node.expression.text } function addPrologue(target, source, ensureUseStrict, visitor) { var offset = addStandardPrologue(target, source, ensureUseStrict); return addCustomPrologue(target, source, offset, visitor) } function addStandardPrologue(target, source, ensureUseStrict) { ts.Debug.assert(0 === target.length, "Prologue directives should be at the first statement in the target statements array"); for (var foundUseStrict = !1, statementOffset = 0, numStatements = source.length; statementOffset < numStatements;) { var statement = source[statementOffset]; if (!ts.isPrologueDirective(statement)) break; isUseStrictPrologue(statement) && (foundUseStrict = !0), target.push(statement), statementOffset++ } return ensureUseStrict && !foundUseStrict && target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))), statementOffset } function addCustomPrologue(target, source, statementOffset, visitor) { for (var numStatements = source.length; statementOffset < numStatements;) { var statement = source[statementOffset]; if (!(1048576 & ts.getEmitFlags(statement))) break; ts.append(target, visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement), statementOffset++ } return statementOffset } function startsWithUseStrict(statements) { var firstStatement = ts.firstOrUndefined(statements); return void 0 !== firstStatement && ts.isPrologueDirective(firstStatement) && isUseStrictPrologue(firstStatement) } function ensureUseStrict(statements) { for (var foundUseStrict = !1, _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; if (!ts.isPrologueDirective(statement)) break; if (isUseStrictPrologue(statement)) { foundUseStrict = !0; break } } return foundUseStrict ? statements : ts.setTextRange(ts.createNodeArray([startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))].concat(statements)), statements) } function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); return 190 === skipped.kind ? operand : binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) ? ts.createParen(operand) : operand } function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var binaryOperatorPrecedence = ts.getOperatorPrecedence(199, binaryOperator), binaryOperatorAssociativity = ts.getOperatorAssociativity(199, binaryOperator), emittedOperand = ts.skipPartiallyEmittedExpressions(operand), operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: return !(!isLeftSideOfBinary && 1 === binaryOperatorAssociativity && 202 === operand.kind); case 1: return !1; case 0: if (isLeftSideOfBinary) return 1 === binaryOperatorAssociativity; if (ts.isBinaryExpression(emittedOperand) && emittedOperand.operatorToken.kind === binaryOperator) { if (operatorHasAssociativeProperty(binaryOperator)) return !1; if (37 === binaryOperator) { var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0; if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) return !1 } } var operandAssociativity = ts.getExpressionAssociativity(emittedOperand); return 0 === operandAssociativity } } function operatorHasAssociativeProperty(binaryOperator) { return 39 === binaryOperator || 49 === binaryOperator || 48 === binaryOperator || 50 === binaryOperator } function getLiteralKindOfBinaryPlusOperand(node) { if (node = ts.skipPartiallyEmittedExpressions(node), ts.isLiteralKind(node.kind)) return node.kind; if (199 === node.kind && 37 === node.operatorToken.kind) { if (void 0 !== node.cachedLiteralKind) return node.cachedLiteralKind; var leftKind = getLiteralKindOfBinaryPlusOperand(node.left), literalKind = ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(node.right) ? leftKind : 0; return node.cachedLiteralKind = literalKind, literalKind } return 0 } function parenthesizeForConditionalHead(condition) { var conditionalPrecedence = ts.getOperatorPrecedence(200, 55), emittedCondition = ts.skipPartiallyEmittedExpressions(condition), conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); return ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 ? ts.createParen(condition) : condition } function parenthesizeSubexpressionOfConditionalExpression(e) { var emittedExpression = ts.skipPartiallyEmittedExpressions(e); return 199 === emittedExpression.kind && 26 === emittedExpression.operatorToken.kind || 301 === emittedExpression.kind ? ts.createParen(e) : e } function parenthesizeDefaultExpression(e) { var check = ts.skipPartiallyEmittedExpressions(e); return 204 === check.kind || 191 === check.kind || 301 === check.kind || ts.isBinaryExpression(check) && 26 === check.operatorToken.kind ? ts.createParen(e) : e } function parenthesizeForNew(expression) { var leftmostExpr = getLeftmostExpression(expression, !0); switch (leftmostExpr.kind) { case 186: return ts.createParen(expression); case 187: return leftmostExpr.arguments ? expression : ts.createParen(expression) }return parenthesizeForAccess(expression) } function parenthesizeForAccess(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); return ts.isLeftHandSideExpression(emittedExpression) && (187 !== emittedExpression.kind || emittedExpression.arguments) ? expression : ts.setTextRange(ts.createParen(expression), expression) } function parenthesizePostfixOperand(operand) { return ts.isLeftHandSideExpression(operand) ? operand : ts.setTextRange(ts.createParen(operand), operand) } function parenthesizePrefixOperand(operand) { return ts.isUnaryExpression(operand) ? operand : ts.setTextRange(ts.createParen(operand), operand) } function parenthesizeListElements(elements) { for (var result, i = 0; i < elements.length; i++) { var element = parenthesizeExpressionForList(elements[i]); void 0 === result && element === elements[i] || (void 0 === result && (result = elements.slice(0, i)), result.push(element)) } return void 0 !== result ? ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements) : elements } function parenthesizeExpressionForList(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression), expressionPrecedence = ts.getExpressionPrecedence(emittedExpression), commaPrecedence = ts.getOperatorPrecedence(199, 26); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(ts.createParen(expression), expression) } function parenthesizeExpressionForExpressionStatement(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression, kind = ts.skipPartiallyEmittedExpressions(callee).kind; if (191 === kind || 192 === kind) { var mutableCall = ts.getMutableClone(emittedExpression); return mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee), recreateOuterExpressions(expression, mutableCall, 4) } } var leftmostExpressionKind = getLeftmostExpression(emittedExpression, !1).kind; return 183 === leftmostExpressionKind || 191 === leftmostExpressionKind ? ts.setTextRange(ts.createParen(expression), expression) : expression } function parenthesizeConditionalTypeMember(member) { return 170 === member.kind ? ts.createParenthesizedType(member) : member } function parenthesizeElementTypeMember(member) { switch (member.kind) { case 168: case 169: case 162: case 163: return ts.createParenthesizedType(member) }return parenthesizeConditionalTypeMember(member) } function parenthesizeArrayTypeMember(member) { switch (member.kind) { case 164: case 174: case 171: return ts.createParenthesizedType(member) }return parenthesizeElementTypeMember(member) } function parenthesizeElementTypeMembers(members) { return ts.createNodeArray(ts.sameMap(members, parenthesizeElementTypeMember)) } function parenthesizeTypeParameters(typeParameters) { if (ts.some(typeParameters)) { for (var params = [], i = 0; i < typeParameters.length; ++i) { var entry = typeParameters[i]; params.push(0 === i && ts.isFunctionOrConstructorTypeNode(entry) && entry.typeParameters ? ts.createParenthesizedType(entry) : entry) } return ts.createNodeArray(params) } } function getLeftmostExpression(node, stopAtCallExpressions) { for (; ;) { switch (node.kind) { case 198: node = node.operand; continue; case 199: node = node.left; continue; case 200: node = node.condition; continue; case 186: if (stopAtCallExpressions) return node; case 185: case 184: node = node.expression; continue; case 300: node = node.expression; continue }return node } } function parenthesizeConciseBody(body) { return ts.isBlock(body) || 183 !== getLeftmostExpression(body, !1).kind ? body : ts.setTextRange(ts.createParen(body), body) } function isOuterExpression(node, kinds) { switch (void 0 === kinds && (kinds = 7), node.kind) { case 190: return 0 !== (1 & kinds); case 189: case 207: case 208: return 0 !== (2 & kinds); case 300: return 0 !== (4 & kinds) }return !1 } function skipOuterExpressions(node, kinds) { void 0 === kinds && (kinds = 7); var previousNode; do previousNode = node, 1 & kinds && (node = ts.skipParentheses(node)), 2 & kinds && (node = skipAssertions(node)), 4 & kinds && (node = ts.skipPartiallyEmittedExpressions(node)); while (previousNode !== node); return node } function skipAssertions(node) { for (; ts.isAssertionExpression(node) || 208 === node.kind;)node = node.expression; return node } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { case 190: return ts.updateParen(outerExpression, expression); case 189: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); case 207: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); case 208: return ts.updateNonNullExpression(outerExpression, expression); case 300: return ts.updatePartiallyEmittedExpression(outerExpression, expression) } } function isIgnorableParen(node) { return 190 === node.kind && ts.nodeIsSynthesized(node) && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) && ts.nodeIsSynthesized(ts.getCommentRange(node)) && !ts.some(ts.getSyntheticLeadingComments(node)) && !ts.some(ts.getSyntheticTrailingComments(node)) } function recreateOuterExpressions(outerExpression, innerExpression, kinds) { return void 0 === kinds && (kinds = 7), outerExpression && isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression) ? updateOuterExpression(outerExpression, recreateOuterExpressions(outerExpression.expression, innerExpression)) : innerExpression } function startOnNewLine(node) { return ts.setStartsOnNewLine(node, !0) } function getExternalHelpersModuleName(node) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile), emitNode = parseNode && parseNode.emitNode; return emitNode && emitNode.externalHelpersModuleName } function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) { if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) { var externalHelpersModuleName = getExternalHelpersModuleName(node); if (externalHelpersModuleName) return externalHelpersModuleName; var moduleKind = ts.getEmitModuleKind(compilerOptions), create = (hasExportStarsToExportValues || compilerOptions.esModuleInterop && hasImportStarOrImportDefault) && moduleKind !== ts.ModuleKind.System && moduleKind !== ts.ModuleKind.ES2015 && moduleKind !== ts.ModuleKind.ESNext; if (!create) { var helpers = ts.getEmitHelpers(node); if (helpers) for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { var helper = helpers_2[_i]; if (!helper.scoped) { create = !0; break } } } if (create) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile), emitNode = ts.getOrCreateEmitNode(parseNode); return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)) } } } function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)) } return 243 === node.kind && node.importClause ? ts.getGeneratedNameForNode(node) : 249 === node.kind && node.moduleSpecifier ? ts.getGeneratedNameForNode(node) : void 0 } function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) { var moduleName = ts.getExternalModuleName(importNode); if (9 === moduleName.kind) return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) || tryRenameExternalModule(moduleName, sourceFile) || ts.getSynthesizedClone(moduleName) } function tryRenameExternalModule(moduleName, sourceFile) { var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); return rename && ts.createLiteral(rename) } function tryGetModuleNameFromFile(file, host, options) { if (file) return file.moduleName ? ts.createLiteral(file.moduleName) : file.isDeclarationFile || !options.out && !options.outFile ? void 0 : ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)) } function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) { return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions) } function getInitializerOfBindingOrAssignmentElement(bindingElement) { return ts.isDeclarationBindingElement(bindingElement) ? bindingElement.initializer : ts.isPropertyAssignment(bindingElement) ? ts.isAssignmentExpression(bindingElement.initializer, !0) ? bindingElement.initializer.right : void 0 : ts.isShorthandPropertyAssignment(bindingElement) ? bindingElement.objectAssignmentInitializer : ts.isAssignmentExpression(bindingElement, !0) ? bindingElement.right : ts.isSpreadElement(bindingElement) ? getInitializerOfBindingOrAssignmentElement(bindingElement.expression) : void 0 } function getTargetOfBindingOrAssignmentElement(bindingElement) { if (ts.isDeclarationBindingElement(bindingElement)) return bindingElement.name; { if (!ts.isObjectLiteralElementLike(bindingElement)) return ts.isAssignmentExpression(bindingElement, !0) ? getTargetOfBindingOrAssignmentElement(bindingElement.left) : ts.isSpreadElement(bindingElement) ? getTargetOfBindingOrAssignmentElement(bindingElement.expression) : bindingElement; switch (bindingElement.kind) { case 269: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 270: return bindingElement.name; case 271: return getTargetOfBindingOrAssignmentElement(bindingElement.expression) } } } function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { case 148: case 181: return bindingElement.dotDotDotToken; case 203: case 271: return bindingElement } } function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { case 181: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName } break; case 269: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName } break; case 271: return bindingElement.name }var target = getTargetOfBindingOrAssignmentElement(bindingElement); return target && ts.isPropertyName(target) ? ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) ? target.expression : target : void ts.Debug.fail("Invalid property name for binding element.") } function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { case 179: case 180: case 182: return name.elements; case 183: return name.properties } } function convertToArrayAssignmentElement(element) { if (ts.isBindingElement(element)) { if (element.dotDotDotToken) return ts.Debug.assertNode(element.name, ts.isIdentifier), ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); var expression = convertToAssignmentElementTarget(element.name); return element.initializer ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) : expression; } return ts.Debug.assertNode(element, ts.isExpression), element } function convertToObjectAssignmentElement(element) { if (ts.isBindingElement(element)) { if (element.dotDotDotToken) return ts.Debug.assertNode(element.name, ts.isIdentifier), ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); if (element.propertyName) { var expression = convertToAssignmentElementTarget(element.name); return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element) } return ts.Debug.assertNode(element.name, ts.isIdentifier), ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element) } return ts.Debug.assertNode(element, ts.isObjectLiteralElementLike), element } function convertToAssignmentPattern(node) { switch (node.kind) { case 180: case 182: return convertToArrayAssignmentPattern(node); case 179: case 183: return convertToObjectAssignmentPattern(node) } } function convertToObjectAssignmentPattern(node) { return ts.isObjectBindingPattern(node) ? ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node) : (ts.Debug.assertNode(node, ts.isObjectLiteralExpression), node) } function convertToArrayAssignmentPattern(node) { return ts.isArrayBindingPattern(node) ? ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node) : (ts.Debug.assertNode(node, ts.isArrayLiteralExpression), node) } function convertToAssignmentElementTarget(node) { return ts.isBindingPattern(node) ? convertToAssignmentPattern(node) : (ts.Debug.assertNode(node, ts.isExpression), node) } ts.nullTransformationContext = { enableEmitNotification: ts.noop, enableSubstitution: ts.noop, endLexicalEnvironment: function () { }, getCompilerOptions: ts.notImplemented, getEmitHost: ts.notImplemented, getEmitResolver: ts.notImplemented, hoistFunctionDeclaration: ts.noop, hoistVariableDeclaration: ts.noop, isEmitNotificationEnabled: ts.notImplemented, isSubstitutionEnabled: ts.notImplemented, onEmitNode: ts.noop, onSubstituteNode: ts.notImplemented, readEmitHelpers: ts.notImplemented, requestEmitHelper: ts.noop, resumeLexicalEnvironment: ts.noop, startLexicalEnvironment: ts.noop, suspendLexicalEnvironment: ts.noop, addDiagnostic: ts.noop }, ts.createTypeCheck = createTypeCheck, ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName, ts.createFunctionCall = createFunctionCall, ts.createFunctionApply = createFunctionApply, ts.createArraySlice = createArraySlice, ts.createArrayConcat = createArrayConcat, ts.createMathPow = createMathPow, ts.createExpressionForJsxElement = createExpressionForJsxElement, ts.createExpressionForJsxFragment = createExpressionForJsxFragment, ts.getHelperName = getHelperName; var valuesHelper = { name: "typescript:values", scoped: !1, text: '\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };' }; ts.createValuesHelper = createValuesHelper; var readHelper = { name: "typescript:read", scoped: !1, text: '\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };' }; ts.createReadHelper = createReadHelper; var spreadHelper = { name: "typescript:spread", scoped: !1, text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" }; ts.createSpreadHelper = createSpreadHelper, ts.createForOfBindingStatement = createForOfBindingStatement, ts.insertLeadingStatement = insertLeadingStatement, ts.restoreEnclosingLabel = restoreEnclosingLabel, ts.createCallBinding = createCallBinding, ts.inlineExpressions = inlineExpressions, ts.createExpressionFromEntityName = createExpressionFromEntityName, ts.createExpressionForPropertyName = createExpressionForPropertyName, ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike, ts.getInternalName = getInternalName, ts.isInternalName = isInternalName, ts.getLocalName = getLocalName, ts.isLocalName = isLocalName, ts.getExportName = getExportName, ts.isExportName = isExportName, ts.getDeclarationName = getDeclarationName, ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName, ts.getNamespaceMemberName = getNamespaceMemberName, ts.convertToFunctionBody = convertToFunctionBody, ts.convertFunctionDeclarationToExpression = convertFunctionDeclarationToExpression, ts.addPrologue = addPrologue, ts.addStandardPrologue = addStandardPrologue, ts.addCustomPrologue = addCustomPrologue, ts.startsWithUseStrict = startsWithUseStrict, ts.ensureUseStrict = ensureUseStrict, ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand, ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead, ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression, ts.parenthesizeDefaultExpression = parenthesizeDefaultExpression, ts.parenthesizeForNew = parenthesizeForNew, ts.parenthesizeForAccess = parenthesizeForAccess, ts.parenthesizePostfixOperand = parenthesizePostfixOperand, ts.parenthesizePrefixOperand = parenthesizePrefixOperand, ts.parenthesizeListElements = parenthesizeListElements, ts.parenthesizeExpressionForList = parenthesizeExpressionForList, ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement, ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember, ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember, ts.parenthesizeArrayTypeMember = parenthesizeArrayTypeMember, ts.parenthesizeElementTypeMembers = parenthesizeElementTypeMembers, ts.parenthesizeTypeParameters = parenthesizeTypeParameters, ts.parenthesizeConciseBody = parenthesizeConciseBody; var OuterExpressionKinds; !function (OuterExpressionKinds) { OuterExpressionKinds[OuterExpressionKinds.Parentheses = 1] = "Parentheses", OuterExpressionKinds[OuterExpressionKinds.Assertions = 2] = "Assertions", OuterExpressionKinds[OuterExpressionKinds.PartiallyEmittedExpressions = 4] = "PartiallyEmittedExpressions", OuterExpressionKinds[OuterExpressionKinds.All = 7] = "All" }(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {})), ts.isOuterExpression = isOuterExpression, ts.skipOuterExpressions = skipOuterExpressions, ts.skipAssertions = skipAssertions, ts.recreateOuterExpressions = recreateOuterExpressions, ts.startOnNewLine = startOnNewLine, ts.getExternalHelpersModuleName = getExternalHelpersModuleName, ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded, ts.getLocalNameForExternalImport = getLocalNameForExternalImport, ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral, ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile, ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement, ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement, ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement, ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement, ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern, ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement, ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement, ts.convertToAssignmentPattern = convertToAssignmentPattern, ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern, ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern, ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget }(ts || (ts = {})); var ts; !function (ts) { function visitNode(node, visitor, test, lift) { if (void 0 === node || void 0 === visitor) return node; ts.aggregateTransformFlags(node); var visited = visitor(node); if (visited === node) return node; var visitedNode; if (void 0 !== visited) return visitedNode = ts.isArray(visited) ? (lift || extractSingleNode)(visited) : visited, ts.Debug.assertNode(visitedNode, test), ts.aggregateTransformFlags(visitedNode), visitedNode } function visitNodes(nodes, visitor, test, start, count) { if (void 0 === nodes || void 0 === visitor) return nodes; var updated, length = nodes.length; (void 0 === start || start < 0) && (start = 0), (void 0 === count || count > length - start) && (count = length - start), (start > 0 || count < length) && (updated = ts.createNodeArray([], nodes.hasTrailingComma && start + count === length)); for (var i = 0; i < count; i++) { var node = nodes[i + start]; ts.aggregateTransformFlags(node); var visited = void 0 !== node ? visitor(node) : void 0; if ((void 0 !== updated || void 0 === visited || visited !== node) && (void 0 === updated && (updated = ts.createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma), ts.setTextRange(updated, nodes)), visited)) if (ts.isArray(visited)) for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { var visitedNode = visited_1[_i]; ts.Debug.assertNode(visitedNode, test), ts.aggregateTransformFlags(visitedNode), updated.push(visitedNode) } else ts.Debug.assertNode(visited, test), ts.aggregateTransformFlags(visited), updated.push(visited) } return updated || nodes } function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { context.startLexicalEnvironment(), statements = visitNodes(statements, visitor, ts.isStatement, start), ensureUseStrict && !ts.startsWithUseStrict(statements) && (statements = ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements)), statements)); var declarations = context.endLexicalEnvironment(); return ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements) } function visitParameterList(nodes, visitor, context, nodesVisitor) { void 0 === nodesVisitor && (nodesVisitor = visitNodes), context.startLexicalEnvironment(); var updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration); return context.suspendLexicalEnvironment(), updated } function visitFunctionBody(node, visitor, context) { context.resumeLexicalEnvironment(); var updated = visitNode(node, visitor, ts.isConciseBody), declarations = context.endLexicalEnvironment(); if (ts.some(declarations)) { var block = ts.convertToFunctionBody(updated), statements = ts.mergeLexicalEnvironment(block.statements, declarations); return ts.updateBlock(block, statements) } return updated } function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor) { if (void 0 === nodesVisitor && (nodesVisitor = visitNodes), void 0 !== node) { var kind = node.kind; if (kind > 0 && kind <= 144 || 173 === kind) return node; switch (kind) { case 71: return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration)); case 145: return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier)); case 146: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); case 147: return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode)); case 148: return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 149: return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression)); case 150: return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 151: return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 152: return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); case 153: return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 154: return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); case 155: return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 156: return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); case 157: return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 158: return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 159: return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 160: return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode)); case 161: return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); case 162: return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 163: return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 164: return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName)); case 165: return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); case 166: return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode)); case 167: return ts.updateTypleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode)); case 168: return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); case 169: return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); case 170: return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode)); case 171: return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); case 178: return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); case 172: return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode)); case 174: return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode)); case 175: return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode)); case 176: return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); case 177: return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); case 179: return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); case 180: return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); case 181: return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); case 182: return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); case 183: return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); case 184: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); case 185: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); case 186: return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); case 187: return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); case 188: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); case 189: return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 190: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 191: return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 192: return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); case 193: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 194: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); case 195: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); case 196: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); case 197: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); case 198: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); case 199: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); case 200: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); case 201: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); case 202: return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); case 203: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); case 204: return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); case 206: return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 207: return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); case 208: return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); case 210: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); case 212: return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 213: return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); case 215: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 216: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); case 217: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 218: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 219: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 220: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 221: return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 222: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); case 223: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); case 224: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); case 225: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 226: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 227: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 228: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); case 229: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); case 231: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 232: return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); case 233: return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 234: return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); case 235: return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); case 236: return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); case 237: return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); case 238: return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); case 239: return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 240: return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); case 241: return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); case 242: return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); case 243: return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 244: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); case 245: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 246: return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); case 247: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); case 248: return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 249: return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 250: return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); case 251: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); case 253: return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 255: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 256: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 257: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 258: return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); case 261: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 262: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); case 263: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 264: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 265: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); case 266: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 267: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); case 268: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 269: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 270: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); case 271: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); case 272: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 273: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); case 300: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 301: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: return node } } } function extractSingleNode(nodes) { return ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."), ts.singleOrUndefined(nodes) } var isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); ts.visitNode = visitNode, ts.visitNodes = visitNodes, ts.visitLexicalEnvironment = visitLexicalEnvironment, ts.visitParameterList = visitParameterList, ts.visitFunctionBody = visitFunctionBody, ts.visitEachChild = visitEachChild }(ts || (ts = {})), function (ts) { function reduceNode(node, f, initial) { return node ? f(initial, node) : initial } function reduceNodeArray(nodes, f, initial) { return nodes ? f(initial, nodes) : initial } function reduceEachChild(node, initial, cbNode, cbNodeArray) { if (void 0 === node) return initial; var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft, cbNodes = cbNodeArray || cbNode, kind = node.kind; if (kind > 0 && kind <= 144) return initial; if (kind >= 160 && kind <= 177) return initial; var result = initial; switch (node.kind) { case 211: case 214: case 205: case 230: case 299: break; case 145: result = reduceNode(node.left, cbNode, result), result = reduceNode(node.right, cbNode, result); break; case 146: result = reduceNode(node.expression, cbNode, result); break; case 148: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 149: result = reduceNode(node.expression, cbNode, result); break; case 150: result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNode(node.questionToken, cbNode, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 151: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 153: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.typeParameters, cbNodes, result), result = reduceNodes(node.parameters, cbNodes, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.body, cbNode, result); break; case 154: result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNodes(node.parameters, cbNodes, result), result = reduceNode(node.body, cbNode, result); break; case 155: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.parameters, cbNodes, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.body, cbNode, result); break; case 156: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.parameters, cbNodes, result), result = reduceNode(node.body, cbNode, result); break; case 179: case 180: result = reduceNodes(node.elements, cbNodes, result); break; case 181: result = reduceNode(node.propertyName, cbNode, result), result = reduceNode(node.name, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 182: result = reduceNodes(node.elements, cbNodes, result); break; case 183: result = reduceNodes(node.properties, cbNodes, result); break; case 184: result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.name, cbNode, result); break; case 185: result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.argumentExpression, cbNode, result); break; case 186: result = reduceNode(node.expression, cbNode, result), result = reduceNodes(node.typeArguments, cbNodes, result), result = reduceNodes(node.arguments, cbNodes, result); break; case 187: result = reduceNode(node.expression, cbNode, result), result = reduceNodes(node.typeArguments, cbNodes, result), result = reduceNodes(node.arguments, cbNodes, result); break; case 188: result = reduceNode(node.tag, cbNode, result), result = reduceNode(node.template, cbNode, result); break; case 189: result = reduceNode(node.type, cbNode, result), result = reduceNode(node.expression, cbNode, result); break; case 191: result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.typeParameters, cbNodes, result), result = reduceNodes(node.parameters, cbNodes, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.body, cbNode, result); break; case 192: result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNodes(node.typeParameters, cbNodes, result), result = reduceNodes(node.parameters, cbNodes, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.body, cbNode, result); break; case 190: case 193: case 194: case 195: case 196: case 202: case 203: case 208: result = reduceNode(node.expression, cbNode, result); break; case 197: case 198: result = reduceNode(node.operand, cbNode, result); break; case 199: result = reduceNode(node.left, cbNode, result), result = reduceNode(node.right, cbNode, result); break; case 200: result = reduceNode(node.condition, cbNode, result), result = reduceNode(node.whenTrue, cbNode, result), result = reduceNode(node.whenFalse, cbNode, result); break; case 201: result = reduceNode(node.head, cbNode, result), result = reduceNodes(node.templateSpans, cbNodes, result); break; case 204: result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.typeParameters, cbNodes, result), result = reduceNodes(node.heritageClauses, cbNodes, result), result = reduceNodes(node.members, cbNodes, result); break; case 206: result = reduceNode(node.expression, cbNode, result), result = reduceNodes(node.typeArguments, cbNodes, result); break; case 207: result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.type, cbNode, result); break; case 210: result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.literal, cbNode, result); break; case 212: result = reduceNodes(node.statements, cbNodes, result); break; case 213: result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.declarationList, cbNode, result); break; case 215: result = reduceNode(node.expression, cbNode, result); break; case 216: result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.thenStatement, cbNode, result), result = reduceNode(node.elseStatement, cbNode, result); break; case 217: result = reduceNode(node.statement, cbNode, result), result = reduceNode(node.expression, cbNode, result); break; case 218: case 225: result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.statement, cbNode, result); break; case 219: result = reduceNode(node.initializer, cbNode, result), result = reduceNode(node.condition, cbNode, result), result = reduceNode(node.incrementor, cbNode, result), result = reduceNode(node.statement, cbNode, result); break; case 220: case 221: result = reduceNode(node.initializer, cbNode, result), result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.statement, cbNode, result); break; case 224: case 228: result = reduceNode(node.expression, cbNode, result); break; case 226: result = reduceNode(node.expression, cbNode, result), result = reduceNode(node.caseBlock, cbNode, result); break; case 227: result = reduceNode(node.label, cbNode, result), result = reduceNode(node.statement, cbNode, result); break; case 229: result = reduceNode(node.tryBlock, cbNode, result), result = reduceNode(node.catchClause, cbNode, result), result = reduceNode(node.finallyBlock, cbNode, result); break; case 231: result = reduceNode(node.name, cbNode, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 232: result = reduceNodes(node.declarations, cbNodes, result); break; case 233: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.typeParameters, cbNodes, result), result = reduceNodes(node.parameters, cbNodes, result), result = reduceNode(node.type, cbNode, result), result = reduceNode(node.body, cbNode, result); break; case 234: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.typeParameters, cbNodes, result), result = reduceNodes(node.heritageClauses, cbNodes, result), result = reduceNodes(node.members, cbNodes, result); break; case 237: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNodes(node.members, cbNodes, result); break; case 238: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNode(node.body, cbNode, result); break; case 239: result = reduceNodes(node.statements, cbNodes, result); break; case 240: result = reduceNodes(node.clauses, cbNodes, result); break; case 242: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.name, cbNode, result), result = reduceNode(node.moduleReference, cbNode, result); break; case 243: result = reduceNodes(node.decorators, cbNodes, result), result = reduceNodes(node.modifiers, cbNodes, result), result = reduceNode(node.importClause, cbNode, result), result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 244: result = reduceNode(node.name, cbNode, result), result = reduceNode(node.namedBindings, cbNode, result); break; case 245: result = reduceNode(node.name, cbNode, result); break; case 246: case 250: result = reduceNodes(node.elements, cbNodes, result); break; case 247: case 251: result = reduceNode(node.propertyName, cbNode, result), result = reduceNode(node.name, cbNode, result); break; case 248: result = ts.reduceLeft(node.decorators, cbNode, result), result = ts.reduceLeft(node.modifiers, cbNode, result), result = reduceNode(node.expression, cbNode, result); break; case 249: result = ts.reduceLeft(node.decorators, cbNode, result), result = ts.reduceLeft(node.modifiers, cbNode, result), result = reduceNode(node.exportClause, cbNode, result), result = reduceNode(node.moduleSpecifier, cbNode, result); break; case 253: result = reduceNode(node.expression, cbNode, result); break; case 254: result = reduceNode(node.openingElement, cbNode, result), result = ts.reduceLeft(node.children, cbNode, result), result = reduceNode(node.closingElement, cbNode, result); break; case 258: result = reduceNode(node.openingFragment, cbNode, result), result = ts.reduceLeft(node.children, cbNode, result), result = reduceNode(node.closingFragment, cbNode, result); break; case 255: case 256: result = reduceNode(node.tagName, cbNode, result), result = reduceNode(node.attributes, cbNode, result); break; case 262: result = reduceNodes(node.properties, cbNodes, result); break; case 257: result = reduceNode(node.tagName, cbNode, result); break; case 261: result = reduceNode(node.name, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 263: result = reduceNode(node.expression, cbNode, result); break; case 264: result = reduceNode(node.expression, cbNode, result); break; case 265: result = reduceNode(node.expression, cbNode, result); case 266: result = reduceNodes(node.statements, cbNodes, result); break; case 267: result = reduceNodes(node.types, cbNodes, result); break; case 268: result = reduceNode(node.variableDeclaration, cbNode, result), result = reduceNode(node.block, cbNode, result); break; case 269: result = reduceNode(node.name, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 270: result = reduceNode(node.name, cbNode, result), result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; case 271: result = reduceNode(node.expression, cbNode, result); break; case 272: result = reduceNode(node.name, cbNode, result), result = reduceNode(node.initializer, cbNode, result); break; case 273: result = reduceNodes(node.statements, cbNodes, result); break; case 300: result = reduceNode(node.expression, cbNode, result); break; case 301: result = reduceNodes(node.elements, cbNodes, result) }return result } function mergeLexicalEnvironment(statements, declarations) { return ts.some(declarations) ? ts.isNodeArray(statements) ? ts.setTextRange(ts.createNodeArray(ts.prependStatements(statements.slice(), declarations)), statements) : ts.prependStatements(statements, declarations) : statements } function liftToBlock(nodes) { return Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block."), ts.singleOrUndefined(nodes) || ts.createBlock(nodes) } function aggregateTransformFlags(node) { return aggregateTransformFlagsForNode(node), node } function aggregateTransformFlagsForNode(node) { if (void 0 === node) return 0; if (536870912 & node.transformFlags) return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind); var subtreeFlags = aggregateTransformFlagsForSubtree(node); return ts.computeTransformFlagsForNode(node, subtreeFlags) } function aggregateTransformFlagsForNodeArray(nodes) { if (void 0 === nodes) return 0; for (var subtreeFlags = 0, nodeArrayFlags = 0, _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) { var node = nodes_3[_i]; subtreeFlags |= aggregateTransformFlagsForNode(node), nodeArrayFlags |= node.transformFlags & -536870913 } return nodes.transformFlags = 536870912 | nodeArrayFlags, subtreeFlags } function aggregateTransformFlagsForSubtree(node) { return ts.hasModifier(node, 2) || ts.isTypeNode(node) && 206 !== node.kind ? 0 : reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes) } function aggregateTransformFlagsForChildNode(transformFlags, node) { return transformFlags | aggregateTransformFlagsForNode(node) } function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { return transformFlags | aggregateTransformFlagsForNodeArray(nodes) } ts.reduceEachChild = reduceEachChild, ts.mergeLexicalEnvironment = mergeLexicalEnvironment, ts.liftToBlock = liftToBlock, ts.aggregateTransformFlags = aggregateTransformFlags; var Debug; !function (Debug) { function failBadSyntaxKind(node, message) { return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind) } function enableDebugInfo() { if (!isDebugInfoEnabled) { Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, { __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags) } } }), Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, { __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags) } }, __debugObjectFlags: { get: function () { return 65536 & this.flags ? ts.formatObjectFlags(this.objectFlags) : "" } }, __debugTypeToString: { value: function () { return this.checker.typeToString(this) } } }); for (var nodeConstructors = [ts.objectAllocator.getNodeConstructor(), ts.objectAllocator.getIdentifierConstructor(), ts.objectAllocator.getTokenConstructor(), ts.objectAllocator.getSourceFileConstructor()], _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; ctor.prototype.hasOwnProperty("__debugKind") || Object.defineProperties(ctor.prototype, { __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind) } }, __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)) } }, __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags) } }, __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)) } }, __debugGetText: { value: function (includeTrivia) { if (ts.nodeIsSynthesized(this)) return ""; var parseNode = ts.getParseTreeNode(this), sourceFile = parseNode && ts.getSourceFileOfNode(parseNode); return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "" } } }) } isDebugInfoEnabled = !0 } } var isDebugInfoEnabled = !1; Debug.failBadSyntaxKind = failBadSyntaxKind, Debug.assertEachNode = Debug.shouldAssert(1) ? function (nodes, test, message) { return Debug.assert(void 0 === test || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'." }, Debug.assertEachNode) } : ts.noop, Debug.assertNode = Debug.shouldAssert(1) ? function (node, test, message) { return Debug.assert(void 0 === test || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'." }, Debug.assertNode) } : ts.noop, Debug.assertOptionalNode = Debug.shouldAssert(1) ? function (node, test, message) { return Debug.assert(void 0 === test || void 0 === node || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'." }, Debug.assertOptionalNode) } : ts.noop, Debug.assertOptionalToken = Debug.shouldAssert(1) ? function (node, kind, message) { return Debug.assert(void 0 === kind || void 0 === node || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token." }, Debug.assertOptionalToken) } : ts.noop, Debug.assertMissingNode = Debug.shouldAssert(1) ? function (node, message) { return Debug.assert(void 0 === node, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'." }, Debug.assertMissingNode) } : ts.noop, Debug.enableDebugInfo = enableDebugInfo }(Debug = ts.Debug || (ts.Debug = {})) }(ts || (ts = {})); var ts; !function (ts) { function getOriginalNodeId(node) { return node = ts.getOriginalNode(node), node ? ts.getNodeId(node) : 0 } function containsDefaultReference(node) { return !!node && (!!ts.isNamedImports(node) && ts.some(node.elements, isNamedDefaultReference)) } function isNamedDefaultReference(e) { return e.propertyName && "default" === e.propertyName.escapedText } function chainBundle(transformSourceFile) { function transformSourceFileOrBundle(node) { return 273 === node.kind ? transformSourceFile(node) : transformBundle(node) } function transformBundle(node) { return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends) } return transformSourceFileOrBundle } function getImportNeedsImportStarHelper(node) { if (ts.getNamespaceDeclarationNode(node)) return !0; var bindings = node.importClause && node.importClause.namedBindings; if (!bindings) return !1; if (!ts.isNamedImports(bindings)) return !1; for (var defaultRefCount = 0, _i = 0, _a = bindings.elements; _i < _a.length; _i++) { var binding = _a[_i]; isNamedDefaultReference(binding) && defaultRefCount++ } return defaultRefCount > 0 && defaultRefCount !== bindings.elements.length || !!(bindings.elements.length - defaultRefCount) && ts.isDefaultImport(node) } function getImportNeedsImportDefaultHelper(node) { return !getImportNeedsImportStarHelper(node) && (ts.isDefaultImport(node) || node.importClause && ts.isNamedImports(node.importClause.namedBindings) && containsDefaultReference(node.importClause.namedBindings)) } function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { for (var exportedNames, exportEquals, externalImports = [], exportSpecifiers = ts.createMultiMap(), exportedBindings = [], uniqueExports = ts.createMap(), hasExportDefault = !1, hasExportStarsToExportValues = !1, hasImportStarOrImportDefault = !1, _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { case 243: externalImports.push(node), hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); break; case 242: 253 === node.moduleReference.kind && externalImports.push(node); break; case 249: if (node.moduleSpecifier) node.exportClause ? externalImports.push(node) : (externalImports.push(node), hasExportStarsToExportValues = !0); else for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; if (!uniqueExports.get(ts.idText(specifier.name))) { var name = specifier.propertyName || specifier.name; exportSpecifiers.add(ts.idText(name), specifier); var decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); decl && multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name), uniqueExports.set(ts.idText(specifier.name), !0), exportedNames = ts.append(exportedNames, specifier.name) } } break; case 248: node.isExportEquals && !exportEquals && (exportEquals = node); break; case 213: if (ts.hasModifier(node, 1)) for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames) } break; case 233: if (ts.hasModifier(node, 1)) if (ts.hasModifier(node, 512)) hasExportDefault || (multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)), hasExportDefault = !0); else { var name = node.name; uniqueExports.get(ts.idText(name)) || (multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name), uniqueExports.set(ts.idText(name), !0), exportedNames = ts.append(exportedNames, name)) } break; case 234: if (ts.hasModifier(node, 1)) if (ts.hasModifier(node, 512)) hasExportDefault || (multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)), hasExportDefault = !0); else { var name = node.name; name && !uniqueExports.get(ts.idText(name)) && (multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name), uniqueExports.set(ts.idText(name), !0), exportedNames = ts.append(exportedNames, name)) } } } var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault), externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(void 0, void 0, ts.createImportClause(void 0, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); return externalHelpersImportDeclaration && (ts.addEmitFlags(externalHelpersImportDeclaration, 67108864), externalImports.unshift(externalHelpersImportDeclaration)), { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration } } function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { if (ts.isBindingPattern(decl.name)) for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isOmittedExpression(element) || (exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames)) } else if (!ts.isGeneratedIdentifier(decl.name)) { var text = ts.idText(decl.name); uniqueExports.get(text) || (uniqueExports.set(text, !0), exportedNames = ts.append(exportedNames, decl.name)) } return exportedNames } function multiMapSparseArrayAdd(map, key, value) { var values = map[key]; return values ? values.push(value) : map[key] = values = [value], values } function isSimpleCopiableExpression(expression) { return ts.isStringLiteralLike(expression) || 8 === expression.kind || ts.isKeyword(expression.kind) || ts.isIdentifier(expression) } function helperString(input) { for (var args = [], _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; return function (uniqueName) { for (var result = "", i = 0; i < args.length; i++)result += input[i], result += uniqueName(args[i]); return result += input[input.length - 1] } } ts.getOriginalNodeId = getOriginalNodeId, ts.chainBundle = chainBundle, ts.getImportNeedsImportStarHelper = getImportNeedsImportStarHelper, ts.getImportNeedsImportDefaultHelper = getImportNeedsImportDefaultHelper, ts.collectExternalModuleInfo = collectExternalModuleInfo, ts.isSimpleCopiableExpression = isSimpleCopiableExpression, ts.helperString = helperString }(ts || (ts = {})); var ts; !function (ts) { function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { function emitExpression(expression) { ts.setEmitFlags(expression, 64), ts.aggregateTransformFlags(expression), expressions = ts.append(expressions, expression) } function emitBindingOrAssignment(target, value, location, original) { ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); var expression = createAssignmentCallback ? createAssignmentCallback(target, value, location) : ts.setTextRange(ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value), location); expression.original = original, emitExpression(expression) } var value, location = node; if (ts.isDestructuringAssignment(node)) for (value = node.right; ts.isEmptyArrayLiteral(node.left) || ts.isEmptyObjectLiteral(node.left);) { if (!ts.isDestructuringAssignment(value)) return ts.visitNode(value, visitor, ts.isExpression); location = node = value, value = node.right } var expressions, flattenContext = { context: context, level: level, downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: !0, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern, createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern, createArrayBindingOrAssignmentElement: makeAssignmentElement, visitor: visitor }; if (value && (value = ts.visitNode(value, visitor, ts.isExpression), ts.isIdentifier(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) ? value = ensureIdentifier(flattenContext, value, !1, location) : needsValue ? value = ensureIdentifier(flattenContext, value, !0, location) : ts.nodeIsSynthesized(node) && (location = value)), flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node)), value && needsValue) { if (!ts.some(expressions)) return value; expressions.push(value) } return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression() } function bindingOrAssignmentElementAssignsToName(element, escapedName) { var target = ts.getTargetOfBindingOrAssignmentElement(element); return ts.isBindingOrAssignmentPattern(target) ? bindingOrAssignmentPatternAssignsToName(target, escapedName) : !!ts.isIdentifier(target) && target.escapedText === escapedName } function bindingOrAssignmentPatternAssignsToName(pattern, escapedName) { for (var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern), _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var element = elements_3[_i]; if (bindingOrAssignmentElementAssignsToName(element, escapedName)) return !0 } return !1 } function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { function emitExpression(value) { pendingExpressions = ts.append(pendingExpressions, value) } function emitBindingOrAssignment(target, value, location, original) { ts.Debug.assertNode(target, ts.isBindingName), pendingExpressions && (value = ts.inlineExpressions(ts.append(pendingExpressions, value)), pendingExpressions = void 0), pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original }) } var pendingExpressions, pendingDeclarations = [], declarations = [], flattenContext = { context: context, level: level, downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: hoistTempVariables, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, createArrayBindingOrAssignmentPattern: makeArrayBindingPattern, createObjectBindingOrAssignmentPattern: makeObjectBindingPattern, createArrayBindingOrAssignmentElement: makeBindingElement, visitor: visitor }; if (ts.isVariableDeclaration(node)) { var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); initializer && ts.isIdentifier(initializer) && bindingOrAssignmentElementAssignsToName(node, initializer.escapedText) && (initializer = ensureIdentifier(flattenContext, initializer, !1, initializer), node = ts.updateVariableDeclaration(node, node.name, node.type, initializer)) } if (flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer), pendingExpressions) { var temp = ts.createTempVariable(void 0); if (hoistTempVariables) { var value = ts.inlineExpressions(pendingExpressions); pendingExpressions = void 0, emitBindingOrAssignment(temp, value, void 0, void 0) } else { context.hoistVariableDeclaration(temp); var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations); pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value)), ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions), pendingDeclaration.value = temp } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original, variable = ts.createVariableDeclaration(name, void 0, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value); variable.original = original, ts.setTextRange(variable, location), ts.isIdentifier(name) && ts.setEmitFlags(variable, 64), ts.aggregateTransformFlags(variable), declarations.push(variable) } return declarations } function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) { if (!skipInitializer) { var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression); initializer ? value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer : value || (value = ts.createVoidZero()) } var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element); ts.isObjectBindingOrAssignmentPattern(bindingTarget) ? flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location) : ts.isArrayBindingOrAssignmentPattern(bindingTarget) ? flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location) : flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element) } function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern), numElements = elements.length; if (1 !== numElements) { var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || 0 !== numElements; value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) } for (var bindingElements, computedTempVariables, i = 0; i < numElements; i++) { var element = elements[i]; if (ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { if (i === numElements - 1) { bindingElements && (flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern), bindingElements = void 0); var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern); flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element) } } else { var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element); if (!(flattenContext.level >= 1) || 1572864 & element.transformFlags || 1572864 & ts.getTargetOfBindingOrAssignmentElement(element).transformFlags || ts.isComputedPropertyName(propertyName)) { bindingElements && (flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern), bindingElements = void 0); var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); ts.isComputedPropertyName(propertyName) && (computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression)), flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element) } else bindingElements = ts.append(bindingElements, element) } } bindingElements && flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern) } function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern), numElements = elements.length; if (flattenContext.level < 1 && flattenContext.downlevelIteration) value = ensureIdentifier(flattenContext, ts.createReadHelper(flattenContext.context, value, numElements > 0 && ts.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) ? void 0 : numElements, location), !1, location); else if (1 !== numElements && (flattenContext.level < 1 || 0 === numElements) || ts.every(elements, ts.isOmittedExpression)) { var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || 0 !== numElements; value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) } for (var bindingElements, restContainingElements, i = 0; i < numElements; i++) { var element = elements[i]; if (flattenContext.level >= 1) if (1048576 & element.transformFlags) { var temp = ts.createTempVariable(void 0); flattenContext.hoistTempVariables && flattenContext.context.hoistVariableDeclaration(temp), restContainingElements = ts.append(restContainingElements, [temp, element]), bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)) } else bindingElements = ts.append(bindingElements, element); else { if (ts.isOmittedExpression(element)) continue; if (ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { if (i === numElements - 1) { var rhsValue = ts.createArraySlice(value, i); flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element) } } else { var rhsValue = ts.createElementAccess(value, i); flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element) } } } if (bindingElements && flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern), restContainingElements) for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) { var _a = restContainingElements_1[_i], id = _a[0], element = _a[1]; flattenBindingOrAssignmentElement(flattenContext, element, id, element) } } function createDefaultValueCheck(flattenContext, value, defaultValue, location) { return value = ensureIdentifier(flattenContext, value, !0, location), ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value) } function createDestructuringPropertyAccess(flattenContext, value, propertyName) { if (ts.isComputedPropertyName(propertyName)) { var argumentExpression = ensureIdentifier(flattenContext, ts.visitNode(propertyName.expression, flattenContext.visitor), !1, propertyName); return ts.createElementAccess(value, argumentExpression) } if (ts.isStringOrNumericLiteral(propertyName)) { var argumentExpression = ts.getSynthesizedClone(propertyName); return argumentExpression.text = argumentExpression.text, ts.createElementAccess(value, argumentExpression) } var name = ts.createIdentifier(ts.idText(propertyName)); return ts.createPropertyAccess(value, name) } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { if (ts.isIdentifier(value) && reuseIdentifierExpressions) return value; var temp = ts.createTempVariable(void 0); return flattenContext.hoistTempVariables ? (flattenContext.context.hoistVariableDeclaration(temp), flattenContext.emitExpression(ts.setTextRange(ts.createAssignment(temp, value), location))) : flattenContext.emitBindingOrAssignment(temp, value, location, void 0), temp } function makeArrayBindingPattern(elements) { return ts.Debug.assertEachNode(elements, ts.isArrayBindingElement), ts.createArrayBindingPattern(elements) } function makeArrayAssignmentPattern(elements) { return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement)) } function makeObjectBindingPattern(elements) { return ts.Debug.assertEachNode(elements, ts.isBindingElement), ts.createObjectBindingPattern(elements) } function makeObjectAssignmentPattern(elements) { return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)) } function makeBindingElement(name) { return ts.createBindingElement(void 0, void 0, name) } function makeAssignmentElement(name) { return name } function createRestCall(context, value, elements, computedTempVariables, location) { context.requestEmitHelper(restHelper); for (var propertyNames = [], computedTempVariableOffset = 0, i = 0; i < elements.length - 1; i++) { var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]); if (propertyName) if (ts.isComputedPropertyName(propertyName)) { var temp = computedTempVariables[computedTempVariableOffset]; computedTempVariableOffset++ , propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral("")))) } else propertyNames.push(ts.createLiteral(propertyName)) } return ts.createCall(ts.getHelperName("__rest"), void 0, [value, ts.setTextRange(ts.createArrayLiteral(propertyNames), location)]) } var FlattenLevel; !function (FlattenLevel) { FlattenLevel[FlattenLevel.All = 0] = "All", FlattenLevel[FlattenLevel.ObjectRest = 1] = "ObjectRest" }(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {})), ts.flattenDestructuringAssignment = flattenDestructuringAssignment, ts.flattenDestructuringBinding = flattenDestructuringBinding; var restHelper = { name: "typescript:rest", scoped: !1, text: '\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };' } }(ts || (ts = {})); var ts; !function (ts) { function transformTypeScript(context) { function transformSourceFileOrBundle(node) { return 274 === node.kind ? transformBundle(node) : transformSourceFile(node) } function transformBundle(node) { return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { return 276 === prepend.kind ? ts.createUnparsedSourceFile(prepend.javascriptText) : prepend })) } function transformSourceFile(node) { if (node.isDeclarationFile) return node; currentSourceFile = node; var visited = saveStateAndInvoke(node, visitSourceFile); return ts.addEmitHelpers(visited, context.readEmitHelpers()), currentSourceFile = void 0, visited } function saveStateAndInvoke(node, f) { var savedCurrentScope = currentScope, savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; onBeforeVisitNode(node); var visited = f(node); return currentScope !== savedCurrentScope && (currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName), currentScope = savedCurrentScope, visited } function onBeforeVisitNode(node) { switch (node.kind) { case 273: case 240: case 239: case 212: currentScope = node, currentScopeFirstDeclarationsOfName = void 0; break; case 234: case 233: if (ts.hasModifier(node, 2)) break; node.name ? recordEmittedDeclarationInScope(node) : ts.Debug.assert(234 === node.kind || ts.hasModifier(node, 512)) } } function visitor(node) { return saveStateAndInvoke(node, visitorWorker) } function visitorWorker(node) { return 1 & node.transformFlags ? visitTypeScript(node) : 2 & node.transformFlags ? ts.visitEachChild(node, visitor, context) : node } function sourceElementVisitor(node) { return saveStateAndInvoke(node, sourceElementVisitorWorker) } function sourceElementVisitorWorker(node) { switch (node.kind) { case 243: case 242: case 248: case 249: return visitEllidableStatement(node); default: return visitorWorker(node) } } function visitEllidableStatement(node) { var parsed = ts.getParseTreeNode(node); if (parsed !== node) return 2 & node.transformFlags ? ts.visitEachChild(node, visitor, context) : node; switch (node.kind) { case 243: return visitImportDeclaration(node); case 242: return visitImportEqualsDeclaration(node); case 248: return visitExportAssignment(node); case 249: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement") } } function namespaceElementVisitor(node) { return saveStateAndInvoke(node, namespaceElementVisitorWorker) } function namespaceElementVisitorWorker(node) { if (249 !== node.kind && 243 !== node.kind && 244 !== node.kind && (242 !== node.kind || 253 !== node.moduleReference.kind)) return 1 & node.transformFlags || ts.hasModifier(node, 1) ? visitTypeScript(node) : 2 & node.transformFlags ? ts.visitEachChild(node, visitor, context) : node } function classElementVisitor(node) { return saveStateAndInvoke(node, classElementVisitorWorker) } function classElementVisitorWorker(node) { switch (node.kind) { case 154: return; case 151: case 159: case 155: case 156: case 153: return visitorWorker(node); case 211: return node; default: return ts.Debug.failBadSyntaxKind(node) } } function modifierVisitor(node) { if (!(2270 & ts.modifierToFlag(node.kind) || currentNamespace && 84 === node.kind)) return node } function visitTypeScript(node) { if (ts.hasModifier(node, 2) && ts.isStatement(node)) return ts.createNotEmittedStatement(node); switch (node.kind) { case 84: case 79: return currentNamespace ? void 0 : node; case 114: case 112: case 113: case 117: case 76: case 124: case 132: case 166: case 167: case 165: case 160: case 147: case 119: case 122: case 137: case 134: case 131: case 105: case 138: case 163: case 162: case 164: case 161: case 168: case 169: case 170: case 172: case 173: case 174: case 175: case 176: case 177: case 159: case 149: case 236: return; case 151: return visitPropertyDeclaration(node); case 241: return; case 154: return visitConstructor(node); case 235: return ts.createNotEmittedStatement(node); case 234: return visitClassDeclaration(node); case 204: return visitClassExpression(node); case 267: return visitHeritageClause(node); case 206: return visitExpressionWithTypeArguments(node); case 153: return visitMethodDeclaration(node); case 155: return visitGetAccessor(node); case 156: return visitSetAccessor(node); case 233: return visitFunctionDeclaration(node); case 191: return visitFunctionExpression(node); case 192: return visitArrowFunction(node); case 148: return visitParameter(node); case 190: return visitParenthesizedExpression(node); case 189: case 207: return visitAssertionExpression(node); case 186: return visitCallExpression(node); case 187: return visitNewExpression(node); case 188: return visitTaggedTemplateExpression(node); case 208: return visitNonNullExpression(node); case 237: return visitEnumDeclaration(node); case 213: return visitVariableStatement(node); case 231: return visitVariableDeclaration(node); case 238: return visitModuleDeclaration(node); case 242: return visitImportEqualsDeclaration(node); default: return ts.Debug.failBadSyntaxKind(node) } } function visitSourceFile(node) { var alwaysStrict = ts.getStrictOptionValue(compilerOptions, "alwaysStrict") && !(ts.isExternalModule(node) && moduleKind >= ts.ModuleKind.ES2015) && !ts.isJsonSourceFile(node); return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)) } function shouldEmitDecorateCallForClass(node) { if (node.decorators && node.decorators.length > 0) return !0; var constructor = ts.getFirstConstructorWithBody(node); return !!constructor && ts.forEach(constructor.parameters, shouldEmitDecorateCallForParameter) } function shouldEmitDecorateCallForParameter(parameter) { return void 0 !== parameter.decorators && parameter.decorators.length > 0 } function getClassFacts(node, staticProperties) { var facts = 0; ts.some(staticProperties) && (facts |= 1); var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node); return extendsClauseElement && 95 !== ts.skipOuterExpressions(extendsClauseElement.expression).kind && (facts |= 64), shouldEmitDecorateCallForClass(node) && (facts |= 2), ts.childIsDecorated(node) && (facts |= 4), isExportOfNamespace(node) ? facts |= 8 : isDefaultExternalModuleExport(node) ? facts |= 32 : isNamedExternalModuleExport(node) && (facts |= 16), languageVersion <= 1 && 7 & facts && (facts |= 128), facts } function visitClassDeclaration(node) { var savedPendingExpressions = pendingExpressions; pendingExpressions = void 0; var staticProperties = getInitializedProperties(node, !0), facts = getClassFacts(node, staticProperties); 128 & facts && context.startLexicalEnvironment(); var name = node.name || (5 & facts ? ts.getGeneratedNameForNode(node) : void 0), classStatement = 2 & facts ? createClassDeclarationHeadWithDecorators(node, name, facts) : createClassDeclarationHeadWithoutDecorators(node, name, facts), statements = [classStatement]; if (ts.some(pendingExpressions) && statements.push(ts.createStatement(ts.inlineExpressions(pendingExpressions))), pendingExpressions = savedPendingExpressions, 1 & facts && addInitializedPropertyStatements(statements, staticProperties, 128 & facts ? ts.getInternalName(node) : ts.getLocalName(node)), addClassElementDecorationStatements(statements, node, !1), addClassElementDecorationStatements(statements, node, !0), addConstructorDecorationStatement(statements, node), 128 & facts) { var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentSourceFile.text, node.members.end), 18), localName = ts.getInternalName(node), outer = ts.createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end, ts.setEmitFlags(outer, 1536); var statement = ts.createReturn(outer); statement.pos = closingBraceLocation.pos, ts.setEmitFlags(statement, 1920), statements.push(statement), ts.prependStatements(statements, context.endLexicalEnvironment()); var iife = ts.createImmediatelyInvokedArrowFunction(statements); ts.setEmitFlags(iife, 33554432); var varStatement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getLocalName(node, !1, !1), void 0, iife)])); ts.setOriginalNode(varStatement, node), ts.setCommentRange(varStatement, node), ts.setSourceMapRange(varStatement, ts.moveRangePastDecorators(node)), ts.startOnNewLine(varStatement), statements = [varStatement] } return 8 & facts ? addExportMemberAssignment(statements, node) : (128 & facts || 2 & facts) && (32 & facts ? statements.push(ts.createExportDefault(ts.getLocalName(node, !1, !0))) : 16 & facts && statements.push(ts.createExternalModuleExport(ts.getLocalName(node, !1, !0)))), statements.length > 1 && (statements.push(ts.createEndOfDeclarationMarker(node)), ts.setEmitFlags(classStatement, 4194304 | ts.getEmitFlags(classStatement))), ts.singleOrMany(statements) } function createClassDeclarationHeadWithoutDecorators(node, name, facts) { var modifiers = 128 & facts ? void 0 : ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), classDeclaration = ts.createClassDeclaration(void 0, modifiers, name, void 0, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, 0 !== (64 & facts))), emitFlags = ts.getEmitFlags(node); return 1 & facts && (emitFlags |= 32), ts.setTextRange(classDeclaration, node), ts.setOriginalNode(classDeclaration, node), ts.setEmitFlags(classDeclaration, emitFlags), classDeclaration } function createClassDeclarationHeadWithDecorators(node, name, facts) { var location = ts.moveRangePastDecorators(node), classAlias = getClassAliasIfNeeded(node), declName = ts.getLocalName(node, !1, !0), heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), members = transformClassMembers(node, 0 !== (64 & facts)), classExpression = ts.createClassExpression(void 0, name, void 0, heritageClauses, members); ts.setOriginalNode(classExpression, node), ts.setTextRange(classExpression, location); var statement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(declName, void 0, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression)], 1)); return ts.setOriginalNode(statement, node), ts.setTextRange(statement, location), ts.setCommentRange(statement, node), statement } function visitClassExpression(node) { var savedPendingExpressions = pendingExpressions; pendingExpressions = void 0; var staticProperties = getInitializedProperties(node, !0), heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return 85 === c.token })), classExpression = ts.createClassExpression(void 0, node.name, void 0, heritageClauses, members); if (ts.setOriginalNode(classExpression, node), ts.setTextRange(classExpression, node), ts.some(staticProperties) || ts.some(pendingExpressions)) { var expressions = [], isClassWithConstructorReference = 8388608 & resolver.getNodeCheckFlags(node), temp = ts.createTempVariable(hoistVariableDeclaration, !!isClassWithConstructorReference); if (isClassWithConstructorReference) { enableSubstitutionForClassAliases(); var alias = ts.getSynthesizedClone(temp); alias.autoGenerateFlags &= -9, classAliases[ts.getOriginalNodeId(node)] = alias } return ts.setEmitFlags(classExpression, 65536 | ts.getEmitFlags(classExpression)), expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression))), ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)), pendingExpressions = savedPendingExpressions, ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)), expressions.push(ts.startOnNewLine(temp)), ts.inlineExpressions(expressions) } return pendingExpressions = savedPendingExpressions, classExpression } function transformClassMembers(node, isDerivedClass) { var members = [], constructor = transformConstructor(node, isDerivedClass); return constructor && members.push(constructor), ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement)), ts.setTextRange(ts.createNodeArray(members), node.members) } function transformConstructor(node, isDerivedClass) { var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty), hasParameterPropertyAssignments = 262144 & node.transformFlags, constructor = ts.getFirstConstructorWithBody(node); if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) return ts.visitEachChild(constructor, visitor, context); var parameters = transformConstructorParameters(constructor), body = transformConstructorBody(node, constructor, isDerivedClass); return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(ts.createConstructor(void 0, void 0, parameters, body), constructor || node), constructor)) } function transformConstructorParameters(constructor) { return ts.visitParameterList(constructor && constructor.parameters, visitor, context) || [] } function transformConstructorBody(node, constructor, isDerivedClass) { var statements = [], indexOfFirstStatement = 0; if (resumeLexicalEnvironment(), constructor) { indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); var propertyAssignments = getParametersWithPropertyAssignments(constructor); ts.addRange(statements, ts.map(propertyAssignments, transformParameterWithPropertyAssignment)) } else isDerivedClass && statements.push(ts.createStatement(ts.createCall(ts.createSuper(), void 0, [ts.createSpread(ts.createIdentifier("arguments"))]))); var properties = getInitializedProperties(node, !1); return addInitializedPropertyStatements(statements, properties, ts.createThis()), constructor && ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)), statements = ts.mergeLexicalEnvironment(statements, endLexicalEnvironment()), ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), !0), constructor ? constructor.body : void 0) } function addPrologueDirectivesAndInitialSuperCall(ctor, result) { if (ctor.body) { var statements = ctor.body.statements, index = ts.addPrologue(result, statements, !1, visitor); if (index === statements.length) return index; var statement = statements[index]; return 215 === statement.kind && ts.isSuperCall(statement.expression) ? (result.push(ts.visitNode(statement, visitor, ts.isStatement)), index + 1) : index } return 0 } function getParametersWithPropertyAssignments(node) { return ts.filter(node.parameters, isParameterWithPropertyAssignment) } function isParameterWithPropertyAssignment(parameter) { return ts.hasModifier(parameter, 92) && ts.isIdentifier(parameter.name) } function transformParameterWithPropertyAssignment(node) { ts.Debug.assert(ts.isIdentifier(node.name)); var name = node.name, propertyName = ts.getMutableClone(name); ts.setEmitFlags(propertyName, 1584); var localName = ts.getMutableClone(name); return ts.setEmitFlags(localName, 1536), ts.startOnNewLine(ts.setEmitFlags(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createThis(), propertyName), node.name), localName)), ts.moveRangePos(node, -1)), 1536)) } function getInitializedProperties(node, isStatic) { return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty) } function isStaticInitializedProperty(member) { return isInitializedProperty(member, !0) } function isInstanceInitializedProperty(member) { return isInitializedProperty(member, !1) } function isInitializedProperty(member, isStatic) { return 151 === member.kind && isStatic === ts.hasModifier(member, 32) && void 0 !== member.initializer } function addInitializedPropertyStatements(statements, properties, receiver) { for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { var property = properties_10[_i], statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)), ts.setCommentRange(statement, property), statements.push(statement) } } function generateInitializedPropertyExpressions(properties, receiver) { for (var expressions = [], _i = 0, properties_11 = properties; _i < properties_11.length; _i++) { var property = properties_11[_i], expression = transformInitializedProperty(property, receiver); ts.startOnNewLine(expression), ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)), ts.setCommentRange(expression, property), expressions.push(expression) } return expressions } function transformInitializedProperty(property, receiver) { var propertyName = ts.isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? ts.updateComputedPropertyName(property.name, ts.getGeneratedNameForNode(property.name)) : property.name, initializer = ts.visitNode(property.initializer, visitor, ts.isExpression), memberAccess = ts.createMemberAccessForPropertyName(receiver, propertyName, propertyName); return ts.createAssignment(memberAccess, initializer) } function getDecoratedClassElements(node, isStatic) { return ts.filter(node.members, isStatic ? function (m) { return isStaticDecoratedClassElement(m, node) } : function (m) { return isInstanceDecoratedClassElement(m, node) }) } function isStaticDecoratedClassElement(member, parent) { return isDecoratedClassElement(member, !0, parent) } function isInstanceDecoratedClassElement(member, parent) { return isDecoratedClassElement(member, !1, parent) } function isDecoratedClassElement(member, isStatic, parent) { return ts.nodeOrChildIsDecorated(member, parent) && isStatic === ts.hasModifier(member, 32) } function getDecoratorsOfParameters(node) { var decorators; if (node) for (var parameters = node.parameters, i = 0; i < parameters.length; i++) { var parameter = parameters[i]; (decorators || parameter.decorators) && (decorators || (decorators = new Array(parameters.length)), decorators[i] = parameter.decorators) } return decorators } function getAllDecoratorsOfConstructor(node) { var decorators = node.decorators, parameters = getDecoratorsOfParameters(ts.getFirstConstructorWithBody(node)); if (decorators || parameters) return { decorators: decorators, parameters: parameters } } function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { case 155: case 156: return getAllDecoratorsOfAccessors(node, member); case 153: return getAllDecoratorsOfMethod(member); case 151: return getAllDecoratorsOfProperty(member); default: return } } function getAllDecoratorsOfAccessors(node, accessor) { if (accessor.body) { var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor, firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : void 0; if (firstAccessorWithDecorators && accessor === firstAccessorWithDecorators) { var decorators = firstAccessorWithDecorators.decorators, parameters = getDecoratorsOfParameters(setAccessor); if (decorators || parameters) return { decorators: decorators, parameters: parameters } } } } function getAllDecoratorsOfMethod(method) { if (method.body) { var decorators = method.decorators, parameters = getDecoratorsOfParameters(method); if (decorators || parameters) return { decorators: decorators, parameters: parameters } } } function getAllDecoratorsOfProperty(property) { var decorators = property.decorators; if (decorators) return { decorators: decorators } } function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (allDecorators) { var decoratorExpressions = []; return ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)), ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)), addTypeMetadata(node, container, decoratorExpressions), decoratorExpressions } } function addClassElementDecorationStatements(statements, node, isStatic) { ts.addRange(statements, ts.map(generateClassElementDecorationExpressions(node, isStatic), expressionToStatement)) } function generateClassElementDecorationExpressions(node, isStatic) { for (var expressions, members = getDecoratedClassElements(node, isStatic), _i = 0, members_5 = members; _i < members_5.length; _i++) { var member = members_5[_i], expression = generateClassElementDecorationExpression(node, member); expression && (expressions ? expressions.push(expression) : expressions = [expression]) } return expressions } function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member), decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (decoratorExpressions) { var prefix = getClassMemberPrefix(node, member), memberName = getExpressionForPropertyName(member, !0), descriptor = languageVersion > 0 ? 151 === member.kind ? ts.createVoidZero() : ts.createNull() : void 0, helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); return ts.setEmitFlags(helper, 1536), helper } } function addConstructorDecorationStatement(statements, node) { var expression = generateConstructorDecorationExpression(node); expression && statements.push(ts.setOriginalNode(ts.createStatement(expression), node)) } function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node), decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (decoratorExpressions) { var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)], localName = ts.getLocalName(node, !1, !0), decorate = createDecorateHelper(context, decoratorExpressions, localName), expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate); return ts.setEmitFlags(expression, 1536), ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node)), expression } } function transformDecorator(decorator) { return ts.visitNode(decorator.expression, visitor, ts.isExpression) } function transformDecoratorsOfParameter(decorators, parameterOffset) { var expressions; if (decorators) { expressions = []; for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { var decorator = decorators_1[_i], helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression); ts.setEmitFlags(helper, 1536), expressions.push(helper) } } return expressions } function addTypeMetadata(node, container, decoratorExpressions) { USE_NEW_TYPE_METADATA_FORMAT ? addNewTypeMetadata(node, container, decoratorExpressions) : addOldTypeMetadata(node, container, decoratorExpressions) } function addOldTypeMetadata(node, container, decoratorExpressions) { compilerOptions.emitDecoratorMetadata && (shouldAddTypeMetadata(node) && decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))), shouldAddParamTypesMetadata(node) && decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))), shouldAddReturnTypeMetadata(node) && decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)))) } function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; shouldAddTypeMetadata(node) && (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(void 0, void 0, [], void 0, ts.createToken(36), serializeTypeOfNode(node)))), shouldAddParamTypesMetadata(node) && (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(void 0, void 0, [], void 0, ts.createToken(36), serializeParameterTypesOfNode(node, container)))), shouldAddReturnTypeMetadata(node) && (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(void 0, void 0, [], void 0, ts.createToken(36), serializeReturnTypeOfNode(node)))), properties && decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, !0))) } } function shouldAddTypeMetadata(node) { var kind = node.kind; return 153 === kind || 155 === kind || 156 === kind || 151 === kind } function shouldAddReturnTypeMetadata(node) { return 153 === node.kind } function shouldAddParamTypesMetadata(node) { switch (node.kind) { case 234: case 204: return void 0 !== ts.getFirstConstructorWithBody(node); case 153: case 155: case 156: return !0 }return !1 } function serializeTypeOfNode(node) { switch (node.kind) { case 151: case 148: case 155: return serializeTypeNode(node.type); case 156: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); case 234: case 204: case 153: return ts.createIdentifier("Function"); default: return ts.createVoidZero() } } function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) ? node : void 0, expressions = []; if (valueDeclaration) for (var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container), numParameters = parameters.length, i = 0; i < numParameters; i++) { var parameter = parameters[i]; 0 === i && ts.isIdentifier(parameter.name) && "this" === parameter.name.escapedText || (parameter.dotDotDotToken ? expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))) : expressions.push(serializeTypeOfNode(parameter))) } return ts.createArrayLiteral(expressions) } function getParametersOfDecoratedDeclaration(node, container) { if (container && 155 === node.kind) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) return setAccessor.parameters } return node.parameters } function serializeReturnTypeOfNode(node) { return ts.isFunctionLike(node) && node.type ? serializeTypeNode(node.type) : ts.isAsyncFunction(node) ? ts.createIdentifier("Promise") : ts.createVoidZero() } function serializeTypeNode(node) { if (void 0 === node) return ts.createIdentifier("Object"); switch (node.kind) { case 105: case 140: case 95: case 131: return ts.createVoidZero(); case 172: return serializeTypeNode(node.type); case 162: case 163: return ts.createIdentifier("Function"); case 166: case 167: return ts.createIdentifier("Array"); case 160: case 122: return ts.createIdentifier("Boolean"); case 137: return ts.createIdentifier("String"); case 135: return ts.createIdentifier("Object"); case 177: switch (node.literal.kind) { case 9: return ts.createIdentifier("String"); case 8: return ts.createIdentifier("Number"); case 101: case 86: return ts.createIdentifier("Boolean"); default: return ts.Debug.failBadSyntaxKind(node.literal) }case 134: return ts.createIdentifier("Number"); case 138: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); case 161: return serializeTypeReferenceNode(node); case 169: case 168: return serializeUnionOrIntersectionType(node); case 164: case 174: case 175: case 176: case 165: case 119: case 173: case 178: break; default: return ts.Debug.failBadSyntaxKind(node) }return ts.createIdentifier("Object") } function serializeUnionOrIntersectionType(node) { for (var serializedUnion, _i = 0, _a = node.types; _i < _a.length; _i++) { for (var typeNode = _a[_i]; 172 === typeNode.kind;)typeNode = typeNode.type; if (131 !== typeNode.kind && (strictNullChecks || 95 !== typeNode.kind && 140 !== typeNode.kind)) { var serializedIndividual = serializeTypeNode(typeNode); if (ts.isIdentifier(serializedIndividual) && "Object" === serializedIndividual.escapedText) return serializedIndividual; if (serializedUnion) { if (!ts.isIdentifier(serializedUnion) || !ts.isIdentifier(serializedIndividual) || serializedUnion.escapedText !== serializedIndividual.escapedText) return ts.createIdentifier("Object") } else serializedUnion = serializedIndividual } } return serializedUnion || ts.createVoidZero() } function serializeTypeReferenceNode(node) { var kind = resolver.getTypeReferenceSerializationKind(node.typeName, currentScope); switch (kind) { case ts.TypeReferenceSerializationKind.Unknown: var serialized = serializeEntityNameAsExpression(node.typeName, !0), temp = ts.createTempVariable(hoistVariableDeclaration); return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object")); case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: return serializeEntityNameAsExpression(node.typeName, !1); case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType: return ts.createVoidZero(); case ts.TypeReferenceSerializationKind.BooleanType: return ts.createIdentifier("Boolean"); case ts.TypeReferenceSerializationKind.NumberLikeType: return ts.createIdentifier("Number"); case ts.TypeReferenceSerializationKind.StringLikeType: return ts.createIdentifier("String"); case ts.TypeReferenceSerializationKind.ArrayLikeType: return ts.createIdentifier("Array"); case ts.TypeReferenceSerializationKind.ESSymbolType: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); case ts.TypeReferenceSerializationKind.TypeWithCallSignature: return ts.createIdentifier("Function"); case ts.TypeReferenceSerializationKind.Promise: return ts.createIdentifier("Promise"); case ts.TypeReferenceSerializationKind.ObjectType: return ts.createIdentifier("Object"); default: return ts.Debug.assertNever(kind) } } function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 71: var name = ts.getMutableClone(node); return name.flags &= -9, name.original = void 0, name.parent = ts.getParseTreeNode(currentScope), useFallback ? ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name) : name; case 145: return serializeQualifiedNameAsExpression(node, useFallback) } } function serializeQualifiedNameAsExpression(node, useFallback) { var left; if (71 === node.left.kind) left = serializeEntityNameAsExpression(node.left, useFallback); else if (useFallback) { var temp = ts.createTempVariable(hoistVariableDeclaration); left = ts.createLogicalAnd(ts.createAssignment(temp, serializeEntityNameAsExpression(node.left, !0)), temp) } else left = serializeEntityNameAsExpression(node.left, !1); return ts.createPropertyAccess(left, node.right) } function getGlobalSymbolNameWithFallback() { return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object")) } function isSimpleInlineableExpression(expression) { return !ts.isIdentifier(expression) && ts.isSimpleCopiableExpression(expression) || ts.isWellKnownSymbolSyntactically(expression) } function getExpressionForPropertyName(member, generateNameForComputedPropertyName) { var name = member.name; return ts.isComputedPropertyName(name) ? generateNameForComputedPropertyName && !isSimpleInlineableExpression(name.expression) ? ts.getGeneratedNameForNode(name) : name.expression : ts.isIdentifier(name) ? ts.createLiteral(ts.idText(name)) : ts.getSynthesizedClone(name) } function getPropertyNameExpressionIfNeeded(name, shouldHoist, omitSimple) { if (ts.isComputedPropertyName(name)) { var expression = ts.visitNode(name.expression, visitor, ts.isExpression), innerExpression = ts.skipPartiallyEmittedExpressions(expression), inlinable = isSimpleInlineableExpression(innerExpression); if (!inlinable && shouldHoist) { var generatedName = ts.getGeneratedNameForNode(name); return hoistVariableDeclaration(generatedName), ts.createAssignment(generatedName, expression) } return omitSimple && (inlinable || ts.isIdentifier(innerExpression)) ? void 0 : expression } } function visitPropertyNameOfClassElement(member) { var name = member.name, expr = getPropertyNameExpressionIfNeeded(name, ts.some(member.decorators), !1); return expr ? (ts.some(pendingExpressions) && (expr = ts.inlineExpressions(pendingExpressions.concat([expr])), pendingExpressions.length = 0), ts.updateComputedPropertyName(name, expr)) : name } function visitHeritageClause(node) { if (85 === node.token) { var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1); return ts.setTextRange(ts.createHeritageClause(85, types), node) } } function visitExpressionWithTypeArguments(node) { return ts.updateExpressionWithTypeArguments(node, void 0, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)) } function shouldEmitFunctionLikeDeclaration(node) { return !ts.nodeIsMissing(node.body) } function visitPropertyDeclaration(node) { var expr = getPropertyNameExpressionIfNeeded(node.name, ts.some(node.decorators) || !!node.initializer, !0); expr && !isSimpleInlineableExpression(expr) && (pendingExpressions || (pendingExpressions = [])).push(expr) } function visitConstructor(node) { if (shouldEmitFunctionLikeDeclaration(node)) return ts.updateConstructor(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), ts.visitNodes(node.modifiers, visitor, ts.isModifier), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context)) } function visitMethodDeclaration(node) { if (shouldEmitFunctionLikeDeclaration(node)) { var updated = ts.updateMethod(node, void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), void 0, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, ts.visitFunctionBody(node.body, visitor, context)); return updated !== node && (ts.setCommentRange(updated, node), ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node))), updated } } function shouldEmitAccessorDeclaration(node) { return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128)) } function visitGetAccessor(node) { if (shouldEmitAccessorDeclaration(node)) { var updated = ts.updateGetAccessor(node, void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), void 0, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated !== node && (ts.setCommentRange(updated, node), ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node))), updated } } function visitSetAccessor(node) { if (shouldEmitAccessorDeclaration(node)) { var updated = ts.updateSetAccessor(node, void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated !== node && (ts.setCommentRange(updated, node), ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node))), updated } } function visitFunctionDeclaration(node) { if (!shouldEmitFunctionLikeDeclaration(node)) return ts.createNotEmittedStatement(node); var updated = ts.updateFunctionDeclaration(node, void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isExportOfNamespace(node)) { var statements = [updated]; return addExportMemberAssignment(statements, node), statements } return updated } function visitFunctionExpression(node) { if (!shouldEmitFunctionLikeDeclaration(node)) return ts.createOmittedExpression(); var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated } function visitArrowFunction(node) { var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, node.equalsGreaterThanToken, ts.visitFunctionBody(node.body, visitor, context)); return updated } function visitParameter(node) { if (!ts.parameterIsThisKeyword(node)) { var parameter = ts.createParameter(void 0, void 0, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), void 0, void 0, ts.visitNode(node.initializer, visitor, ts.isExpression)); return ts.setOriginalNode(parameter, node), ts.setTextRange(parameter, ts.moveRangePastModifiers(node)), ts.setCommentRange(parameter, node), ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)), ts.setEmitFlags(parameter.name, 32), parameter } } function visitVariableStatement(node) { if (isExportOfNamespace(node)) { var variables = ts.getInitializedVariables(node.declarationList); if (0 === variables.length) return; return ts.setTextRange(ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))), node) } return ts.visitEachChild(node, visitor, context) } function transformInitializedVariable(node) { var name = node.name; return ts.isBindingPattern(name) ? ts.flattenDestructuringAssignment(node, visitor, context, 0, !1, createNamespaceExportExpression) : ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression)), node) } function visitVariableDeclaration(node) { return ts.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), void 0, ts.visitNode(node.initializer, visitor, ts.isExpression)) } function visitParenthesizedExpression(node) { var innerExpression = ts.skipOuterExpressions(node.expression, -3); if (ts.isAssertionExpression(innerExpression)) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression); return ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile)) ? ts.updateParen(node, expression) : ts.createPartiallyEmittedExpression(expression, node) } return ts.visitEachChild(node, visitor, context) } function visitAssertionExpression(node) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression); return ts.createPartiallyEmittedExpression(expression, node) } function visitNonNullExpression(node) { var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return ts.createPartiallyEmittedExpression(expression, node) } function visitCallExpression(node) { return ts.updateCall(node, ts.visitNode(node.expression, visitor, ts.isExpression), void 0, ts.visitNodes(node.arguments, visitor, ts.isExpression)) } function visitNewExpression(node) { return ts.updateNew(node, ts.visitNode(node.expression, visitor, ts.isExpression), void 0, ts.visitNodes(node.arguments, visitor, ts.isExpression)) } function visitTaggedTemplateExpression(node) { return ts.updateTaggedTemplate(node, ts.visitNode(node.tag, visitor, ts.isExpression), void 0, ts.visitNode(node.template, visitor, ts.isExpression)) } function shouldEmitEnumDeclaration(node) { return !ts.isConst(node) || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules } function visitEnumDeclaration(node) { if (shouldEmitEnumDeclaration(node)) { var statements = [], emitFlags = 2; addVarForEnumOrModuleDeclaration(statements, node) && (moduleKind === ts.ModuleKind.System && currentScope === currentSourceFile || (emitFlags |= 512)); var parameterName = getNamespaceParameterName(node), containerName = getNamespaceContainerName(node), exportName = ts.hasModifier(node, 1) ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, !1, !0) : ts.getLocalName(node, !1, !0), moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral())); if (hasNamespaceQualifiedExportName(node)) { var localName = ts.getLocalName(node, !1, !0); moduleArg = ts.createAssignment(localName, moduleArg) } var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, parameterName)], void 0, transformEnumBody(node, containerName)), void 0, [moduleArg])); return ts.setOriginalNode(enumStatement, node), ts.setTextRange(enumStatement, node), ts.setEmitFlags(enumStatement, emitFlags), statements.push(enumStatement), statements.push(ts.createEndOfDeclarationMarker(node)), statements } } function transformEnumBody(node, localName) { var savedCurrentNamespaceLocalName = currentNamespaceContainerName; currentNamespaceContainerName = localName; var statements = []; startLexicalEnvironment(); var members = ts.map(node.members, transformEnumMember); return ts.prependStatements(statements, endLexicalEnvironment()), ts.addRange(statements, members), currentNamespaceContainerName = savedCurrentNamespaceLocalName, ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), !0) } function transformEnumMember(member) { var name = getExpressionForPropertyName(member, !1), valueExpression = transformEnumMemberDeclarationValue(member), innerAssignment = ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), valueExpression), outerAssignment = 9 === valueExpression.kind ? innerAssignment : ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, innerAssignment), name); return ts.setTextRange(ts.createStatement(ts.setTextRange(outerAssignment, member)), member) } function transformEnumMemberDeclarationValue(member) { var value = resolver.getConstantValue(member); return void 0 !== value ? ts.createLiteral(value) : (enableSubstitutionForNonQualifiedEnumMembers(), member.initializer ? ts.visitNode(member.initializer, visitor, ts.isExpression) : ts.createVoidZero()) } function shouldEmitModuleDeclaration(node) { return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules) } function hasNamespaceQualifiedExportName(node) { return isExportOfNamespace(node) || isExternalModuleExport(node) && moduleKind !== ts.ModuleKind.ES2015 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System } function recordEmittedDeclarationInScope(node) { currentScopeFirstDeclarationsOfName || (currentScopeFirstDeclarationsOfName = ts.createUnderscoreEscapedMap()); var name = declaredNameInScope(node); currentScopeFirstDeclarationsOfName.has(name) || currentScopeFirstDeclarationsOfName.set(name, node) } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { var name = declaredNameInScope(node); return currentScopeFirstDeclarationsOfName.get(name) === node } return !0 } function declaredNameInScope(node) { return ts.Debug.assertNode(node.name, ts.isIdentifier), node.name.escapedText } function addVarForEnumOrModuleDeclaration(statements, node) { var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getLocalName(node, !1, !0))], 273 === currentScope.kind ? 0 : 1)); if (ts.setOriginalNode(statement, node), recordEmittedDeclarationInScope(node), isFirstEmittedDeclarationInScope(node)) return 237 === node.kind ? ts.setSourceMapRange(statement.declarationList, node) : ts.setSourceMapRange(statement, node), ts.setCommentRange(statement, node), ts.setEmitFlags(statement, 4195328), statements.push(statement), !0; var mergeMarker = ts.createMergeDeclarationMarker(statement); return ts.setEmitFlags(mergeMarker, 4195840), statements.push(mergeMarker), !1 } function visitModuleDeclaration(node) { if (!shouldEmitModuleDeclaration(node)) return ts.createNotEmittedStatement(node); ts.Debug.assertNode(node.name, ts.isIdentifier, "A TypeScript namespace should have an Identifier name."), enableSubstitutionForNamespaceExports(); var statements = [], emitFlags = 2; addVarForEnumOrModuleDeclaration(statements, node) && (moduleKind === ts.ModuleKind.System && currentScope === currentSourceFile || (emitFlags |= 512)); var parameterName = getNamespaceParameterName(node), containerName = getNamespaceContainerName(node), exportName = ts.hasModifier(node, 1) ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, !1, !0) : ts.getLocalName(node, !1, !0), moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral())); if (hasNamespaceQualifiedExportName(node)) { var localName = ts.getLocalName(node, !1, !0); moduleArg = ts.createAssignment(localName, moduleArg) } var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, parameterName)], void 0, transformModuleBody(node, containerName)), void 0, [moduleArg])); return ts.setOriginalNode(moduleStatement, node), ts.setTextRange(moduleStatement, node), ts.setEmitFlags(moduleStatement, emitFlags), statements.push(moduleStatement), statements.push(ts.createEndOfDeclarationMarker(node)), statements } function transformModuleBody(node, namespaceLocalName) { var savedCurrentNamespaceContainerName = currentNamespaceContainerName, savedCurrentNamespace = currentNamespace, savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; currentNamespaceContainerName = namespaceLocalName, currentNamespace = node, currentScopeFirstDeclarationsOfName = void 0; var statements = []; startLexicalEnvironment(); var statementsLocation, blockLocation, body = node.body; if (239 === body.kind) saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)) }), statementsLocation = body.statements, blockLocation = body; else { var result = visitModuleDeclaration(body); result && (ts.isArray(result) ? ts.addRange(statements, result) : statements.push(result)); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; statementsLocation = ts.moveRangePos(moduleBlock.statements, -1) } ts.prependStatements(statements, endLexicalEnvironment()), currentNamespaceContainerName = savedCurrentNamespaceContainerName, currentNamespace = savedCurrentNamespace, currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), !0); return ts.setTextRange(block, blockLocation), 239 !== body.kind && ts.setEmitFlags(block, 1536 | ts.getEmitFlags(block)), block } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { if (238 === moduleDeclaration.body.kind) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body } } function visitImportDeclaration(node) { if (!node.importClause) return node; var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause); return importClause ? ts.updateImportDeclaration(node, void 0, void 0, importClause, node.moduleSpecifier) : void 0 } function visitImportClause(node) { var name = resolver.isReferencedAliasDeclaration(node) ? node.name : void 0, namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings); return name || namedBindings ? ts.updateImportClause(node, name, namedBindings) : void 0 } function visitNamedImportBindings(node) { if (245 === node.kind) return resolver.isReferencedAliasDeclaration(node) ? node : void 0; var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier); return ts.some(elements) ? ts.updateNamedImports(node, elements) : void 0 } function visitImportSpecifier(node) { return resolver.isReferencedAliasDeclaration(node) ? node : void 0 } function visitExportAssignment(node) { return resolver.isValueAliasDeclaration(node) ? ts.visitEachChild(node, visitor, context) : void 0 } function visitExportDeclaration(node) { if (!node.exportClause) return compilerOptions.isolatedModules || resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : void 0; if (resolver.isValueAliasDeclaration(node)) { var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports); return exportClause ? ts.updateExportDeclaration(node, void 0, void 0, exportClause, node.moduleSpecifier) : void 0 } } function visitNamedExports(node) { var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier); return ts.some(elements) ? ts.updateNamedExports(node, elements) : void 0 } function visitExportSpecifier(node) { return resolver.isValueAliasDeclaration(node) ? node : void 0 } function shouldEmitImportEqualsDeclaration(node) { return resolver.isReferencedAliasDeclaration(node) || !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node) } function visitImportEqualsDeclaration(node) { if (ts.isExternalModuleImportEqualsDeclaration(node)) return resolver.isReferencedAliasDeclaration(node) ? ts.visitEachChild(node, visitor, context) : void 0; if (shouldEmitImportEqualsDeclaration(node)) { var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); return ts.setEmitFlags(moduleReference, 3584), isNamedExternalModuleExport(node) || !isExportOfNamespace(node) ? ts.setOriginalNode(ts.setTextRange(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ts.setOriginalNode(ts.createVariableDeclaration(node.name, void 0, moduleReference), node)])), node), node) : ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node) } } function isExportOfNamespace(node) { return void 0 !== currentNamespace && ts.hasModifier(node, 1) } function isExternalModuleExport(node) { return void 0 === currentNamespace && ts.hasModifier(node, 1) } function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) && !ts.hasModifier(node, 512) } function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) && ts.hasModifier(node, 512) } function expressionToStatement(expression) { return ts.createStatement(expression) } function addExportMemberAssignment(statements, node) { var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, !1, !0), ts.getLocalName(node)); ts.setSourceMapRange(expression, ts.createRange(node.name ? node.name.pos : node.pos, node.end)); var statement = ts.createStatement(expression); ts.setSourceMapRange(statement, ts.createRange(-1, node.end)), statements.push(statement) } function createNamespaceExport(exportName, exportValue, location) { return ts.setTextRange(ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, !1, !0), exportValue)), location) } function createNamespaceExportExpression(exportName, exportValue, location) { return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location) } function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { return ts.getNamespaceMemberName(currentNamespaceContainerName, name, !1, !0) } function getNamespaceParameterName(node) { var name = ts.getGeneratedNameForNode(node); return ts.setSourceMapRange(name, node.name), name } function getNamespaceContainerName(node) { return ts.getGeneratedNameForNode(node) } function getClassAliasIfNeeded(node) { if (8388608 & resolver.getNodeCheckFlags(node)) { enableSubstitutionForClassAliases(); var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.idText(node.name) : "default"); return classAliases[ts.getOriginalNodeId(node)] = classAlias, hoistVariableDeclaration(classAlias), classAlias } } function getClassPrototype(node) { return ts.createPropertyAccess(ts.getDeclarationName(node), "prototype") } function getClassMemberPrefix(node, member) { return ts.hasModifier(member, 32) ? ts.getDeclarationName(node) : getClassPrototype(node) } function enableSubstitutionForNonQualifiedEnumMembers() { 0 === (8 & enabledSubstitutions) && (enabledSubstitutions |= 8, context.enableSubstitution(71)) } function enableSubstitutionForClassAliases() { 0 === (1 & enabledSubstitutions) && (enabledSubstitutions |= 1, context.enableSubstitution(71), classAliases = []) } function enableSubstitutionForNamespaceExports() { 0 === (2 & enabledSubstitutions) && (enabledSubstitutions |= 2, context.enableSubstitution(71), context.enableSubstitution(270), context.enableEmitNotification(238)) } function isTransformedModuleDeclaration(node) { return 238 === ts.getOriginalNode(node).kind } function isTransformedEnumDeclaration(node) { return 237 === ts.getOriginalNode(node).kind } function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions, savedCurrentSourceFile = currentSourceFile; ts.isSourceFile(node) && (currentSourceFile = node), 2 & enabledSubstitutions && isTransformedModuleDeclaration(node) && (applicableSubstitutions |= 2), 8 & enabledSubstitutions && isTransformedEnumDeclaration(node) && (applicableSubstitutions |= 8), previousOnEmitNode(hint, node, emitCallback), applicableSubstitutions = savedApplicableSubstitutions, currentSourceFile = savedCurrentSourceFile } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), 1 === hint ? substituteExpression(node) : ts.isShorthandPropertyAssignment(node) ? substituteShorthandPropertyAssignment(node) : node } function substituteShorthandPropertyAssignment(node) { if (2 & enabledSubstitutions) { var name = node.name, exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node) } return ts.setTextRange(ts.createPropertyAssignment(name, exportedName), node) } } return node } function substituteExpression(node) { switch (node.kind) { case 71: return substituteExpressionIdentifier(node); case 184: return substitutePropertyAccessExpression(node); case 185: return substituteElementAccessExpression(node) }return node } function substituteExpressionIdentifier(node) { return trySubstituteClassAlias(node) || trySubstituteNamespaceExportedName(node) || node } function trySubstituteClassAlias(node) { if (1 & enabledSubstitutions && 16777216 & resolver.getNodeCheckFlags(node)) { var declaration = resolver.getReferencedValueDeclaration(node); if (declaration) { var classAlias = classAliases[declaration.id]; if (classAlias) { var clone_1 = ts.getSynthesizedClone(classAlias); return ts.setSourceMapRange(clone_1, node), ts.setCommentRange(clone_1, node), clone_1 } } } } function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, !1); if (container && 273 !== container.kind) { var substitute = 2 & applicableSubstitutions && 238 === container.kind || 8 & applicableSubstitutions && 237 === container.kind; if (substitute) return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), node) } } } function substitutePropertyAccessExpression(node) { return substituteConstantValue(node) } function substituteElementAccessExpression(node) { return substituteConstantValue(node) } function substituteConstantValue(node) { var constantValue = tryGetConstEnumValue(node); if (void 0 !== constantValue) { ts.setConstantValue(node, constantValue); var substitute = ts.createLiteral(constantValue); if (!compilerOptions.removeComments) { var propertyName = ts.isPropertyAccessExpression(node) ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); ts.addSyntheticTrailingComment(substitute, 3, " " + propertyName + " ") } return substitute } return node } function tryGetConstEnumValue(node) { if (!compilerOptions.isolatedModules) return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0 } var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, resolver = context.getEmitResolver(), compilerOptions = context.getCompilerOptions(), strictNullChecks = ts.getStrictOptionValue(compilerOptions, "strictNullChecks"), languageVersion = ts.getEmitScriptTarget(compilerOptions), moduleKind = ts.getEmitModuleKind(compilerOptions), previousOnEmitNode = context.onEmitNode, previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode, context.onSubstituteNode = onSubstituteNode, context.enableSubstitution(184), context.enableSubstitution(185); var currentSourceFile, currentNamespace, currentNamespaceContainerName, currentScope, currentScopeFirstDeclarationsOfName, enabledSubstitutions, classAliases, applicableSubstitutions, pendingExpressions; return transformSourceFileOrBundle } function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { var argumentsArray = []; return argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, !0)), argumentsArray.push(target), memberName && (argumentsArray.push(memberName), descriptor && argumentsArray.push(descriptor)), context.requestEmitHelper(decorateHelper), ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"), void 0, argumentsArray), location) } function createMetadataHelper(context, metadataKey, metadataValue) { return context.requestEmitHelper(metadataHelper), ts.createCall(ts.getHelperName("__metadata"), void 0, [ts.createLiteral(metadataKey), metadataValue]) } function createParamHelper(context, expression, parameterOffset, location) { return context.requestEmitHelper(paramHelper), ts.setTextRange(ts.createCall(ts.getHelperName("__param"), void 0, [ts.createLiteral(parameterOffset), expression]), location) } var TypeScriptSubstitutionFlags, USE_NEW_TYPE_METADATA_FORMAT = !1; !function (TypeScriptSubstitutionFlags) { TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags.ClassAliases = 1] = "ClassAliases", TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags.NamespaceExports = 2] = "NamespaceExports", TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags.NonQualifiedEnumMembers = 8] = "NonQualifiedEnumMembers" }(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {})); var ClassFacts; !function (ClassFacts) { ClassFacts[ClassFacts.None = 0] = "None", ClassFacts[ClassFacts.HasStaticInitializedProperties = 1] = "HasStaticInitializedProperties", ClassFacts[ClassFacts.HasConstructorDecorators = 2] = "HasConstructorDecorators", ClassFacts[ClassFacts.HasMemberDecorators = 4] = "HasMemberDecorators", ClassFacts[ClassFacts.IsExportOfNamespace = 8] = "IsExportOfNamespace", ClassFacts[ClassFacts.IsNamedExternalExport = 16] = "IsNamedExternalExport", ClassFacts[ClassFacts.IsDefaultExternalExport = 32] = "IsDefaultExternalExport", ClassFacts[ClassFacts.IsDerivedClass = 64] = "IsDerivedClass", ClassFacts[ClassFacts.UseImmediatelyInvokedFunctionExpression = 128] = "UseImmediatelyInvokedFunctionExpression", ClassFacts[ClassFacts.HasAnyDecorators = 6] = "HasAnyDecorators", ClassFacts[ClassFacts.NeedsName = 5] = "NeedsName", ClassFacts[ClassFacts.MayNeedImmediatelyInvokedFunctionExpression = 7] = "MayNeedImmediatelyInvokedFunctionExpression", ClassFacts[ClassFacts.IsExported = 56] = "IsExported" }(ClassFacts || (ClassFacts = {})), ts.transformTypeScript = transformTypeScript; var decorateHelper = { name: "typescript:decorate", scoped: !1, priority: 2, text: '\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };' }, metadataHelper = { name: "typescript:metadata", scoped: !1, priority: 3, text: '\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);\n };' }, paramHelper = { name: "typescript:param", scoped: !1, priority: 4, text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" } }(ts || (ts = {})); var ts; !function (ts) { function transformES2017(context) { function transformSourceFile(node) { if (node.isDeclarationFile) return node; var visited = ts.visitEachChild(node, visitor, context); return ts.addEmitHelpers(visited, context.readEmitHelpers()), visited } function visitor(node) { if (0 === (16 & node.transformFlags)) return node; switch (node.kind) { case 120: return; case 196: return visitAwaitExpression(node); case 153: return visitMethodDeclaration(node); case 233: return visitFunctionDeclaration(node); case 191: return visitFunctionExpression(node); case 192: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context) } } function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) switch (node.kind) { case 213: return visitVariableStatementInAsyncBody(node); case 219: return visitForStatementInAsyncBody(node); case 220: return visitForInStatementInAsyncBody(node); case 221: return visitForOfStatementInAsyncBody(node); case 268: return visitCatchClauseInAsyncBody(node); case 212: case 226: case 240: case 265: case 266: case 229: case 217: case 218: case 216: case 225: case 227: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node.") }return visitor(node) } function visitCatchClauseInAsyncBody(node) { var catchClauseNames = ts.createUnderscoreEscapedMap(); recordDeclarationName(node.variableDeclaration, catchClauseNames); var catchClauseUnshadowedNames; if (catchClauseNames.forEach(function (_, escapedName) { enclosingFunctionParameterNames.has(escapedName) && (catchClauseUnshadowedNames || (catchClauseUnshadowedNames = ts.cloneMap(enclosingFunctionParameterNames)), catchClauseUnshadowedNames.delete(escapedName)) }), catchClauseUnshadowedNames) { var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = catchClauseUnshadowedNames; var result = ts.visitEachChild(node, asyncBodyVisitor, context); return enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames, result } return ts.visitEachChild(node, asyncBodyVisitor, context) } function visitVariableStatementInAsyncBody(node) { if (isVariableDeclarationListWithCollidingName(node.declarationList)) { var expression = visitVariableDeclarationListWithCollidingNames(node.declarationList, !1); return expression ? ts.createStatement(expression) : void 0 } return ts.visitEachChild(node, visitor, context) } function visitForInStatementInAsyncBody(node) { return ts.updateForIn(node, isVariableDeclarationListWithCollidingName(node.initializer) ? visitVariableDeclarationListWithCollidingNames(node.initializer, !0) : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, asyncBodyVisitor, ts.isStatement, ts.liftToBlock)) } function visitForOfStatementInAsyncBody(node) { return ts.updateForOf(node, ts.visitNode(node.awaitModifier, visitor, ts.isToken), isVariableDeclarationListWithCollidingName(node.initializer) ? visitVariableDeclarationListWithCollidingNames(node.initializer, !0) : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, asyncBodyVisitor, ts.isStatement, ts.liftToBlock)) } function visitForStatementInAsyncBody(node) { return ts.updateFor(node, isVariableDeclarationListWithCollidingName(node.initializer) ? visitVariableDeclarationListWithCollidingNames(node.initializer, !1) : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, asyncBodyVisitor, ts.isStatement, ts.liftToBlock)) } function visitAwaitExpression(node) { return ts.setOriginalNode(ts.setTextRange(ts.createYield(void 0, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node) } function visitMethodDeclaration(node) { return ts.updateMethod(node, void 0, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, void 0, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, 2 & ts.getFunctionFlags(node) ? transformAsyncFunctionBody(node) : ts.visitFunctionBody(node.body, visitor, context)) } function visitFunctionDeclaration(node) { return ts.updateFunctionDeclaration(node, void 0, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, 2 & ts.getFunctionFlags(node) ? transformAsyncFunctionBody(node) : ts.visitFunctionBody(node.body, visitor, context)) } function visitFunctionExpression(node) { return ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, 2 & ts.getFunctionFlags(node) ? transformAsyncFunctionBody(node) : ts.visitFunctionBody(node.body, visitor, context)) } function visitArrowFunction(node) { return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, node.equalsGreaterThanToken, 2 & ts.getFunctionFlags(node) ? transformAsyncFunctionBody(node) : ts.visitFunctionBody(node.body, visitor, context)) } function recordDeclarationName(_a, names) { var name = _a.name; if (ts.isIdentifier(name)) names.set(name.escapedText, !0); else for (var _i = 0, _b = name.elements; _i < _b.length; _i++) { var element = _b[_i]; ts.isOmittedExpression(element) || recordDeclarationName(element, names) } } function isVariableDeclarationListWithCollidingName(node) { return node && ts.isVariableDeclarationList(node) && !(3 & node.flags) && ts.forEach(node.declarations, collidesWithParameterName) } function visitVariableDeclarationListWithCollidingNames(node, hasReceiver) { hoistVariableDeclarationList(node); var variables = ts.getInitializedVariables(node); { if (0 !== variables.length) return ts.inlineExpressions(ts.map(variables, transformInitializedVariable)); if (hasReceiver) return ts.visitNode(ts.convertToAssignmentElementTarget(node.declarations[0].name), visitor, ts.isExpression) } } function hoistVariableDeclarationList(node) { ts.forEach(node.declarations, hoistVariable) } function hoistVariable(_a) { var name = _a.name; if (ts.isIdentifier(name)) hoistVariableDeclaration(name); else for (var _i = 0, _b = name.elements; _i < _b.length; _i++) { var element = _b[_i]; ts.isOmittedExpression(element) || hoistVariable(element) } } function transformInitializedVariable(node) { var converted = ts.setSourceMapRange(ts.createAssignment(ts.convertToAssignmentElementTarget(node.name), node.initializer), node); return ts.visitNode(converted, visitor, ts.isExpression) } function collidesWithParameterName(_a) { var name = _a.name; if (ts.isIdentifier(name)) return enclosingFunctionParameterNames.has(name.escapedText); for (var _i = 0, _b = name.elements; _i < _b.length; _i++) { var element = _b[_i]; if (!ts.isOmittedExpression(element) && collidesWithParameterName(element)) return !0 } return !1 } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike), nodeType = original.type, promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : void 0, isArrowFunction = 192 === node.kind, hasLexicalArguments = 0 !== (8192 & resolver.getNodeCheckFlags(node)), savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; recordDeclarationName(parameter, enclosingFunctionParameterNames) } var result; if (isArrowFunction) { var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body)), declarations = endLexicalEnvironment(); if (ts.some(declarations)) { var block = ts.convertToFunctionBody(expression); result = ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, block.statements)), block.statements)) } else result = expression } else { var statements = [], statementOffset = ts.addPrologue(statements, node.body.statements, !1, visitor); statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset)))), ts.prependStatements(statements, endLexicalEnvironment()); var block = ts.createBlock(statements, !0); ts.setTextRange(block, node.body), languageVersion >= 2 && (4096 & resolver.getNodeCheckFlags(node) ? (enableSubstitutionForAsyncMethodsWithSuper(), ts.addEmitHelper(block, ts.advancedAsyncSuperHelper)) : 2048 & resolver.getNodeCheckFlags(node) && (enableSubstitutionForAsyncMethodsWithSuper(), ts.addEmitHelper(block, ts.asyncSuperHelper))), result = block } return enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames, result } function transformAsyncFunctionBodyWorker(body, start) { return ts.isBlock(body) ? ts.updateBlock(body, ts.visitNodes(body.statements, asyncBodyVisitor, ts.isStatement, start)) : ts.convertToFunctionBody(ts.visitNode(body, asyncBodyVisitor, ts.isConciseBody)) } function getPromiseConstructor(type) { var typeName = type && ts.getEntityNameFromTypeNode(type); if (typeName && ts.isEntityName(typeName)) { var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue || serializationKind === ts.TypeReferenceSerializationKind.Unknown) return typeName } } function enableSubstitutionForAsyncMethodsWithSuper() { 0 === (1 & enabledSubstitutions) && (enabledSubstitutions |= 1, context.enableSubstitution(186), context.enableSubstitution(184), context.enableSubstitution(185), context.enableEmitNotification(234), context.enableEmitNotification(153), context.enableEmitNotification(155), context.enableEmitNotification(156), context.enableEmitNotification(154)) } function onEmitNode(hint, node, emitCallback) { if (1 & enabledSubstitutions && isSuperContainer(node)) { var superContainerFlags = 6144 & resolver.getNodeCheckFlags(node); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; return enclosingSuperContainerFlags = superContainerFlags, previousOnEmitNode(hint, node, emitCallback), void (enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags) } } previousOnEmitNode(hint, node, emitCallback) } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), 1 === hint && enclosingSuperContainerFlags ? substituteExpression(node) : node } function substituteExpression(node) { switch (node.kind) { case 184: return substitutePropertyAccessExpression(node); case 185: return substituteElementAccessExpression(node); case 186: return substituteCallExpression(node) }return node } function substitutePropertyAccessExpression(node) { return 97 === node.expression.kind ? createSuperAccessInAsyncMethod(ts.createLiteral(ts.idText(node.name)), node) : node } function substituteElementAccessExpression(node) { return 97 === node.expression.kind ? createSuperAccessInAsyncMethod(node.argumentExpression, node) : node } function substituteCallExpression(node) { var expression = node.expression; if (ts.isSuperProperty(expression)) { var argumentExpression = ts.isPropertyAccessExpression(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), void 0, [ts.createThis()].concat(node.arguments)) } return node } function isSuperContainer(node) { var kind = node.kind; return 234 === kind || 154 === kind || 153 === kind || 155 === kind || 156 === kind } function createSuperAccessInAsyncMethod(argumentExpression, location) { return 4096 & enclosingSuperContainerFlags ? ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createFileLevelUniqueName("_super"), void 0, [argumentExpression]), "value"), location) : ts.setTextRange(ts.createCall(ts.createFileLevelUniqueName("_super"), void 0, [argumentExpression]), location) } var enabledSubstitutions, enclosingFunctionParameterNames, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, resolver = context.getEmitResolver(), compilerOptions = context.getCompilerOptions(), languageVersion = ts.getEmitScriptTarget(compilerOptions), enclosingSuperContainerFlags = 0, previousOnEmitNode = context.onEmitNode, previousOnSubstituteNode = context.onSubstituteNode; return context.onEmitNode = onEmitNode, context.onSubstituteNode = onSubstituteNode, ts.chainBundle(transformSourceFile) } function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { context.requestEmitHelper(awaiterHelper); var generatorFunc = ts.createFunctionExpression(void 0, ts.createToken(39), void 0, void 0, [], void 0, body); return (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 786432, ts.createCall(ts.getHelperName("__awaiter"), void 0, [ts.createThis(), hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), generatorFunc]) } var ES2017SubstitutionFlags; !function (ES2017SubstitutionFlags) { ES2017SubstitutionFlags[ES2017SubstitutionFlags.AsyncMethodsWithSuper = 1] = "AsyncMethodsWithSuper" }(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})), ts.transformES2017 = transformES2017; var awaiterHelper = { name: "typescript:awaiter", scoped: !1, priority: 5, text: '\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };' }; ts.asyncSuperHelper = { name: "typescript:async-super", scoped: !0, text: ts.helperString(__makeTemplateObject(["\n const ", " = name => super[name];"], ["\n const ", " = name => super[name];"]), "_super") }, ts.advancedAsyncSuperHelper = { name: "typescript:advanced-async-super", scoped: !0, text: ts.helperString(__makeTemplateObject(["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"], ["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]), "_super") } }(ts || (ts = {})); var ts; !function (ts) { function transformESNext(context) { function transformSourceFile(node) { if (node.isDeclarationFile) return node; var visited = ts.visitEachChild(node, visitor, context); return ts.addEmitHelpers(visited, context.readEmitHelpers()), visited } function visitor(node) { return visitorWorker(node, !1) } function visitorNoDestructuringValue(node) { return visitorWorker(node, !0) } function visitorNoAsyncModifier(node) { if (120 !== node.kind) return node } function visitorWorker(node, noDestructuringValue) { if (0 === (8 & node.transformFlags)) return node; switch (node.kind) { case 196: return visitAwaitExpression(node); case 202: return visitYieldExpression(node); case 224: return visitReturnStatement(node); case 227: return visitLabeledStatement(node); case 183: return visitObjectLiteralExpression(node); case 199: return visitBinaryExpression(node, noDestructuringValue); case 231: return visitVariableDeclaration(node); case 221: return visitForOfStatement(node, void 0); case 219: return visitForStatement(node); case 195: return visitVoidExpression(node); case 154: return visitConstructorDeclaration(node); case 153: return visitMethodDeclaration(node); case 155: return visitGetAccessorDeclaration(node); case 156: return visitSetAccessorDeclaration(node); case 233: return visitFunctionDeclaration(node); case 191: return visitFunctionExpression(node); case 192: return visitArrowFunction(node); case 148: return visitParameter(node); case 215: return visitExpressionStatement(node); case 190: return visitParenthesizedExpression(node, noDestructuringValue); case 268: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context) } } function visitAwaitExpression(node) { return 2 & enclosingFunctionFlags && 1 & enclosingFunctionFlags ? ts.setOriginalNode(ts.setTextRange(ts.createYield(createAwaitHelper(context, ts.visitNode(node.expression, visitor, ts.isExpression))), node), node) : ts.visitEachChild(node, visitor, context) } function visitYieldExpression(node) { if (2 & enclosingFunctionFlags && 1 & enclosingFunctionFlags) { if (node.asteriskToken) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression); return ts.setOriginalNode(ts.setTextRange(ts.createYield(createAwaitHelper(context, ts.updateYield(node, node.asteriskToken, createAsyncDelegatorHelper(context, createAsyncValuesHelper(context, expression, expression), expression)))), node), node) } return ts.setOriginalNode(ts.setTextRange(ts.createYield(createDownlevelAwait(node.expression ? ts.visitNode(node.expression, visitor, ts.isExpression) : ts.createVoidZero())), node), node) } return ts.visitEachChild(node, visitor, context) } function visitReturnStatement(node) { return 2 & enclosingFunctionFlags && 1 & enclosingFunctionFlags ? ts.updateReturn(node, createDownlevelAwait(node.expression ? ts.visitNode(node.expression, visitor, ts.isExpression) : ts.createVoidZero())) : ts.visitEachChild(node, visitor, context) } function visitLabeledStatement(node) { if (2 & enclosingFunctionFlags) { var statement = ts.unwrapInnermostStatementOfLabel(node); return 221 === statement.kind && statement.awaitModifier ? visitForOfStatement(statement, node) : ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node) } return ts.visitEachChild(node, visitor, context) } function chunkObjectLiteralElements(elements) { for (var chunkObject, objects = [], _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { var e = elements_4[_i]; if (271 === e.kind) { chunkObject && (objects.push(ts.createObjectLiteral(chunkObject)), chunkObject = void 0); var target = e.expression; objects.push(ts.visitNode(target, visitor, ts.isExpression)) } else chunkObject = ts.append(chunkObject, 269 === e.kind ? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)) } return chunkObject && objects.push(ts.createObjectLiteral(chunkObject)), objects } function visitObjectLiteralExpression(node) { if (1048576 & node.transformFlags) { var objects = chunkObjectLiteralElements(node.properties); return objects.length && 183 !== objects[0].kind && objects.unshift(ts.createObjectLiteral()), createAssignHelper(context, objects) } return ts.visitEachChild(node, visitor, context) } function visitExpressionStatement(node) { return ts.visitEachChild(node, visitorNoDestructuringValue, context) } function visitParenthesizedExpression(node, noDestructuringValue) { return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context) } function visitCatchClause(node) { return node.variableDeclaration ? ts.visitEachChild(node, visitor, context) : ts.updateCatchClause(node, ts.createVariableDeclaration(ts.createTempVariable(void 0)), ts.visitNode(node.block, visitor, ts.isBlock)) } function visitBinaryExpression(node, noDestructuringValue) { return ts.isDestructuringAssignment(node) && 1048576 & node.left.transformFlags ? ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue) : 26 === node.operatorToken.kind ? ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)) : ts.visitEachChild(node, visitor, context) } function visitVariableDeclaration(node) { return ts.isBindingPattern(node.name) && 1048576 & node.name.transformFlags ? ts.flattenDestructuringBinding(node, visitor, context, 1) : ts.visitEachChild(node, visitor, context) } function visitForStatement(node) { return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)) } function visitVoidExpression(node) { return ts.visitEachChild(node, visitorNoDestructuringValue, context) } function visitForOfStatement(node, outermostLabeledStatement) { return 1048576 & node.initializer.transformFlags && (node = transformForOfStatementWithObjectRest(node)), node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement) : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement) } function transformForOfStatementWithObjectRest(node) { var initializerWithoutParens = ts.skipParentheses(node.initializer); if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) { var bodyLocation = void 0, statementsLocation = void 0, temp = ts.createTempVariable(void 0), statements = [ts.createForOfBindingStatement(initializerWithoutParens, temp)]; return ts.isBlock(node.statement) ? (ts.addRange(statements, node.statement.statements), bodyLocation = node.statement, statementsLocation = node.statement.statements) : node.statement && (ts.append(statements, node.statement), bodyLocation = node.statement, statementsLocation = node.statement), ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer)], 1), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), !0), bodyLocation)) } return node } function convertForOfStatementHead(node, boundValue) { var bodyLocation, statementsLocation, binding = ts.createForOfBindingStatement(node.initializer, boundValue), statements = [ts.visitNode(binding, visitor, ts.isStatement)], statement = ts.visitNode(node.statement, visitor, ts.isStatement); return ts.isBlock(statement) ? (ts.addRange(statements, statement.statements), bodyLocation = statement, statementsLocation = statement.statements) : statements.push(statement), ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), !0), bodyLocation), 432) } function createDownlevelAwait(expression) { return 1 & enclosingFunctionFlags ? ts.createYield(void 0, createAwaitHelper(context, expression)) : ts.createAwait(expression) } function transformForAwaitOfStatement(node, outermostLabeledStatement) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression), iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(void 0), result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(void 0), errorRecord = ts.createUniqueName("e"), catchVariable = ts.getGeneratedNameForNode(errorRecord), returnMethod = ts.createTempVariable(void 0), callValues = createAsyncValuesHelper(context, expression, node.expression), callNext = ts.createCall(ts.createPropertyAccess(iterator, "next"), void 0, []), getDone = ts.createPropertyAccess(result, "done"), getValue = ts.createPropertyAccess(result, "value"), callReturn = ts.createFunctionCall(returnMethod, iterator, []); hoistVariableDeclaration(errorRecord), hoistVariableDeclaration(returnMethod); var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ts.setTextRange(ts.createVariableDeclaration(iterator, void 0, callValues), node.expression), ts.createVariableDeclaration(result)]), node.expression), 2097152), ts.createComma(ts.createAssignment(result, createDownlevelAwait(callNext)), ts.createLogicalNot(getDone)), void 0, convertForOfStatementHead(node, getValue)), node), 256); return ts.createTry(ts.createBlock([ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement)]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ts.createPropertyAssignment("error", catchVariable)])))]), 1)), ts.createBlock([ts.createTry(ts.createBlock([ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(getDone)), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(createDownlevelAwait(callReturn))), 1)]), void 0, ts.setEmitFlags(ts.createBlock([ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1)]), 1))])) } function visitParameter(node) { return 1048576 & node.transformFlags ? ts.updateParameter(node, void 0, void 0, node.dotDotDotToken, ts.getGeneratedNameForNode(node), void 0, void 0, ts.visitNode(node.initializer, visitor, ts.isExpression)) : ts.visitEachChild(node, visitor, context) } function visitConstructorDeclaration(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = 0; var updated = ts.updateConstructor(node, void 0, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); return enclosingFunctionFlags = savedEnclosingFunctionFlags, updated } function visitGetAccessorDeclaration(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = 0; var updated = ts.updateGetAccessor(node, void 0, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), void 0, transformFunctionBody(node)); return enclosingFunctionFlags = savedEnclosingFunctionFlags, updated } function visitSetAccessorDeclaration(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = 0; var updated = ts.updateSetAccessor(node, void 0, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); return enclosingFunctionFlags = savedEnclosingFunctionFlags, updated } function visitMethodDeclaration(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = ts.getFunctionFlags(node); var updated = ts.updateMethod(node, void 0, 1 & enclosingFunctionFlags ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) : node.modifiers, 2 & enclosingFunctionFlags ? void 0 : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(void 0, visitor, ts.isToken), void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, 2 & enclosingFunctionFlags && 1 & enclosingFunctionFlags ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)); return enclosingFunctionFlags = savedEnclosingFunctionFlags, updated } function visitFunctionDeclaration(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = ts.getFunctionFlags(node); var updated = ts.updateFunctionDeclaration(node, void 0, 1 & enclosingFunctionFlags ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) : node.modifiers, 2 & enclosingFunctionFlags ? void 0 : node.asteriskToken, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, 2 & enclosingFunctionFlags && 1 & enclosingFunctionFlags ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)); return enclosingFunctionFlags = savedEnclosingFunctionFlags, updated } function visitArrowFunction(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = ts.getFunctionFlags(node); var updated = ts.updateArrowFunction(node, node.modifiers, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, node.equalsGreaterThanToken, transformFunctionBody(node)); return enclosingFunctionFlags = savedEnclosingFunctionFlags, updated } function visitFunctionExpression(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = ts.getFunctionFlags(node); var updated = ts.updateFunctionExpression(node, 1 & enclosingFunctionFlags ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) : node.modifiers, 2 & enclosingFunctionFlags ? void 0 : node.asteriskToken, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, 2 & enclosingFunctionFlags && 1 & enclosingFunctionFlags ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)); return enclosingFunctionFlags = savedEnclosingFunctionFlags, updated } function transformAsyncGeneratorFunctionBody(node) { resumeLexicalEnvironment(); var statements = [], statementOffset = ts.addPrologue(statements, node.body.statements, !1, visitor); appendObjectRestAssignmentsIfNeeded(statements, node), statements.push(ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression(void 0, ts.createToken(39), node.name && ts.getGeneratedNameForNode(node.name), void 0, [], void 0, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))))), ts.prependStatements(statements, endLexicalEnvironment()); var block = ts.updateBlock(node.body, statements); return languageVersion >= 2 && (4096 & resolver.getNodeCheckFlags(node) ? (enableSubstitutionForAsyncMethodsWithSuper(), ts.addEmitHelper(block, ts.advancedAsyncSuperHelper)) : 2048 & resolver.getNodeCheckFlags(node) && (enableSubstitutionForAsyncMethodsWithSuper(), ts.addEmitHelper(block, ts.asyncSuperHelper))), block } function transformFunctionBody(node) { resumeLexicalEnvironment(); var statementOffset = 0, statements = [], body = ts.visitNode(node.body, visitor, ts.isConciseBody); ts.isBlock(body) && (statementOffset = ts.addPrologue(statements, body.statements, !1, visitor)), ts.addRange(statements, appendObjectRestAssignmentsIfNeeded(void 0, node)); var leadingStatements = endLexicalEnvironment(); if (statementOffset > 0 || ts.some(statements) || ts.some(leadingStatements)) { var block = ts.convertToFunctionBody(body, !0); return ts.prependStatements(statements, leadingStatements), ts.addRange(statements, block.statements.slice(statementOffset)), ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(statements), block.statements)) } return body } function appendObjectRestAssignmentsIfNeeded(statements, node) { for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; if (1048576 & parameter.transformFlags) { var temp = ts.getGeneratedNameForNode(parameter), declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, !1, !0); if (ts.some(declarations)) { var statement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList(declarations)); ts.setEmitFlags(statement, 1048576), statements = ts.append(statements, statement) } } } return statements } function enableSubstitutionForAsyncMethodsWithSuper() { 0 === (1 & enabledSubstitutions) && (enabledSubstitutions |= 1, context.enableSubstitution(186), context.enableSubstitution(184), context.enableSubstitution(185), context.enableEmitNotification(234), context.enableEmitNotification(153), context.enableEmitNotification(155), context.enableEmitNotification(156), context.enableEmitNotification(154)) } function onEmitNode(hint, node, emitCallback) { if (1 & enabledSubstitutions && isSuperContainer(node)) { var superContainerFlags = 6144 & resolver.getNodeCheckFlags(node); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; return enclosingSuperContainerFlags = superContainerFlags, previousOnEmitNode(hint, node, emitCallback), void (enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags) } } previousOnEmitNode(hint, node, emitCallback) } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), 1 === hint && enclosingSuperContainerFlags ? substituteExpression(node) : node } function substituteExpression(node) { switch (node.kind) { case 184: return substitutePropertyAccessExpression(node); case 185: return substituteElementAccessExpression(node); case 186: return substituteCallExpression(node) }return node } function substitutePropertyAccessExpression(node) { return 97 === node.expression.kind ? createSuperAccessInAsyncMethod(ts.createLiteral(ts.idText(node.name)), node) : node } function substituteElementAccessExpression(node) { return 97 === node.expression.kind ? createSuperAccessInAsyncMethod(node.argumentExpression, node) : node } function substituteCallExpression(node) { var expression = node.expression; if (ts.isSuperProperty(expression)) { var argumentExpression = ts.isPropertyAccessExpression(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), void 0, [ts.createThis()].concat(node.arguments)) } return node } function isSuperContainer(node) { var kind = node.kind; return 234 === kind || 154 === kind || 153 === kind || 155 === kind || 156 === kind } function createSuperAccessInAsyncMethod(argumentExpression, location) { return 4096 & enclosingSuperContainerFlags ? ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), void 0, [argumentExpression]), "value"), location) : ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), void 0, [argumentExpression]), location) } var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, resolver = context.getEmitResolver(), compilerOptions = context.getCompilerOptions(), languageVersion = ts.getEmitScriptTarget(compilerOptions), previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var enabledSubstitutions, enclosingFunctionFlags, enclosingSuperContainerFlags = 0; return ts.chainBundle(transformSourceFile) } function createAssignHelper(context, attributesSegments) { return context.getCompilerOptions().target >= 2 ? ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), void 0, attributesSegments) : (context.requestEmitHelper(assignHelper), ts.createCall(ts.getHelperName("__assign"), void 0, attributesSegments)) } function createAwaitHelper(context, expression) { return context.requestEmitHelper(awaitHelper), ts.createCall(ts.getHelperName("__await"), void 0, [expression]) } function createAsyncGeneratorHelper(context, generatorFunc) { return context.requestEmitHelper(awaitHelper), context.requestEmitHelper(asyncGeneratorHelper), (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144, ts.createCall(ts.getHelperName("__asyncGenerator"), void 0, [ts.createThis(), ts.createIdentifier("arguments"), generatorFunc]) } function createAsyncDelegatorHelper(context, expression, location) { return context.requestEmitHelper(awaitHelper), context.requestEmitHelper(asyncDelegator), ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"), void 0, [expression]), location) } function createAsyncValuesHelper(context, expression, location) { return context.requestEmitHelper(asyncValues), ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"), void 0, [expression]), location) } var ESNextSubstitutionFlags; !function (ESNextSubstitutionFlags) { ESNextSubstitutionFlags[ESNextSubstitutionFlags.AsyncMethodsWithSuper = 1] = "AsyncMethodsWithSuper" }(ESNextSubstitutionFlags || (ESNextSubstitutionFlags = {})), ts.transformESNext = transformESNext; var assignHelper = { name: "typescript:assign", scoped: !1, priority: 1, text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; ts.createAssignHelper = createAssignHelper; var awaitHelper = { name: "typescript:await", scoped: !1, text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }" }, asyncGeneratorHelper = { name: "typescript:asyncGenerator", scoped: !1, text: '\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume("next", value); }\n function reject(value) { resume("throw", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };' }, asyncDelegator = { name: "typescript:asyncDelegator", scoped: !1, text: '\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }\n };' }, asyncValues = { name: "typescript:asyncValues", scoped: !1, text: '\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };' } }(ts || (ts = {})); var ts; !function (ts) { function transformJsx(context) { function transformSourceFile(node) { if (node.isDeclarationFile) return node; currentSourceFile = node; var visited = ts.visitEachChild(node, visitor, context); return ts.addEmitHelpers(visited, context.readEmitHelpers()), visited } function visitor(node) { return 4 & node.transformFlags ? visitorWorker(node) : node } function visitorWorker(node) { switch (node.kind) { case 254: return visitJsxElement(node, !1); case 255: return visitJsxSelfClosingElement(node, !1); case 258: return visitJsxFragment(node, !1); case 264: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context) } } function transformJsxChildToExpression(node) { switch (node.kind) { case 10: return visitJsxText(node); case 264: return visitJsxExpression(node); case 254: return visitJsxElement(node, !0); case 255: return visitJsxSelfClosingElement(node, !0); case 258: return visitJsxFragment(node, !0); default: return ts.Debug.failBadSyntaxKind(node) } } function visitJsxElement(node, isChild) { return visitJsxOpeningLikeElement(node.openingElement, node.children, isChild, node) } function visitJsxSelfClosingElement(node, isChild) { return visitJsxOpeningLikeElement(node, void 0, isChild, node) } function visitJsxFragment(node, isChild) { return visitJsxOpeningFragment(node.openingFragment, node.children, isChild, node) } function visitJsxOpeningLikeElement(node, children, isChild, location) { var objectProperties, tagName = getTagName(node), attrs = node.attributes.properties; if (0 === attrs.length) objectProperties = ts.createNull(); else { var segments = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread ? ts.map(attrs, transformJsxSpreadAttributeToExpression) : ts.createObjectLiteral(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)) })); ts.isJsxSpreadAttribute(attrs[0]) && segments.unshift(ts.createObjectLiteral()), objectProperties = ts.singleOrUndefined(segments), objectProperties || (objectProperties = ts.createAssignHelper(context, segments)) } var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, tagName, objectProperties, ts.mapDefined(children, transformJsxChildToExpression), node, location); return isChild && ts.startOnNewLine(element), element } function visitJsxOpeningFragment(node, children, isChild, location) { var element = ts.createExpressionForJsxFragment(context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, ts.mapDefined(children, transformJsxChildToExpression), node, location); return isChild && ts.startOnNewLine(element), element } function transformJsxSpreadAttributeToExpression(node) { return ts.visitNode(node.expression, visitor, ts.isExpression) } function transformJsxAttributeToObjectLiteralElement(node) { var name = getAttributeName(node), expression = transformJsxAttributeInitializer(node.initializer); return ts.createPropertyAssignment(name, expression) } function transformJsxAttributeInitializer(node) { if (void 0 === node) return ts.createTrue(); if (9 === node.kind) { var literal = ts.createLiteral(tryDecodeEntities(node.text) || node.text); return literal.singleQuote = void 0 !== node.singleQuote ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile), ts.setTextRange(literal, node) } return 264 === node.kind ? void 0 === node.expression ? ts.createTrue() : visitJsxExpression(node) : ts.Debug.failBadSyntaxKind(node) } function visitJsxText(node) { var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, !0)); return void 0 === fixed ? void 0 : ts.createLiteral(fixed) } function fixupWhitespaceAndDecodeEntities(text) { for (var acc, firstNonWhitespace = 0, lastNonWhitespace = -1, i = 0; i < text.length; i++) { var c = text.charCodeAt(i); ts.isLineBreak(c) ? (firstNonWhitespace !== -1 && lastNonWhitespace !== -1 && (acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1))), firstNonWhitespace = -1) : ts.isWhiteSpaceSingleLine(c) || (lastNonWhitespace = i, firstNonWhitespace === -1 && (firstNonWhitespace = i)) } return firstNonWhitespace !== -1 ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) : acc } function addLineOfJsxText(acc, trimmedLine) { var decoded = decodeEntities(trimmedLine); return void 0 === acc ? decoded : acc + " " + decoded } function decodeEntities(text) { return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { if (decimal) return String.fromCharCode(parseInt(decimal, 10)); if (hex) return String.fromCharCode(parseInt(hex, 16)); var ch = entities.get(word); return ch ? String.fromCharCode(ch) : match }) } function tryDecodeEntities(text) { var decoded = decodeEntities(text); return decoded === text ? void 0 : decoded } function getTagName(node) { if (254 === node.kind) return getTagName(node.openingElement); var name = node.tagName; return ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.escapedText) ? ts.createLiteral(ts.idText(name)) : ts.createExpressionFromEntityName(name) } function getAttributeName(node) { var name = node.name, text = ts.idText(name); return /^[A-Za-z_]\w*$/.test(text) ? name : ts.createLiteral(text) } function visitJsxExpression(node) { return ts.visitNode(node.expression, visitor, ts.isExpression) } var currentSourceFile, compilerOptions = context.getCompilerOptions(); return ts.chainBundle(transformSourceFile) } ts.transformJsx = transformJsx; var entities = ts.createMapFromTemplate({ quot: 34, amp: 38, apos: 39, lt: 60, gt: 62, nbsp: 160, iexcl: 161, cent: 162, pound: 163, curren: 164, yen: 165, brvbar: 166, sect: 167, uml: 168, copy: 169, ordf: 170, laquo: 171, not: 172, shy: 173, reg: 174, macr: 175, deg: 176, plusmn: 177, sup2: 178, sup3: 179, acute: 180, micro: 181, para: 182, middot: 183, cedil: 184, sup1: 185, ordm: 186, raquo: 187, frac14: 188, frac12: 189, frac34: 190, iquest: 191, Agrave: 192, Aacute: 193, Acirc: 194, Atilde: 195, Auml: 196, Aring: 197, AElig: 198, Ccedil: 199, Egrave: 200, Eacute: 201, Ecirc: 202, Euml: 203, Igrave: 204, Iacute: 205, Icirc: 206, Iuml: 207, ETH: 208, Ntilde: 209, Ograve: 210, Oacute: 211, Ocirc: 212, Otilde: 213, Ouml: 214, times: 215, Oslash: 216, Ugrave: 217, Uacute: 218, Ucirc: 219, Uuml: 220, Yacute: 221, THORN: 222, szlig: 223, agrave: 224, aacute: 225, acirc: 226, atilde: 227, auml: 228, aring: 229, aelig: 230, ccedil: 231, egrave: 232, eacute: 233, ecirc: 234, euml: 235, igrave: 236, iacute: 237, icirc: 238, iuml: 239, eth: 240, ntilde: 241, ograve: 242, oacute: 243, ocirc: 244, otilde: 245, ouml: 246, divide: 247, oslash: 248, ugrave: 249, uacute: 250, ucirc: 251, uuml: 252, yacute: 253, thorn: 254, yuml: 255, OElig: 338, oelig: 339, Scaron: 352, scaron: 353, Yuml: 376, fnof: 402, circ: 710, tilde: 732, Alpha: 913, Beta: 914, Gamma: 915, Delta: 916, Epsilon: 917, Zeta: 918, Eta: 919, Theta: 920, Iota: 921, Kappa: 922, Lambda: 923, Mu: 924, Nu: 925, Xi: 926, Omicron: 927, Pi: 928, Rho: 929, Sigma: 931, Tau: 932, Upsilon: 933, Phi: 934, Chi: 935, Psi: 936, Omega: 937, alpha: 945, beta: 946, gamma: 947, delta: 948, epsilon: 949, zeta: 950, eta: 951, theta: 952, iota: 953, kappa: 954, lambda: 955, mu: 956, nu: 957, xi: 958, omicron: 959, pi: 960, rho: 961, sigmaf: 962, sigma: 963, tau: 964, upsilon: 965, phi: 966, chi: 967, psi: 968, omega: 969, thetasym: 977, upsih: 978, piv: 982, ensp: 8194, emsp: 8195, thinsp: 8201, zwnj: 8204, zwj: 8205, lrm: 8206, rlm: 8207, ndash: 8211, mdash: 8212, lsquo: 8216, rsquo: 8217, sbquo: 8218, ldquo: 8220, rdquo: 8221, bdquo: 8222, dagger: 8224, Dagger: 8225, bull: 8226, hellip: 8230, permil: 8240, prime: 8242, Prime: 8243, lsaquo: 8249, rsaquo: 8250, oline: 8254, frasl: 8260, euro: 8364, image: 8465, weierp: 8472, real: 8476, trade: 8482, alefsym: 8501, larr: 8592, uarr: 8593, rarr: 8594, darr: 8595, harr: 8596, crarr: 8629, lArr: 8656, uArr: 8657, rArr: 8658, dArr: 8659, hArr: 8660, forall: 8704, part: 8706, exist: 8707, empty: 8709, nabla: 8711, isin: 8712, notin: 8713, ni: 8715, prod: 8719, sum: 8721, minus: 8722, lowast: 8727, radic: 8730, prop: 8733, infin: 8734, ang: 8736, and: 8743, or: 8744, cap: 8745, cup: 8746, int: 8747, there4: 8756, sim: 8764, cong: 8773, asymp: 8776, ne: 8800, equiv: 8801, le: 8804, ge: 8805, sub: 8834, sup: 8835, nsub: 8836, sube: 8838, supe: 8839, oplus: 8853, otimes: 8855, perp: 8869, sdot: 8901, lceil: 8968, rceil: 8969, lfloor: 8970, rfloor: 8971, lang: 9001, rang: 9002, loz: 9674, spades: 9824, clubs: 9827, hearts: 9829, diams: 9830 }) }(ts || (ts = {})); var ts; !function (ts) { function transformES2016(context) { function transformSourceFile(node) { return node.isDeclarationFile ? node : ts.visitEachChild(node, visitor, context) } function visitor(node) { if (0 === (32 & node.transformFlags)) return node; switch (node.kind) { case 199: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context) } } function visitBinaryExpression(node) { switch (node.operatorToken.kind) { case 62: return visitExponentiationAssignmentExpression(node); case 40: return visitExponentiationExpression(node); default: return ts.visitEachChild(node, visitor, context) } } function visitExponentiationAssignmentExpression(node) { var target, value, left = ts.visitNode(node.left, visitor, ts.isExpression), right = ts.visitNode(node.right, visitor, ts.isExpression); if (ts.isElementAccessExpression(left)) { var expressionTemp = ts.createTempVariable(hoistVariableDeclaration), argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); target = ts.setTextRange(ts.createElementAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), ts.setTextRange(ts.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left), value = ts.setTextRange(ts.createElementAccess(expressionTemp, argumentExpressionTemp), left) } else if (ts.isPropertyAccessExpression(left)) { var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); target = ts.setTextRange(ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), left.name), left), value = ts.setTextRange(ts.createPropertyAccess(expressionTemp, left.name), left) } else target = left, value = left; return ts.setTextRange(ts.createAssignment(target, ts.createMathPow(value, right, node)), node) } function visitExponentiationExpression(node) { var left = ts.visitNode(node.left, visitor, ts.isExpression), right = ts.visitNode(node.right, visitor, ts.isExpression); return ts.createMathPow(left, right, node) } var hoistVariableDeclaration = context.hoistVariableDeclaration; return ts.chainBundle(transformSourceFile) } ts.transformES2016 = transformES2016 }(ts || (ts = {})); var ts; !function (ts) { function transformES2015(context) { function recordTaggedTemplateString(temp) { taggedTemplateStringDeclarations = ts.append(taggedTemplateStringDeclarations, ts.createVariableDeclaration(temp)) } function transformSourceFile(node) { if (node.isDeclarationFile) return node; currentSourceFile = node, currentText = node.text; var visited = visitSourceFile(node); return ts.addEmitHelpers(visited, context.readEmitHelpers()), currentSourceFile = void 0, currentText = void 0, taggedTemplateStringDeclarations = void 0, hierarchyFacts = 0, visited } function enterSubtree(excludeFacts, includeFacts) { var ancestorFacts = hierarchyFacts; return hierarchyFacts = 16383 & (hierarchyFacts & ~excludeFacts | includeFacts), ancestorFacts } function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return 4096 & hierarchyFacts && 224 === node.kind && !node.expression } function shouldVisitNode(node) { return 0 !== (128 & node.transformFlags) || void 0 !== convertedLoopState || 4096 & hierarchyFacts && (ts.isStatement(node) || 212 === node.kind) || ts.isIterationStatement(node, !1) && shouldConvertIterationStatementBody(node) || 0 !== (33554432 & ts.getEmitFlags(node)) } function visitor(node) { return shouldVisitNode(node) ? visitJavaScript(node) : node } function functionBodyVisitor(node) { return shouldVisitNode(node) ? visitBlock(node, !0) : node } function callExpressionVisitor(node) { return 97 === node.kind ? visitSuperKeyword(!0) : visitor(node) } function visitJavaScript(node) { switch (node.kind) { case 115: return; case 234: return visitClassDeclaration(node); case 204: return visitClassExpression(node); case 148: return visitParameter(node); case 233: return visitFunctionDeclaration(node); case 192: return visitArrowFunction(node); case 191: return visitFunctionExpression(node); case 231: return visitVariableDeclaration(node); case 71: return visitIdentifier(node); case 232: return visitVariableDeclarationList(node); case 226: return visitSwitchStatement(node); case 240: return visitCaseBlock(node); case 212: return visitBlock(node, !1); case 223: case 222: return visitBreakOrContinueStatement(node); case 227: return visitLabeledStatement(node); case 217: case 218: return visitDoOrWhileStatement(node, void 0); case 219: return visitForStatement(node, void 0); case 220: return visitForInStatement(node, void 0); case 221: return visitForOfStatement(node, void 0); case 215: return visitExpressionStatement(node); case 183: return visitObjectLiteralExpression(node); case 268: return visitCatchClause(node); case 270: return visitShorthandPropertyAssignment(node); case 146: return visitComputedPropertyName(node); case 182: return visitArrayLiteralExpression(node); case 186: return visitCallExpression(node); case 187: return visitNewExpression(node); case 190: return visitParenthesizedExpression(node, !0); case 199: return visitBinaryExpression(node, !0); case 13: case 14: case 15: case 16: return visitTemplateLiteral(node); case 9: return visitStringLiteral(node); case 8: return visitNumericLiteral(node); case 188: return visitTaggedTemplateExpression(node); case 201: return visitTemplateExpression(node); case 202: return visitYieldExpression(node); case 203: return visitSpreadElement(node); case 97: return visitSuperKeyword(!1); case 99: return visitThisKeyword(node); case 209: return visitMetaProperty(node); case 153: return visitMethodDeclaration(node); case 155: case 156: return visitAccessorDeclaration(node); case 213: return visitVariableStatement(node); case 224: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context) } } function visitSourceFile(node) { var ancestorFacts = enterSubtree(3968, 64), statements = []; startLexicalEnvironment(); var statementOffset = ts.addStandardPrologue(statements, node.statements, !1); return addCaptureThisForNodeIfNeeded(statements, node), statementOffset = ts.addCustomPrologue(statements, node.statements, statementOffset, visitor), ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)), taggedTemplateStringDeclarations && statements.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList(taggedTemplateStringDeclarations))), ts.prependStatements(statements, endLexicalEnvironment()), exitSubtree(ancestorFacts, 0, 0), ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)) } function visitSwitchStatement(node) { if (void 0 !== convertedLoopState) { var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps |= 2; var result = ts.visitEachChild(node, visitor, context); return convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps, result } return ts.visitEachChild(node, visitor, context) } function visitCaseBlock(node) { var ancestorFacts = enterSubtree(4032, 0), updated = ts.visitEachChild(node, visitor, context); return exitSubtree(ancestorFacts, 0, 0), updated } function returnCapturedThis(node) { return ts.setOriginalNode(ts.createReturn(ts.createFileLevelUniqueName("_this")), node) } function visitReturnStatement(node) { return convertedLoopState ? (convertedLoopState.nonLocalJumps |= 8, isReturnVoidStatementInConstructorWithCapturedSuper(node) && (node = returnCapturedThis(node)), ts.createReturn(ts.createObjectLiteral([ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression ? ts.visitNode(node.expression, visitor, ts.isExpression) : ts.createVoidZero())]))) : isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : ts.visitEachChild(node, visitor, context) } function visitThisKeyword(node) { return convertedLoopState ? 2 & hierarchyFacts ? (convertedLoopState.containsLexicalThis = !0, node) : convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")) : node } function visitIdentifier(node) { return convertedLoopState ? ts.isGeneratedIdentifier(node) ? node : "arguments" === node.escapedText && resolver.isArgumentsLocalBinding(node) ? convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")) : node : node } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { var jump = 223 === node.kind ? 2 : 4, canUseBreakOrContinue = node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label)) || !node.label && convertedLoopState.allowedNonLabeledJumps & jump; if (!canUseBreakOrContinue) { var labelMarker = void 0; node.label ? 223 === node.kind ? (labelMarker = "break-" + node.label.escapedText, setLabeledJump(convertedLoopState, !0, ts.idText(node.label), labelMarker)) : (labelMarker = "continue-" + node.label.escapedText, setLabeledJump(convertedLoopState, !1, ts.idText(node.label), labelMarker)) : 223 === node.kind ? (convertedLoopState.nonLocalJumps |= 2, labelMarker = "break") : (convertedLoopState.nonLocalJumps |= 4, labelMarker = "continue"); var returnExpression = ts.createLiteral(labelMarker); if (convertedLoopState.loopOutParameters.length) { for (var outParams = convertedLoopState.loopOutParameters, expr = void 0, i = 0; i < outParams.length; i++) { var copyExpr = copyOutParameter(outParams[i], 1); expr = 0 === i ? copyExpr : ts.createBinary(expr, 26, copyExpr) } returnExpression = ts.createBinary(expr, 26, returnExpression) } return ts.createReturn(returnExpression) } } return ts.visitEachChild(node, visitor, context) } function visitClassDeclaration(node) { var variable = ts.createVariableDeclaration(ts.getLocalName(node, !0), void 0, transformClassLikeDeclarationToExpression(node)); ts.setOriginalNode(variable, node); var statements = [], statement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([variable])); if (ts.setOriginalNode(statement, node), ts.setTextRange(statement, node), ts.startOnNewLine(statement), statements.push(statement), ts.hasModifier(node, 1)) { var exportStatement = ts.hasModifier(node, 512) ? ts.createExportDefault(ts.getLocalName(node)) : ts.createExternalModuleExport(ts.getLocalName(node)); ts.setOriginalNode(exportStatement, statement), statements.push(exportStatement) } var emitFlags = ts.getEmitFlags(node); return 0 === (4194304 & emitFlags) && (statements.push(ts.createEndOfDeclarationMarker(node)), ts.setEmitFlags(statement, 4194304 | emitFlags)), ts.singleOrMany(statements) } function visitClassExpression(node) { return transformClassLikeDeclarationToExpression(node) } function transformClassLikeDeclarationToExpression(node) { node.name && enableSubstitutionsForBlockScopedBindings(); var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node), classFunction = ts.createFunctionExpression(void 0, void 0, void 0, void 0, extendsClauseElement ? [ts.createParameter(void 0, void 0, void 0, ts.createFileLevelUniqueName("_super"))] : [], void 0, transformClassBody(node, extendsClauseElement)); ts.setEmitFlags(classFunction, 65536 & ts.getEmitFlags(node) | 524288); var inner = ts.createPartiallyEmittedExpression(classFunction); inner.end = node.end, ts.setEmitFlags(inner, 1536); var outer = ts.createPartiallyEmittedExpression(inner); outer.end = ts.skipTrivia(currentText, node.pos), ts.setEmitFlags(outer, 1536); var result = ts.createParen(ts.createCall(outer, void 0, extendsClauseElement ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] : [])); return ts.addSyntheticLeadingComment(result, 3, "* @class "), result } function transformClassBody(node, extendsClauseElement) { var statements = []; startLexicalEnvironment(), addExtendsHelperIfNeeded(statements, node, extendsClauseElement), addConstructor(statements, node, extendsClauseElement), addClassMembers(statements, node); var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 18), localName = ts.getInternalName(node), outer = ts.createPartiallyEmittedExpression(localName); outer.end = closingBraceLocation.end, ts.setEmitFlags(outer, 1536); var statement = ts.createReturn(outer); statement.pos = closingBraceLocation.pos, ts.setEmitFlags(statement, 1920), statements.push(statement), ts.prependStatements(statements, endLexicalEnvironment()); var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), !0); return ts.setEmitFlags(block, 1536), block } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { extendsClauseElement && statements.push(ts.setTextRange(ts.createStatement(createExtendsHelper(context, ts.getInternalName(node))), extendsClauseElement)) } function addConstructor(statements, node, extendsClauseElement) { var savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; var ancestorFacts = enterSubtree(16278, 73), constructor = ts.getFirstConstructorWithBody(node), hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, void 0 !== extendsClauseElement), constructorFunction = ts.createFunctionDeclaration(void 0, void 0, void 0, ts.getInternalName(node), void 0, transformConstructorParameters(constructor, hasSynthesizedSuper), void 0, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper)); ts.setTextRange(constructorFunction, constructor || node), extendsClauseElement && ts.setEmitFlags(constructorFunction, 8), statements.push(constructorFunction), exitSubtree(ancestorFacts, 49152, 0), convertedLoopState = savedConvertedLoopState } function transformConstructorParameters(constructor, hasSynthesizedSuper) { return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) || [] } function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { var statements = []; resumeLexicalEnvironment(); var statementOffset = -1; hasSynthesizedSuper ? statementOffset = 0 : constructor && (statementOffset = ts.addStandardPrologue(statements, constructor.body.statements, !1)), constructor && (addDefaultValueAssignmentsIfNeeded(statements, constructor), addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper), hasSynthesizedSuper || (statementOffset = ts.addCustomPrologue(statements, constructor.body.statements, statementOffset, visitor)), ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!")); var isDerivedClass = extendsClauseElement && 95 !== ts.skipOuterExpressions(extendsClauseElement.expression).kind, superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); 1 !== superCaptureStatus && 2 !== superCaptureStatus || statementOffset++ , constructor && (1 === superCaptureStatus && (hierarchyFacts |= 4096), ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset))), !isDerivedClass || 2 === superCaptureStatus || constructor && isSufficientlyCoveredByReturnStatements(constructor.body) || statements.push(ts.createReturn(ts.createFileLevelUniqueName("_this"))), ts.prependStatements(statements, endLexicalEnvironment()), constructor && prependCaptureNewTargetIfNeeded(statements, constructor, !1); var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), !0); return ts.setTextRange(block, constructor ? constructor.body : node), constructor || ts.setEmitFlags(block, 1536), block } function isSufficientlyCoveredByReturnStatements(statement) { if (224 === statement.kind) return !0; if (216 === statement.kind) { var ifStatement = statement; if (ifStatement.elseStatement) return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement) } else if (212 === statement.kind) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) return !0 } return !1 } function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { if (!isDerivedClass) return ctor && addCaptureThisForNodeIfNeeded(statements, ctor), 0; if (!ctor) return statements.push(ts.createReturn(createDefaultSuperCallOrThis())), 2; if (hasSynthesizedSuper) return captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()), enableSubstitutionsForCapturedThis(), 1; var firstStatement, superCallExpression, ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length && (firstStatement = ctorStatements[statementOffset], 215 === firstStatement.kind && ts.isSuperCall(firstStatement.expression) && (superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression))), superCallExpression && statementOffset === ctorStatements.length - 1 && !(49152 & ctor.transformFlags)) { var returnStatement = ts.createReturn(superCallExpression); return 199 === superCallExpression.kind && 186 === superCallExpression.left.kind || ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."), ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))), statements.push(returnStatement), 2 } return captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement), superCallExpression ? 1 : 0 } function createActualThis() { return ts.setEmitFlags(ts.createThis(), 4) } function createDefaultSuperCallOrThis() { return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createFileLevelUniqueName("_super"), ts.createNull()), ts.createFunctionApply(ts.createFileLevelUniqueName("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()) } function visitParameter(node) { return node.dotDotDotToken ? void 0 : ts.isBindingPattern(node.name) ? ts.setOriginalNode(ts.setTextRange(ts.createParameter(void 0, void 0, void 0, ts.getGeneratedNameForNode(node), void 0, void 0, void 0), node), node) : node.initializer ? ts.setOriginalNode(ts.setTextRange(ts.createParameter(void 0, void 0, void 0, node.name, void 0, void 0, void 0), node), node) : node } function shouldAddDefaultValueAssignments(node) { return 0 !== (131072 & node.transformFlags) } function addDefaultValueAssignmentsIfNeeded(statements, node) { if (shouldAddDefaultValueAssignments(node)) for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i], name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; dotDotDotToken || (ts.isBindingPattern(name) ? addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) : initializer && addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer)) } } function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) { var temp = ts.getGeneratedNameForNode(parameter); name.elements.length > 0 ? statements.push(ts.setEmitFlags(ts.createVariableStatement(void 0, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 1048576)) : initializer && statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 1048576)) } function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { initializer = ts.visitNode(initializer, visitor, ts.isExpression); var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.setTextRange(ts.createBlock([ts.createStatement(ts.setEmitFlags(ts.setTextRange(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer) | 1536)), parameter), 1536))]), parameter), 1953)); ts.startOnNewLine(statement), ts.setTextRange(statement, parameter), ts.setEmitFlags(statement, 1050528), statements.push(statement) } function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { return node && node.dotDotDotToken && 71 === node.name.kind && !inConstructorWithSynthesizedSuper } function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { var parameter = ts.lastOrUndefined(node.parameters); if (shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { var declarationName = ts.getMutableClone(parameter.name); ts.setEmitFlags(declarationName, 48); var expressionName = ts.getSynthesizedClone(parameter.name), restIndex = node.parameters.length - 1, temp = ts.createLoopVariable(); statements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(declarationName, void 0, ts.createArrayLiteral([]))])), parameter), 1048576)); var forStatement = ts.createFor(ts.setTextRange(ts.createVariableDeclarationList([ts.createVariableDeclaration(temp, void 0, ts.createLiteral(restIndex))]), parameter), ts.setTextRange(ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length")), parameter), ts.setTextRange(ts.createPostfixIncrement(temp), parameter), ts.createBlock([ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, 0 === restIndex ? temp : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp))), parameter))])); ts.setEmitFlags(forStatement, 1048576), ts.startOnNewLine(forStatement), statements.push(forStatement) } } function addCaptureThisForNodeIfNeeded(statements, node) { 32768 & node.transformFlags && 192 !== node.kind && captureThisForNode(statements, node, ts.createThis()) } function captureThisForNode(statements, node, initializer, originalStatement) { enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.createFileLevelUniqueName("_this"), void 0, initializer)])); ts.setEmitFlags(captureThisStatement, 1050112), ts.setTextRange(captureThisStatement, originalStatement), ts.setSourceMapRange(captureThisStatement, node), statements.push(captureThisStatement) } function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { if (16384 & hierarchyFacts) { var newTarget = void 0; switch (node.kind) { case 192: return statements; case 153: case 155: case 156: newTarget = ts.createVoidZero(); break; case 154: newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); break; case 233: case 191: newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 93, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); break; default: return ts.Debug.failBadSyntaxKind(node) }var captureNewTargetStatement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.createFileLevelUniqueName("_newTarget"), void 0, newTarget)])); if (copyOnWrite) return [captureNewTargetStatement].concat(statements); statements.unshift(captureNewTargetStatement) } return statements } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { case 211: statements.push(transformSemicolonClassElementToStatement(member)); break; case 153: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case 155: case 156: var accessors = ts.getAllAccessorDeclarations(node.members, member); member === accessors.firstAccessor && statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); break; case 154: break; default: ts.Debug.failBadSyntaxKind(node) } } } function transformSemicolonClassElementToStatement(member) { return ts.setTextRange(ts.createEmptyStatement(), member) } function transformClassMethodDeclarationToStatement(receiver, member, container) { var ancestorFacts = enterSubtree(0, 0), commentRange = ts.getCommentRange(member), sourceMapRange = ts.getSourceMapRange(member), memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), memberFunction = transformFunctionLikeToExpression(member, member, void 0, container); ts.setEmitFlags(memberFunction, 1536), ts.setSourceMapRange(memberFunction, sourceMapRange); var statement = ts.setTextRange(ts.createStatement(ts.createAssignment(memberName, memberFunction)), member); return ts.setOriginalNode(statement, member), ts.setCommentRange(statement, commentRange), ts.setEmitFlags(statement, 48), exitSubtree(ancestorFacts, 49152, 49152 & hierarchyFacts ? 16384 : 0), statement } function transformAccessorsToStatement(receiver, accessors, container) { var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, !1)); return ts.setEmitFlags(statement, 1536), ts.setSourceMapRange(statement, ts.getSourceMapRange(accessors.firstAccessor)), statement } function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor, ancestorFacts = enterSubtree(0, 0), target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1568), ts.setSourceMapRange(target, firstAccessor.name); var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); ts.setEmitFlags(propertyName, 1552), ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { var getterFunction = transformFunctionLikeToExpression(getAccessor, void 0, void 0, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)), ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); ts.setCommentRange(getter, ts.getCommentRange(getAccessor)), properties.push(getter) } if (setAccessor) { var setterFunction = transformFunctionLikeToExpression(setAccessor, void 0, void 0, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)), ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)), properties.push(setter) } properties.push(ts.createPropertyAssignment("enumerable", ts.createTrue()), ts.createPropertyAssignment("configurable", ts.createTrue())); var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), void 0, [target, propertyName, ts.createObjectLiteral(properties, !0)]); return startsOnNewLine && ts.startOnNewLine(call), exitSubtree(ancestorFacts, 49152, 49152 & hierarchyFacts ? 16384 : 0), call } function visitArrowFunction(node) { 16384 & node.transformFlags && enableSubstitutionsForCapturedThis(); var savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; var ancestorFacts = enterSubtree(16256, 66), func = ts.createFunctionExpression(void 0, void 0, void 0, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, transformFunctionBody(node)); return ts.setTextRange(func, node), ts.setOriginalNode(func, node), ts.setEmitFlags(func, 8), exitSubtree(ancestorFacts, 0, 0), convertedLoopState = savedConvertedLoopState, func } function visitFunctionExpression(node) { var ancestorFacts = 262144 & ts.getEmitFlags(node) ? enterSubtree(16278, 69) : enterSubtree(16286, 65), savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; var parameters = ts.visitParameterList(node.parameters, visitor, context), body = 64 & node.transformFlags ? transformFunctionBody(node) : visitFunctionBodyDownLevel(node), name = 16384 & hierarchyFacts ? ts.getLocalName(node) : node.name; return exitSubtree(ancestorFacts, 49152, 0), convertedLoopState = savedConvertedLoopState, ts.updateFunctionExpression(node, void 0, node.asteriskToken, name, void 0, parameters, void 0, body) } function visitFunctionDeclaration(node) { var savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; var ancestorFacts = enterSubtree(16286, 65), parameters = ts.visitParameterList(node.parameters, visitor, context), body = 64 & node.transformFlags ? transformFunctionBody(node) : visitFunctionBodyDownLevel(node), name = 16384 & hierarchyFacts ? ts.getLocalName(node) : node.name; return exitSubtree(ancestorFacts, 49152, 0), convertedLoopState = savedConvertedLoopState, ts.updateFunctionDeclaration(node, void 0, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, void 0, parameters, void 0, body) } function transformFunctionLikeToExpression(node, location, name, container) { var savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32) ? enterSubtree(16286, 73) : enterSubtree(16286, 65), parameters = ts.visitParameterList(node.parameters, visitor, context), body = transformFunctionBody(node); return 16384 & hierarchyFacts && !name && (233 === node.kind || 191 === node.kind) && (name = ts.getGeneratedNameForNode(node)), exitSubtree(ancestorFacts, 49152, 0), convertedLoopState = savedConvertedLoopState, ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(void 0, node.asteriskToken, name, void 0, parameters, void 0, body), location), node) } function transformFunctionBody(node) { var statementsLocation, closeBraceLocation, statementOffset, multiLine = !1, singleLine = !1, leadingStatements = [], statements = [], body = node.body; if (resumeLexicalEnvironment(), ts.isBlock(body) && (statementOffset = ts.addStandardPrologue(leadingStatements, body.statements, !1)), addCaptureThisForNodeIfNeeded(leadingStatements, node), addDefaultValueAssignmentsIfNeeded(leadingStatements, node), addRestParameterIfNeeded(leadingStatements, node, !1), ts.isBlock(body)) statementOffset = ts.addCustomPrologue(leadingStatements, body.statements, statementOffset, visitor), statementsLocation = body.statements, ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)), !multiLine && body.multiLine && (multiLine = !0); else { ts.Debug.assert(192 === node.kind), statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; ts.nodeIsSynthesized(equalsGreaterThanToken) || ts.nodeIsSynthesized(body) || (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile) ? singleLine = !0 : multiLine = !0); var expression = ts.visitNode(body, visitor, ts.isExpression), returnStatement = ts.createReturn(expression); ts.setTextRange(returnStatement, body), ts.moveSyntheticComments(returnStatement, body), ts.setEmitFlags(returnStatement, 1440), statements.push(returnStatement), closeBraceLocation = body } var lexicalEnvironment = context.endLexicalEnvironment(); ts.prependStatements(statements, lexicalEnvironment), prependCaptureNewTargetIfNeeded(statements, node, !1), (ts.some(leadingStatements) || ts.some(lexicalEnvironment)) && (multiLine = !0); var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(leadingStatements.concat(statements)), statementsLocation), multiLine); return ts.setTextRange(block, node.body), !multiLine && singleLine && ts.setEmitFlags(block, 1), closeBraceLocation && ts.setTokenSourceMapRange(block, 18, closeBraceLocation), ts.setOriginalNode(block, node.body), block } function visitFunctionBodyDownLevel(node) { var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); return ts.updateBlock(updated, ts.setTextRange(ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, !0)), updated.statements)) } function visitBlock(node, isFunctionBody) { if (isFunctionBody) return ts.visitEachChild(node, visitor, context); var ancestorFacts = 256 & hierarchyFacts ? enterSubtree(4032, 512) : enterSubtree(3904, 128), updated = ts.visitEachChild(node, visitor, context); return exitSubtree(ancestorFacts, 0, 0), updated } function visitExpressionStatement(node) { switch (node.expression.kind) { case 190: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, !1)); case 199: return ts.updateStatement(node, visitBinaryExpression(node.expression, !1)) }return ts.visitEachChild(node, visitor, context) } function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) switch (node.expression.kind) { case 190: return ts.updateParen(node, visitParenthesizedExpression(node.expression, !1)); case 199: return ts.updateParen(node, visitBinaryExpression(node.expression, !1)) }return ts.visitEachChild(node, visitor, context) } function visitBinaryExpression(node, needsDestructuringValue) { return ts.isDestructuringAssignment(node) ? ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue) : ts.visitEachChild(node, visitor, context) } function visitVariableStatement(node) { var updated, ancestorFacts = enterSubtree(0, ts.hasModifier(node, 1) ? 32 : 0); if (convertedLoopState && 0 === (3 & node.declarationList.flags)) { for (var assignments = void 0, _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; if (hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl), decl.initializer) { var assignment = void 0; ts.isBindingPattern(decl.name) ? assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0) : (assignment = ts.createBinary(decl.name, 58, ts.visitNode(decl.initializer, visitor, ts.isExpression)), ts.setTextRange(assignment, decl)), assignments = ts.append(assignments, assignment) } } updated = assignments ? ts.setTextRange(ts.createStatement(ts.inlineExpressions(assignments)), node) : void 0 } else updated = ts.visitEachChild(node, visitor, context); return exitSubtree(ancestorFacts, 0, 0), updated } function visitVariableDeclarationList(node) { if (64 & node.transformFlags) { 3 & node.flags && enableSubstitutionsForBlockScopedBindings(); var declarations = ts.flatMap(node.declarations, 1 & node.flags ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration), declarationList = ts.createVariableDeclarationList(declarations); if (ts.setOriginalNode(declarationList, node), ts.setTextRange(declarationList, node), ts.setCommentRange(declarationList, node), 8388608 & node.transformFlags && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { var firstDeclaration = ts.firstOrUndefined(declarations); if (firstDeclaration) { var lastDeclaration = ts.lastOrUndefined(declarations); ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)) } } return declarationList } return ts.visitEachChild(node, visitor, context) } function shouldEmitExplicitInitializerForLetDeclaration(node) { var flags = resolver.getNodeCheckFlags(node), isCapturedInFunction = 131072 & flags, isDeclaredInLoop = 262144 & flags, emittedAsTopLevel = 0 !== (64 & hierarchyFacts) || isCapturedInFunction && isDeclaredInLoop && 0 !== (512 & hierarchyFacts), emitExplicitInitializer = !emittedAsTopLevel && 0 === (2048 & hierarchyFacts) && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && 0 === (3072 & hierarchyFacts)); return emitExplicitInitializer } function visitVariableDeclarationInLetDeclarationList(node) { var name = node.name; if (ts.isBindingPattern(name)) return visitVariableDeclaration(node); if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { var clone_2 = ts.getMutableClone(node); return clone_2.initializer = ts.createVoidZero(), clone_2 } return ts.visitEachChild(node, visitor, context) } function visitVariableDeclaration(node) { var updated, ancestorFacts = enterSubtree(32, 0); return updated = ts.isBindingPattern(node.name) ? ts.flattenDestructuringBinding(node, visitor, context, 0, void 0, 0 !== (32 & ancestorFacts)) : ts.visitEachChild(node, visitor, context), exitSubtree(ancestorFacts, 0, 0), updated } function recordLabel(node) { convertedLoopState.labels.set(ts.idText(node.label), !0) } function resetLabel(node) { convertedLoopState.labels.set(ts.idText(node.label), !1) } function visitLabeledStatement(node) { convertedLoopState && !convertedLoopState.labels && (convertedLoopState.labels = ts.createMap()); var statement = ts.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); return ts.isIterationStatement(statement, !1) ? visitIterationStatement(statement, node) : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel) } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { case 217: case 218: return visitDoOrWhileStatement(node, outermostLabeledStatement); case 219: return visitForStatement(node, outermostLabeledStatement); case 220: return visitForInStatement(node, outermostLabeledStatement); case 221: return visitForOfStatement(node, outermostLabeledStatement) } } function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { var ancestorFacts = enterSubtree(excludeFacts, includeFacts), updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); return exitSubtree(ancestorFacts, 0, 0), updated } function visitDoOrWhileStatement(node, outermostLabeledStatement) { return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement) } function visitForStatement(node, outermostLabeledStatement) { return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement) } function visitForInStatement(node, outermostLabeledStatement) { return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement) } function visitForOfStatement(node, outermostLabeledStatement) { return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray) } function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { var statements = []; if (ts.isVariableDeclarationList(node.initializer)) { 3 & node.initializer.flags && enableSubstitutionsForBlockScopedBindings(); var firstOriginalDeclaration = ts.firstOrUndefined(node.initializer.declarations); if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, boundValue), declarationList = ts.setTextRange(ts.createVariableDeclarationList(declarations), node.initializer); ts.setOriginalNode(declarationList, node.initializer); var firstDeclaration = declarations[0], lastDeclaration = ts.lastOrUndefined(declarations); ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)), statements.push(ts.createVariableStatement(void 0, declarationList)) } else statements.push(ts.setTextRange(ts.createVariableStatement(void 0, ts.setOriginalNode(ts.setTextRange(ts.createVariableDeclarationList([ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(void 0), void 0, boundValue)]), ts.moveRangePos(node.initializer, -1)), node.initializer)), ts.moveRangeEnd(node.initializer, -1))) } else { var assignment = ts.createAssignment(node.initializer, boundValue); ts.isDestructuringAssignment(assignment) ? (ts.aggregateTransformFlags(assignment), statements.push(ts.createStatement(visitBinaryExpression(assignment, !1)))) : (assignment.end = node.initializer.end, statements.push(ts.setTextRange(ts.createStatement(ts.visitNode(assignment, visitor, ts.isExpression)), ts.moveRangeEnd(node.initializer, -1)))) } if (convertedLoopBodyStatements) return createSyntheticBlockForConvertedStatements(ts.addRange(statements, convertedLoopBodyStatements)); var statement = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); return ts.isBlock(statement) ? ts.updateBlock(statement, ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, statement.statements)), statement.statements)) : (statements.push(statement), createSyntheticBlockForConvertedStatements(statements)) } function createSyntheticBlockForConvertedStatements(statements) { return ts.setEmitFlags(ts.createBlock(ts.createNodeArray(statements), !0), 432) } function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression), counter = ts.createLoopVariable(), rhsReference = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(void 0); ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression)); var forStatement = ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ts.setTextRange(ts.createVariableDeclaration(counter, void 0, ts.createLiteral(0)), ts.moveRangePos(node.expression, -1)), ts.setTextRange(ts.createVariableDeclaration(rhsReference, void 0, expression), node.expression)]), node.expression), 2097152), ts.setTextRange(ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length")), node.expression), ts.setTextRange(ts.createPostfixIncrement(counter), node.expression), convertForOfStatementHead(node, ts.createElementAccess(rhsReference, counter), convertedLoopBodyStatements)), node); return ts.setEmitFlags(forStatement, 256), ts.setTextRange(forStatement, node), ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel) } function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression), iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(void 0), result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(void 0), errorRecord = ts.createUniqueName("e"), catchVariable = ts.getGeneratedNameForNode(errorRecord), returnMethod = ts.createTempVariable(void 0), values = ts.createValuesHelper(context, expression, node.expression), next = ts.createCall(ts.createPropertyAccess(iterator, "next"), void 0, []); hoistVariableDeclaration(errorRecord), hoistVariableDeclaration(returnMethod); var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ts.setTextRange(ts.createVariableDeclaration(iterator, void 0, values), node.expression), ts.createVariableDeclaration(result, void 0, next)]), node.expression), 2097152), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"), convertedLoopBodyStatements)), node), 256); return ts.createTry(ts.createBlock([ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel)]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ts.createPropertyAssignment("error", catchVariable)])))]), 1)), ts.createBlock([ts.createTry(ts.createBlock([ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createFunctionCall(returnMethod, iterator, []))), 1)]), void 0, ts.setEmitFlags(ts.createBlock([ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1)]), 1))])) } function visitObjectLiteralExpression(node) { for (var properties = node.properties, numProperties = properties.length, numInitialProperties = numProperties, numInitialPropertiesWithoutYield = numProperties, i = 0; i < numProperties; i++) { var property = properties[i]; if (16777216 & property.transformFlags && 4 & hierarchyFacts && i < numInitialPropertiesWithoutYield && (numInitialPropertiesWithoutYield = i), 146 === property.name.kind) { numInitialProperties = i; break } } if (numInitialProperties !== numProperties) { numInitialPropertiesWithoutYield < numInitialProperties && (numInitialProperties = numInitialPropertiesWithoutYield); var temp = ts.createTempVariable(hoistVariableDeclaration), expressions = [], assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), 65536)); return node.multiLine && ts.startOnNewLine(assignment), expressions.push(assignment), addObjectLiteralMembers(expressions, node, temp, numInitialProperties), expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp), ts.inlineExpressions(expressions) } return ts.visitEachChild(node, visitor, context) } function shouldConvertIterationStatementBody(node) { return 0 !== (65536 & resolver.getNodeCheckFlags(node)) } function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) { function visit(node) { if (71 === node.kind) state.hoistedLocalVariables.push(node); else for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isOmittedExpression(element) || visit(element.name) } } state.hoistedLocalVariables || (state.hoistedLocalVariables = []), visit(node.name) } function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; convertedLoopState && (saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps, convertedLoopState.allowedNonLabeledJumps = 6); var result = convert ? convert(node, outermostLabeledStatement, void 0) : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); return convertedLoopState && (convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps), result } var loopInitializer, functionName = ts.createUniqueName("_loop"); switch (node.kind) { case 219: case 220: case 221: var initializer = node.initializer; initializer && 232 === initializer.kind && (loopInitializer = initializer) }var loopParameters = [], loopOutParameters = []; if (loopInitializer && 3 & ts.getCombinedNodeFlags(loopInitializer)) for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) { var decl = _a[_i]; processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) } var outerConvertedLoopState = convertedLoopState; convertedLoopState = { loopOutParameters: loopOutParameters }, outerConvertedLoopState && (outerConvertedLoopState.argumentsName && (convertedLoopState.argumentsName = outerConvertedLoopState.argumentsName), outerConvertedLoopState.thisName && (convertedLoopState.thisName = outerConvertedLoopState.thisName), outerConvertedLoopState.hoistedLocalVariables && (convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables)), startLexicalEnvironment(); var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), lexicalEnvironment = endLexicalEnvironment(), currentState = convertedLoopState; if (convertedLoopState = outerConvertedLoopState, loopOutParameters.length || lexicalEnvironment) { var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; loopOutParameters.length && copyOutParameters(loopOutParameters, 1, statements_4), ts.prependStatements(statements_4, lexicalEnvironment), loopBody = ts.createBlock(statements_4, !0) } ts.isBlock(loopBody) ? loopBody.multiLine = !0 : loopBody = ts.createBlock([loopBody], !0); var containsYield = 0 !== (16777216 & node.statement.transformFlags), isAsyncBlockContainingAwait = containsYield && 0 !== (4 & hierarchyFacts), loopBodyFlags = 0; currentState.containsLexicalThis && (loopBodyFlags |= 8), isAsyncBlockContainingAwait && (loopBodyFlags |= 262144); var extraVariableDeclarations, convertedLoopVariable = ts.createVariableStatement(void 0, ts.setEmitFlags(ts.createVariableDeclarationList([ts.createVariableDeclaration(functionName, void 0, ts.setEmitFlags(ts.createFunctionExpression(void 0, containsYield ? ts.createToken(39) : void 0, void 0, void 0, loopParameters, void 0, loopBody), loopBodyFlags))]), 2097152)), statements = [convertedLoopVariable]; if (currentState.argumentsName && (outerConvertedLoopState ? outerConvertedLoopState.argumentsName = currentState.argumentsName : (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.argumentsName, void 0, ts.createIdentifier("arguments")))), currentState.thisName && (outerConvertedLoopState ? outerConvertedLoopState.thisName = currentState.thisName : (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.thisName, void 0, ts.createIdentifier("this")))), currentState.hoistedLocalVariables) if (outerConvertedLoopState) outerConvertedLoopState.hoistedLocalVariables = currentState.hoistedLocalVariables; else { extraVariableDeclarations || (extraVariableDeclarations = []); for (var _b = 0, _c = currentState.hoistedLocalVariables; _b < _c.length; _b++) { var identifier = _c[_b]; extraVariableDeclarations.push(ts.createVariableDeclaration(identifier)) } } if (loopOutParameters.length) { extraVariableDeclarations || (extraVariableDeclarations = []); for (var _d = 0, loopOutParameters_1 = loopOutParameters; _d < loopOutParameters_1.length; _d++) { var outParam = loopOutParameters_1[_d]; extraVariableDeclarations.push(ts.createVariableDeclaration(outParam.outParamName)) } } extraVariableDeclarations && statements.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList(extraVariableDeclarations))); var loop, convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, containsYield); if (convert) loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); else { var clone_3 = ts.getMutableClone(node); clone_3.statement = void 0, clone_3 = ts.visitEachChild(clone_3, visitor, context), clone_3.statement = ts.createBlock(convertedLoopBodyStatements, !0), clone_3.transformFlags = 0, ts.aggregateTransformFlags(clone_3), loop = ts.restoreEnclosingLabel(clone_3, outermostLabeledStatement, convertedLoopState && resetLabel) } return statements.push(loop), statements } function copyOutParameter(outParam, copyDirection) { var source = 0 === copyDirection ? outParam.outParamName : outParam.originalName, target = 0 === copyDirection ? outParam.originalName : outParam.outParamName; return ts.createBinary(target, 58, source) } function copyOutParameters(outParams, copyDirection, statements) { for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) { var outParam = outParams_1[_i]; statements.push(ts.createStatement(copyOutParameter(outParam, copyDirection))) } } function generateCallToConvertedLoop(loopFunctionExpressionName, parameters, state, isAsyncBlockContainingAwait) { var outerConvertedLoopState = convertedLoopState, statements = [], isSimpleLoop = !(state.nonLocalJumps & -5 || state.labeledNonLocalBreaks || state.labeledNonLocalContinues), call = ts.createCall(loopFunctionExpressionName, void 0, ts.map(parameters, function (p) { return p.name })), callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(39), ts.setEmitFlags(call, 8388608)) : call; if (isSimpleLoop) statements.push(ts.createStatement(callResult)), copyOutParameters(state.loopOutParameters, 0, statements); else { var loopResultName = ts.createUniqueName("state"), stateVariable = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(loopResultName, void 0, callResult)])); if (statements.push(stateVariable), copyOutParameters(state.loopOutParameters, 0, statements), 8 & state.nonLocalJumps) { var returnStatement = void 0; outerConvertedLoopState ? (outerConvertedLoopState.nonLocalJumps |= 8, returnStatement = ts.createReturn(loopResultName)) : returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, "value")), statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 34, ts.createLiteral("object")), returnStatement)) } if (2 & state.nonLocalJumps && statements.push(ts.createIf(ts.createBinary(loopResultName, 34, ts.createLiteral("break")), ts.createBreak())), state.labeledNonLocalBreaks || state.labeledNonLocalContinues) { var caseClauses = []; processLabeledJumps(state.labeledNonLocalBreaks, !0, loopResultName, outerConvertedLoopState, caseClauses), processLabeledJumps(state.labeledNonLocalContinues, !1, loopResultName, outerConvertedLoopState, caseClauses), statements.push(ts.createSwitch(loopResultName, ts.createCaseBlock(caseClauses))) } } return statements } function setLabeledJump(state, isBreak, labelText, labelMarker) { isBreak ? (state.labeledNonLocalBreaks || (state.labeledNonLocalBreaks = ts.createMap()), state.labeledNonLocalBreaks.set(labelText, labelMarker)) : (state.labeledNonLocalContinues || (state.labeledNonLocalContinues = ts.createMap()), state.labeledNonLocalContinues.set(labelText, labelMarker)) } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { table && table.forEach(function (labelMarker, labelText) { var statements = []; if (!outerLoop || outerLoop.labels && outerLoop.labels.get(labelText)) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)) } else setLabeledJump(outerLoop, isBreak, labelText, labelMarker), statements.push(ts.createReturn(loopResultName)); caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)) }) } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; if (ts.isBindingPattern(name)) for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isOmittedExpression(element) || processLoopVariableDeclaration(element, loopParameters, loopOutParameters); } else if (loopParameters.push(ts.createParameter(void 0, void 0, void 0, name)), 2097152 & resolver.getNodeCheckFlags(decl)) { var outParamName = ts.createUniqueName("out_" + ts.idText(name)); loopOutParameters.push({ originalName: name, outParamName: outParamName }) } } function addObjectLiteralMembers(expressions, node, receiver, start) { for (var properties = node.properties, numProperties = properties.length, i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { case 155: case 156: var accessors = ts.getAllAccessorDeclarations(node.properties, property); property === accessors.firstAccessor && expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); break; case 153: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; case 269: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; case 270: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: ts.Debug.failBadSyntaxKind(node) } } } function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression)); return ts.setTextRange(expression, property), startsOnNewLine && ts.startOnNewLine(expression), expression } function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name)); return ts.setTextRange(expression, property), startsOnNewLine && ts.startOnNewLine(expression), expression } function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { var ancestorFacts = enterSubtree(0, 0), expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, void 0, container)); return ts.setTextRange(expression, method), startsOnNewLine && ts.startOnNewLine(expression), exitSubtree(ancestorFacts, 49152, 49152 & hierarchyFacts ? 16384 : 0), expression } function visitCatchClause(node) { var updated, ancestorFacts = enterSubtree(4032, 0); if (ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015."), ts.isBindingPattern(node.variableDeclaration.name)) { var temp = ts.createTempVariable(void 0), newVariableDeclaration = ts.createVariableDeclaration(temp); ts.setTextRange(newVariableDeclaration, node.variableDeclaration); var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp), list = ts.createVariableDeclarationList(vars); ts.setTextRange(list, node.variableDeclaration); var destructure = ts.createVariableStatement(void 0, list); updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)) } else updated = ts.visitEachChild(node, visitor, context); return exitSubtree(ancestorFacts, 0, 0), updated } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); return ts.updateBlock(block, [statement].concat(transformedStatements)) } function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), void 0, void 0); return ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)), ts.setTextRange(ts.createPropertyAssignment(node.name, functionExpression), node) } function visitAccessorDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var savedConvertedLoopState = convertedLoopState; convertedLoopState = void 0; var updated, ancestorFacts = enterSubtree(16286, 65), parameters = ts.visitParameterList(node.parameters, visitor, context), body = 32896 & node.transformFlags ? transformFunctionBody(node) : visitFunctionBodyDownLevel(node); return updated = 155 === node.kind ? ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body) : ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body), exitSubtree(ancestorFacts, 49152, 0), convertedLoopState = savedConvertedLoopState, updated } function visitShorthandPropertyAssignment(node) { return ts.setTextRange(ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name)), node) } function visitComputedPropertyName(node) { var ancestorFacts = enterSubtree(0, 8192), updated = ts.visitEachChild(node, visitor, context); return exitSubtree(ancestorFacts, 49152, 49152 & hierarchyFacts ? 32768 : 0), updated } function visitYieldExpression(node) { return ts.visitEachChild(node, visitor, context) } function visitArrayLiteralExpression(node) { return 64 & node.transformFlags ? transformAndSpreadElements(node.elements, !0, node.multiLine, node.elements.hasTrailingComma) : ts.visitEachChild(node, visitor, context) } function visitCallExpression(node) { return 33554432 & ts.getEmitFlags(node) ? visitTypeScriptClassWrapper(node) : 64 & node.transformFlags ? visitCallExpressionWithPotentialCapturedThisAssignment(node, !0) : ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), void 0, ts.visitNodes(node.arguments, visitor, ts.isExpression)) } function visitTypeScriptClassWrapper(node) { var body = ts.cast(ts.cast(ts.skipOuterExpressions(node.expression), ts.isArrowFunction).body, ts.isBlock), isVariableStatementWithInitializer = function (stmt) { return ts.isVariableStatement(stmt) && !!ts.firstOrUndefined(stmt.declarationList.declarations).initializer }, bodyStatements = ts.visitNodes(body.statements, visitor, ts.isStatement), classStatements = ts.filter(bodyStatements, isVariableStatementWithInitializer), remainingStatements = ts.filter(bodyStatements, function (stmt) { return !isVariableStatementWithInitializer(stmt) }), varStatement = ts.cast(ts.firstOrUndefined(classStatements), ts.isVariableStatement), variable = varStatement.declarationList.declarations[0], initializer = ts.skipOuterExpressions(variable.initializer), aliasAssignment = ts.tryCast(initializer, ts.isAssignmentExpression), call = ts.cast(aliasAssignment ? ts.skipOuterExpressions(aliasAssignment.right) : initializer, ts.isCallExpression), func = ts.cast(ts.skipOuterExpressions(call.expression), ts.isFunctionExpression), funcStatements = func.body.statements, classBodyStart = 0, classBodyEnd = -1, statements = []; if (aliasAssignment) { var extendsCall = ts.tryCast(funcStatements[classBodyStart], ts.isExpressionStatement); extendsCall && (statements.push(extendsCall), classBodyStart++), statements.push(funcStatements[classBodyStart]), classBodyStart++ , statements.push(ts.createStatement(ts.createAssignment(aliasAssignment.left, ts.cast(variable.name, ts.isIdentifier)))) } for (; !ts.isReturnStatement(ts.elementAt(funcStatements, classBodyEnd));)classBodyEnd--; return ts.addRange(statements, funcStatements, classBodyStart, classBodyEnd), classBodyEnd < -1 && ts.addRange(statements, funcStatements, classBodyEnd + 1), ts.addRange(statements, remainingStatements), ts.addRange(statements, classStatements, 1), ts.recreateOuterExpressions(node.expression, ts.recreateOuterExpressions(variable.initializer, ts.recreateOuterExpressions(aliasAssignment && aliasAssignment.right, ts.updateCall(call, ts.recreateOuterExpressions(call.expression, ts.updateFunctionExpression(func, void 0, void 0, void 0, void 0, func.parameters, void 0, ts.updateBlock(func.body, statements))), void 0, call.arguments)))) } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, !1) } function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) { if (524288 & node.transformFlags || 97 === node.expression.kind || ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) { var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; 97 === node.expression.kind && ts.setEmitFlags(thisArg, 4); var resultingCall = void 0; if (resultingCall = 524288 & node.transformFlags ? ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, !1, !1, !1)) : ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node), 97 === node.expression.kind) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer) : initializer } return ts.setOriginalNode(resultingCall, node) } return ts.visitEachChild(node, visitor, context) } function visitNewExpression(node) { if (524288 & node.transformFlags) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), !1, !1, !1)), void 0, []) } return ts.visitEachChild(node, visitor, context) } function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { var numElements = elements.length, segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) { return visitPartition(partition, multiLine, hasTrailingComma && end === numElements) })); if (compilerOptions.downlevelIteration) { if (1 === segments.length) { var firstSegment = segments[0]; if (ts.isCallExpression(firstSegment) && ts.isIdentifier(firstSegment.expression) && 4096 & ts.getEmitFlags(firstSegment.expression) && "___spread" === firstSegment.expression.escapedText) return segments[0] } return ts.createSpreadHelper(context, segments) } if (1 === segments.length) { var firstElement = elements[0]; return needsUniqueCopy && ts.isSpreadElement(firstElement) && 182 !== firstElement.expression.kind ? ts.createArraySlice(segments[0]) : segments[0] } return ts.createArrayConcat(segments.shift(), segments) } function partitionSpread(node) { return ts.isSpreadElement(node) ? visitSpanOfSpreads : visitSpanOfNonSpreads } function visitSpanOfSpreads(chunk) { return ts.map(chunk, visitExpressionOfSpread) } function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, hasTrailingComma), visitor, ts.isExpression), multiLine) } function visitSpreadElement(node) { return ts.visitNode(node.expression, visitor, ts.isExpression) } function visitExpressionOfSpread(node) { return ts.visitNode(node.expression, visitor, ts.isExpression) } function visitTemplateLiteral(node) { return ts.setTextRange(ts.createLiteral(node.text), node) } function visitStringLiteral(node) { return node.hasExtendedUnicodeEscape ? ts.setTextRange(ts.createLiteral(node.text), node) : node } function visitNumericLiteral(node) { return 384 & node.numericLiteralFlags ? ts.setTextRange(ts.createNumericLiteral(node.text), node) : node } function visitTaggedTemplateExpression(node) { var tag = ts.visitNode(node.tag, visitor, ts.isExpression), templateArguments = [void 0], cookedStrings = [], rawStrings = [], template = node.template; if (ts.isNoSubstitutionTemplateLiteral(template)) cookedStrings.push(ts.createLiteral(template.text)), rawStrings.push(getRawLiteral(template)); else { cookedStrings.push(ts.createLiteral(template.head.text)), rawStrings.push(getRawLiteral(template.head)); for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) { var templateSpan = _a[_i]; cookedStrings.push(ts.createLiteral(templateSpan.literal.text)), rawStrings.push(getRawLiteral(templateSpan.literal)), templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression)) } } var helperCall = createTemplateObjectHelper(context, ts.createArrayLiteral(cookedStrings), ts.createArrayLiteral(rawStrings)); if (ts.isExternalModule(currentSourceFile)) { var tempVar = ts.createUniqueName("templateObject"); recordTaggedTemplateString(tempVar), templateArguments[0] = ts.createLogicalOr(tempVar, ts.createAssignment(tempVar, helperCall)) } else templateArguments[0] = helperCall; return ts.createCall(tag, void 0, templateArguments) } function getRawLiteral(node) { var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node), isLast = 13 === node.kind || 16 === node.kind; return text = text.substring(1, text.length - (isLast ? 1 : 2)), text = text.replace(/\r\n?/g, "\n"), ts.setTextRange(ts.createLiteral(text), node) } function visitTemplateExpression(node) { var expressions = []; addTemplateHead(expressions, node), addTemplateSpans(expressions, node); var expression = ts.reduceLeft(expressions, ts.createAdd); return ts.nodeIsSynthesized(expression) && (expression.pos = node.pos, expression.end = node.end), expression } function shouldAddTemplateHead(node) { return ts.Debug.assert(0 !== node.templateSpans.length), 0 !== node.head.text.length || 0 === node.templateSpans[0].literal.text.length } function addTemplateHead(expressions, node) { shouldAddTemplateHead(node) && expressions.push(ts.createLiteral(node.head.text)) } function addTemplateSpans(expressions, node) { for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) { var span = _a[_i]; expressions.push(ts.visitNode(span.expression, visitor, ts.isExpression)), 0 !== span.literal.text.length && expressions.push(ts.createLiteral(span.literal.text)) } } function visitSuperKeyword(isExpressionOfCall) { return 8 & hierarchyFacts && !isExpressionOfCall ? ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), "prototype") : ts.createFileLevelUniqueName("_super") } function visitMetaProperty(node) { return 94 === node.keywordToken && "target" === node.name.escapedText ? (hierarchyFacts |= 8192 & hierarchyFacts ? 32768 : 16384, ts.createFileLevelUniqueName("_newTarget")) : node } function onEmitNode(hint, node, emitCallback) { if (1 & enabledSubstitutions && ts.isFunctionLike(node)) { var ancestorFacts = enterSubtree(16286, 8 & ts.getEmitFlags(node) ? 81 : 65); return previousOnEmitNode(hint, node, emitCallback), void exitSubtree(ancestorFacts, 0, 0) } previousOnEmitNode(hint, node, emitCallback) } function enableSubstitutionsForBlockScopedBindings() { 0 === (2 & enabledSubstitutions) && (enabledSubstitutions |= 2, context.enableSubstitution(71)) } function enableSubstitutionsForCapturedThis() { 0 === (1 & enabledSubstitutions) && (enabledSubstitutions |= 1, context.enableSubstitution(99), context.enableEmitNotification(154), context.enableEmitNotification(153), context.enableEmitNotification(155), context.enableEmitNotification(156), context.enableEmitNotification(192), context.enableEmitNotification(191), context.enableEmitNotification(233)) } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), 1 === hint ? substituteExpression(node) : ts.isIdentifier(node) ? substituteIdentifier(node) : node } function substituteIdentifier(node) { if (2 & enabledSubstitutions && !ts.isInternalName(node)) { var original = ts.getParseTreeNode(node, ts.isIdentifier); if (original && isNameOfDeclarationWithCollidingName(original)) return ts.setTextRange(ts.getGeneratedNameForNode(original), node) } return node } function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { case 181: case 234: case 237: case 231: return parent.name === node && resolver.isDeclarationWithCollidingName(parent) }return !1 } function substituteExpression(node) { switch (node.kind) { case 71: return substituteExpressionIdentifier(node); case 99: return substituteThisKeyword(node) }return node } function substituteExpressionIdentifier(node) { if (2 & enabledSubstitutions && !ts.isInternalName(node)) { var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration && (!ts.isClassLike(declaration) || !isPartOfClassBody(declaration, node))) return ts.setTextRange(ts.getGeneratedNameForNode(ts.getNameOfDeclaration(declaration)), node) } return node } function isPartOfClassBody(declaration, node) { var currentNode = ts.getParseTreeNode(node); if (!currentNode || currentNode === declaration || currentNode.end <= declaration.pos || currentNode.pos >= declaration.end) return !1; for (var blockScope = ts.getEnclosingBlockScopeContainer(declaration); currentNode;) { if (currentNode === blockScope || currentNode === declaration) return !1; if (ts.isClassElement(currentNode) && currentNode.parent === declaration) return !0; currentNode = currentNode.parent } return !1 } function substituteThisKeyword(node) { return 1 & enabledSubstitutions && 16 & hierarchyFacts ? ts.setTextRange(ts.createFileLevelUniqueName("_this"), node) : node } function getClassMemberPrefix(node, member) { return ts.hasModifier(member, 32) ? ts.getInternalName(node) : ts.createPropertyAccess(ts.getInternalName(node), "prototype") } function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) { if (!constructor || !hasExtendsClause) return !1; if (ts.some(constructor.parameters)) return !1; var statement = ts.firstOrUndefined(constructor.body.statements); if (!statement || !ts.nodeIsSynthesized(statement) || 215 !== statement.kind) return !1; var statementExpression = statement.expression; if (!ts.nodeIsSynthesized(statementExpression) || 186 !== statementExpression.kind) return !1; var callTarget = statementExpression.expression; if (!ts.nodeIsSynthesized(callTarget) || 97 !== callTarget.kind) return !1; var callArgument = ts.singleOrUndefined(statementExpression.arguments); if (!callArgument || !ts.nodeIsSynthesized(callArgument) || 203 !== callArgument.kind) return !1; var expression = callArgument.expression; return ts.isIdentifier(expression) && "arguments" === expression.escapedText } var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, compilerOptions = context.getCompilerOptions(), resolver = context.getEmitResolver(), previousOnSubstituteNode = context.onSubstituteNode, previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode, context.onSubstituteNode = onSubstituteNode; var currentSourceFile, currentText, hierarchyFacts, taggedTemplateStringDeclarations, convertedLoopState, enabledSubstitutions; return ts.chainBundle(transformSourceFile) } function createExtendsHelper(context, name) { return context.requestEmitHelper(extendsHelper), ts.createCall(ts.getHelperName("__extends"), void 0, [name, ts.createFileLevelUniqueName("_super")]) } function createTemplateObjectHelper(context, cooked, raw) { return context.requestEmitHelper(templateObjectHelper), ts.createCall(ts.getHelperName("__makeTemplateObject"), void 0, [cooked, raw]) } var ES2015SubstitutionFlags; !function (ES2015SubstitutionFlags) { ES2015SubstitutionFlags[ES2015SubstitutionFlags.CapturedThis = 1] = "CapturedThis", ES2015SubstitutionFlags[ES2015SubstitutionFlags.BlockScopedBindings = 2] = "BlockScopedBindings" }(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {})); var CopyDirection; !function (CopyDirection) { CopyDirection[CopyDirection.ToOriginal = 0] = "ToOriginal", CopyDirection[CopyDirection.ToOutParameter = 1] = "ToOutParameter" }(CopyDirection || (CopyDirection = {})); var Jump; !function (Jump) { Jump[Jump.Break = 2] = "Break", Jump[Jump.Continue = 4] = "Continue", Jump[Jump.Return = 8] = "Return" }(Jump || (Jump = {})); var SuperCaptureResult; !function (SuperCaptureResult) { SuperCaptureResult[SuperCaptureResult.NoReplacement = 0] = "NoReplacement", SuperCaptureResult[SuperCaptureResult.ReplaceSuperCapture = 1] = "ReplaceSuperCapture", SuperCaptureResult[SuperCaptureResult.ReplaceWithReturn = 2] = "ReplaceWithReturn" }(SuperCaptureResult || (SuperCaptureResult = {})); var HierarchyFacts; !function (HierarchyFacts) { HierarchyFacts[HierarchyFacts.None = 0] = "None", HierarchyFacts[HierarchyFacts.Function = 1] = "Function", HierarchyFacts[HierarchyFacts.ArrowFunction = 2] = "ArrowFunction", HierarchyFacts[HierarchyFacts.AsyncFunctionBody = 4] = "AsyncFunctionBody", HierarchyFacts[HierarchyFacts.NonStaticClassElement = 8] = "NonStaticClassElement", HierarchyFacts[HierarchyFacts.CapturesThis = 16] = "CapturesThis", HierarchyFacts[HierarchyFacts.ExportedVariableStatement = 32] = "ExportedVariableStatement", HierarchyFacts[HierarchyFacts.TopLevel = 64] = "TopLevel", HierarchyFacts[HierarchyFacts.Block = 128] = "Block", HierarchyFacts[HierarchyFacts.IterationStatement = 256] = "IterationStatement", HierarchyFacts[HierarchyFacts.IterationStatementBlock = 512] = "IterationStatementBlock", HierarchyFacts[HierarchyFacts.ForStatement = 1024] = "ForStatement", HierarchyFacts[HierarchyFacts.ForInOrForOfStatement = 2048] = "ForInOrForOfStatement", HierarchyFacts[HierarchyFacts.ConstructorWithCapturedSuper = 4096] = "ConstructorWithCapturedSuper", HierarchyFacts[HierarchyFacts.ComputedPropertyName = 8192] = "ComputedPropertyName", HierarchyFacts[HierarchyFacts.AncestorFactsMask = 16383] = "AncestorFactsMask", HierarchyFacts[HierarchyFacts.BlockScopeIncludes = 0] = "BlockScopeIncludes", HierarchyFacts[HierarchyFacts.BlockScopeExcludes = 4032] = "BlockScopeExcludes", HierarchyFacts[HierarchyFacts.SourceFileIncludes = 64] = "SourceFileIncludes", HierarchyFacts[HierarchyFacts.SourceFileExcludes = 3968] = "SourceFileExcludes", HierarchyFacts[HierarchyFacts.FunctionIncludes = 65] = "FunctionIncludes", HierarchyFacts[HierarchyFacts.FunctionExcludes = 16286] = "FunctionExcludes", HierarchyFacts[HierarchyFacts.AsyncFunctionBodyIncludes = 69] = "AsyncFunctionBodyIncludes", HierarchyFacts[HierarchyFacts.AsyncFunctionBodyExcludes = 16278] = "AsyncFunctionBodyExcludes", HierarchyFacts[HierarchyFacts.ArrowFunctionIncludes = 66] = "ArrowFunctionIncludes", HierarchyFacts[HierarchyFacts.ArrowFunctionExcludes = 16256] = "ArrowFunctionExcludes", HierarchyFacts[HierarchyFacts.ConstructorIncludes = 73] = "ConstructorIncludes", HierarchyFacts[HierarchyFacts.ConstructorExcludes = 16278] = "ConstructorExcludes", HierarchyFacts[HierarchyFacts.DoOrWhileStatementIncludes = 256] = "DoOrWhileStatementIncludes", HierarchyFacts[HierarchyFacts.DoOrWhileStatementExcludes = 0] = "DoOrWhileStatementExcludes", HierarchyFacts[HierarchyFacts.ForStatementIncludes = 1280] = "ForStatementIncludes", HierarchyFacts[HierarchyFacts.ForStatementExcludes = 3008] = "ForStatementExcludes", HierarchyFacts[HierarchyFacts.ForInOrForOfStatementIncludes = 2304] = "ForInOrForOfStatementIncludes", HierarchyFacts[HierarchyFacts.ForInOrForOfStatementExcludes = 1984] = "ForInOrForOfStatementExcludes", HierarchyFacts[HierarchyFacts.BlockIncludes = 128] = "BlockIncludes", HierarchyFacts[HierarchyFacts.BlockExcludes = 3904] = "BlockExcludes", HierarchyFacts[HierarchyFacts.IterationStatementBlockIncludes = 512] = "IterationStatementBlockIncludes", HierarchyFacts[HierarchyFacts.IterationStatementBlockExcludes = 4032] = "IterationStatementBlockExcludes", HierarchyFacts[HierarchyFacts.ComputedPropertyNameIncludes = 8192] = "ComputedPropertyNameIncludes", HierarchyFacts[HierarchyFacts.ComputedPropertyNameExcludes = 0] = "ComputedPropertyNameExcludes", HierarchyFacts[HierarchyFacts.NewTarget = 16384] = "NewTarget", HierarchyFacts[HierarchyFacts.NewTargetInComputedPropertyName = 32768] = "NewTargetInComputedPropertyName", HierarchyFacts[HierarchyFacts.SubtreeFactsMask = -16384] = "SubtreeFactsMask", HierarchyFacts[HierarchyFacts.PropagateNewTargetMask = 49152] = "PropagateNewTargetMask" }(HierarchyFacts || (HierarchyFacts = {})), ts.transformES2015 = transformES2015; var extendsHelper = { name: "typescript:extends", scoped: !1, priority: 0, text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }, templateObjectHelper = { name: "typescript:makeTemplateObject", scoped: !1, priority: 0, text: '\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };' } }(ts || (ts = {})); var ts; !function (ts) { function transformES5(context) { function transformSourceFile(node) { return node } function onEmitNode(hint, node, emitCallback) { switch (node.kind) { case 256: case 257: case 255: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = !0 }previousOnEmitNode(hint, node, emitCallback) } function onSubstituteNode(hint, node) { return node.id && noSubstitution && noSubstitution[node.id] ? previousOnSubstituteNode(hint, node) : (node = previousOnSubstituteNode(hint, node), ts.isPropertyAccessExpression(node) ? substitutePropertyAccessExpression(node) : ts.isPropertyAssignment(node) ? substitutePropertyAssignment(node) : node) } function substitutePropertyAccessExpression(node) { var literalName = trySubstituteReservedName(node.name); return literalName ? ts.setTextRange(ts.createElementAccess(node.expression, literalName), node) : node } function substitutePropertyAssignment(node) { var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); return literalName ? ts.updatePropertyAssignment(node, literalName, node.initializer) : node } function trySubstituteReservedName(name) { var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : void 0); if (token >= 72 && token <= 107) return ts.setTextRange(ts.createLiteral(name), name) } var previousOnEmitNode, noSubstitution, compilerOptions = context.getCompilerOptions(); 1 !== compilerOptions.jsx && 3 !== compilerOptions.jsx || (previousOnEmitNode = context.onEmitNode, context.onEmitNode = onEmitNode, context.enableEmitNotification(256), context.enableEmitNotification(257), context.enableEmitNotification(255), noSubstitution = []); var previousOnSubstituteNode = context.onSubstituteNode; return context.onSubstituteNode = onSubstituteNode, context.enableSubstitution(184), context.enableSubstitution(269), ts.chainBundle(transformSourceFile) } ts.transformES5 = transformES5 }(ts || (ts = {})); var ts; !function (ts) { function getInstructionName(instruction) { switch (instruction) { case 2: return "return"; case 3: return "break"; case 4: return "yield"; case 5: return "yield*"; case 7: return "endfinally" } } function transformGenerators(context) { function transformSourceFile(node) { if (node.isDeclarationFile || 0 === (512 & node.transformFlags)) return node; var visited = ts.visitEachChild(node, visitor, context); return ts.addEmitHelpers(visited, context.readEmitHelpers()), visited } function visitor(node) { var transformFlags = node.transformFlags; return inStatementContainingYield ? visitJavaScriptInStatementContainingYield(node) : inGeneratorFunctionBody ? visitJavaScriptInGeneratorFunctionBody(node) : 256 & transformFlags ? visitGenerator(node) : 512 & transformFlags ? ts.visitEachChild(node, visitor, context) : node } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { case 217: return visitDoStatement(node); case 218: return visitWhileStatement(node); case 226: return visitSwitchStatement(node); case 227: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node) } } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { case 233: return visitFunctionDeclaration(node); case 191: return visitFunctionExpression(node); case 155: case 156: return visitAccessorDeclaration(node); case 213: return visitVariableStatement(node); case 219: return visitForStatement(node); case 220: return visitForInStatement(node); case 223: return visitBreakStatement(node); case 222: return visitContinueStatement(node); case 224: return visitReturnStatement(node); default: return 16777216 & node.transformFlags ? visitJavaScriptContainingYield(node) : 33554944 & node.transformFlags ? ts.visitEachChild(node, visitor, context) : node } } function visitJavaScriptContainingYield(node) { switch (node.kind) { case 199: return visitBinaryExpression(node); case 200: return visitConditionalExpression(node); case 202: return visitYieldExpression(node); case 182: return visitArrayLiteralExpression(node); case 183: return visitObjectLiteralExpression(node); case 185: return visitElementAccessExpression(node); case 186: return visitCallExpression(node); case 187: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context) } } function visitGenerator(node) { switch (node.kind) { case 233: return visitFunctionDeclaration(node); case 191: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node) } } function visitFunctionDeclaration(node) { if (node.asteriskToken) node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(void 0, node.modifiers, void 0, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, transformGeneratorFunctionBody(node.body)), node), node); else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody, savedInStatementContainingYield = inStatementContainingYield; inGeneratorFunctionBody = !1, inStatementContainingYield = !1, node = ts.visitEachChild(node, visitor, context), inGeneratorFunctionBody = savedInGeneratorFunctionBody, inStatementContainingYield = savedInStatementContainingYield } return inGeneratorFunctionBody ? void hoistFunctionDeclaration(node) : node } function visitFunctionExpression(node) { if (node.asteriskToken) node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(void 0, void 0, node.name, void 0, ts.visitParameterList(node.parameters, visitor, context), void 0, transformGeneratorFunctionBody(node.body)), node), node); else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody, savedInStatementContainingYield = inStatementContainingYield; inGeneratorFunctionBody = !1, inStatementContainingYield = !1, node = ts.visitEachChild(node, visitor, context), inGeneratorFunctionBody = savedInGeneratorFunctionBody, inStatementContainingYield = savedInStatementContainingYield } return node } function visitAccessorDeclaration(node) { var savedInGeneratorFunctionBody = inGeneratorFunctionBody, savedInStatementContainingYield = inStatementContainingYield; return inGeneratorFunctionBody = !1, inStatementContainingYield = !1, node = ts.visitEachChild(node, visitor, context), inGeneratorFunctionBody = savedInGeneratorFunctionBody, inStatementContainingYield = savedInStatementContainingYield, node } function transformGeneratorFunctionBody(body) { var statements = [], savedInGeneratorFunctionBody = inGeneratorFunctionBody, savedInStatementContainingYield = inStatementContainingYield, savedBlocks = blocks, savedBlockOffsets = blockOffsets, savedBlockActions = blockActions, savedBlockStack = blockStack, savedLabelOffsets = labelOffsets, savedLabelExpressions = labelExpressions, savedNextLabelId = nextLabelId, savedOperations = operations, savedOperationArguments = operationArguments, savedOperationLocations = operationLocations, savedState = state; inGeneratorFunctionBody = !0, inStatementContainingYield = !1, blocks = void 0, blockOffsets = void 0, blockActions = void 0, blockStack = void 0, labelOffsets = void 0, labelExpressions = void 0, nextLabelId = 1, operations = void 0, operationArguments = void 0, operationLocations = void 0, state = ts.createTempVariable(void 0), resumeLexicalEnvironment(); var statementOffset = ts.addPrologue(statements, body.statements, !1, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); return ts.prependStatements(statements, endLexicalEnvironment()), statements.push(ts.createReturn(buildResult)), inGeneratorFunctionBody = savedInGeneratorFunctionBody, inStatementContainingYield = savedInStatementContainingYield, blocks = savedBlocks, blockOffsets = savedBlockOffsets, blockActions = savedBlockActions, blockStack = savedBlockStack, labelOffsets = savedLabelOffsets, labelExpressions = savedLabelExpressions, nextLabelId = savedNextLabelId, operations = savedOperations, operationArguments = savedOperationArguments, operationLocations = savedOperationLocations, state = savedState, ts.setTextRange(ts.createBlock(statements, body.multiLine), body) } function visitVariableStatement(node) { if (16777216 & node.transformFlags) return void transformAndEmitVariableDeclarationList(node.declarationList); if (1048576 & ts.getEmitFlags(node)) return node; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name) } var variables = ts.getInitializedVariables(node.declarationList); if (0 !== variables.length) return ts.setSourceMapRange(ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))), node); } function visitBinaryExpression(node) { switch (ts.getExpressionAssociativity(node)) { case 0: return visitLeftAssociativeBinaryExpression(node); case 1: return visitRightAssociativeBinaryExpression(node); default: ts.Debug.fail("Unknown associativity.") } } function isCompoundAssignment(kind) { return kind >= 59 && kind <= 70 } function getOperatorForCompoundAssignment(kind) { switch (kind) { case 59: return 37; case 60: return 38; case 61: return 39; case 62: return 40; case 63: return 41; case 64: return 42; case 65: return 45; case 66: return 46; case 67: return 47; case 68: return 48; case 69: return 49; case 70: return 50 } } function visitRightAssociativeBinaryExpression(node) { var left = node.left, right = node.right; if (containsYield(right)) { var target = void 0; switch (left.kind) { case 184: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; case 185: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: target = ts.visitNode(left, visitor, ts.isExpression) }var operator = node.operatorToken.kind; return isCompoundAssignment(operator) ? ts.setTextRange(ts.createAssignment(target, ts.setTextRange(ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node) : ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression)) } return ts.visitEachChild(node, visitor, context) } function visitLeftAssociativeBinaryExpression(node) { if (containsYield(node.right)) { if (ts.isLogicalOperator(node.operatorToken.kind)) return visitLogicalBinaryExpression(node); if (26 === node.operatorToken.kind) return visitCommaExpression(node); var clone_4 = ts.getMutableClone(node); return clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)), clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression), clone_4 } return ts.visitEachChild(node, visitor, context) } function visitLogicalBinaryExpression(node) { var resultLabel = defineLabel(), resultLocal = declareLocal(); return emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left), 53 === node.operatorToken.kind ? emitBreakWhenFalse(resultLabel, resultLocal, node.left) : emitBreakWhenTrue(resultLabel, resultLocal, node.left), emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right), markLabel(resultLabel), resultLocal } function visitCommaExpression(node) { function visit(node) { ts.isBinaryExpression(node) && 26 === node.operatorToken.kind ? (visit(node.left), visit(node.right)) : (containsYield(node) && pendingExpressions.length > 0 && (emitWorker(1, [ts.createStatement(ts.inlineExpressions(pendingExpressions))]), pendingExpressions = []), pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression))) } var pendingExpressions = []; return visit(node.left), visit(node.right), ts.inlineExpressions(pendingExpressions) } function visitConditionalExpression(node) { if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) { var whenFalseLabel = defineLabel(), resultLabel = defineLabel(), resultLocal = declareLocal(); return emitBreakWhenFalse(whenFalseLabel, ts.visitNode(node.condition, visitor, ts.isExpression), node.condition), emitAssignment(resultLocal, ts.visitNode(node.whenTrue, visitor, ts.isExpression), node.whenTrue), emitBreak(resultLabel), markLabel(whenFalseLabel), emitAssignment(resultLocal, ts.visitNode(node.whenFalse, visitor, ts.isExpression), node.whenFalse), markLabel(resultLabel), resultLocal } return ts.visitEachChild(node, visitor, context) } function visitYieldExpression(node) { var resumeLabel = defineLabel(), expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (node.asteriskToken) { var iterator = 0 === (8388608 & ts.getEmitFlags(node.expression)) ? ts.createValuesHelper(context, expression, node) : expression; emitYieldStar(iterator, node) } else emitYield(expression, node); return markLabel(resumeLabel), createGeneratorResume(node) } function visitArrayLiteralExpression(node) { return visitElements(node.elements, void 0, void 0, node.multiLine) } function visitElements(elements, leadingElement, location, multiLine) { function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { var hasAssignedTemp = void 0 !== temp; temp || (temp = declareLocal()), emitAssignment(temp, hasAssignedTemp ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine)), leadingElement = void 0, expressions = [] } return expressions.push(ts.visitNode(element, visitor, ts.isExpression)), expressions } var temp, numInitialElements = countInitialNodesWithoutYield(elements); if (numInitialElements > 0) { temp = declareLocal(); var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); emitAssignment(temp, ts.createArrayLiteral(leadingElement ? [leadingElement].concat(initialElements) : initialElements)), leadingElement = void 0 } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); return temp ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) : ts.setTextRange(ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine), location) } function visitObjectLiteralExpression(node) { function reduceProperty(expressions, property) { containsYield(property) && expressions.length > 0 && (emitStatement(ts.createStatement(ts.inlineExpressions(expressions))), expressions = []); var expression = ts.createExpressionForObjectLiteralElementLike(node, property, temp), visited = ts.visitNode(expression, visitor, ts.isExpression); return visited && (multiLine && ts.startOnNewLine(visited), expressions.push(visited)), expressions } var properties = node.properties, multiLine = node.multiLine, numInitialProperties = countInitialNodesWithoutYield(properties), temp = declareLocal(); emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), multiLine)); var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties); return expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp), ts.inlineExpressions(expressions) } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { var clone_5 = ts.getMutableClone(node); return clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)), clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression), clone_5 } return ts.visitEachChild(node, visitor, context) } function visitCallExpression(node) { if (!ts.isImportCall(node) && ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, !0), target = _a.target, thisArg = _a.thisArg; return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments), node), node) } return ts.visitEachChild(node, visitor, context) } function visitNewExpression(node) { if (ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; return ts.setOriginalNode(ts.setTextRange(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), void 0, []), node), node) } return ts.visitEachChild(node, visitor, context) } function transformAndEmitStatements(statements, start) { void 0 === start && (start = 0); for (var numStatements = statements.length, i = start; i < numStatements; i++)transformAndEmitStatement(statements[i]) } function transformAndEmitEmbeddedStatement(node) { ts.isBlock(node) ? transformAndEmitStatements(node.statements) : transformAndEmitStatement(node) } function transformAndEmitStatement(node) { var savedInStatementContainingYield = inStatementContainingYield; inStatementContainingYield || (inStatementContainingYield = containsYield(node)), transformAndEmitStatementWorker(node), inStatementContainingYield = savedInStatementContainingYield } function transformAndEmitStatementWorker(node) { switch (node.kind) { case 212: return transformAndEmitBlock(node); case 215: return transformAndEmitExpressionStatement(node); case 216: return transformAndEmitIfStatement(node); case 217: return transformAndEmitDoStatement(node); case 218: return transformAndEmitWhileStatement(node); case 219: return transformAndEmitForStatement(node); case 220: return transformAndEmitForInStatement(node); case 222: return transformAndEmitContinueStatement(node); case 223: return transformAndEmitBreakStatement(node); case 224: return transformAndEmitReturnStatement(node); case 225: return transformAndEmitWithStatement(node); case 226: return transformAndEmitSwitchStatement(node); case 227: return transformAndEmitLabeledStatement(node); case 228: return transformAndEmitThrowStatement(node); case 229: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } } function transformAndEmitBlock(node) { containsYield(node) ? transformAndEmitStatements(node.statements) : emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function transformAndEmitExpressionStatement(node) { emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i], name = ts.getSynthesizedClone(variable.name); ts.setCommentRange(name, variable.name), hoistVariableDeclaration(name) } for (var variables = ts.getInitializedVariables(node), numVariables = variables.length, variablesWritten = 0, pendingExpressions = []; variablesWritten < numVariables;) { for (var i = variablesWritten; i < numVariables; i++) { var variable = variables[i]; if (containsYield(variable.initializer) && pendingExpressions.length > 0) break; pendingExpressions.push(transformInitializedVariable(variable)) } pendingExpressions.length && (emitStatement(ts.createStatement(ts.inlineExpressions(pendingExpressions))), variablesWritten += pendingExpressions.length, pendingExpressions = []) } } function transformInitializedVariable(node) { return ts.setSourceMapRange(ts.createAssignment(ts.setSourceMapRange(ts.getSynthesizedClone(node.name), node.name), ts.visitNode(node.initializer, visitor, ts.isExpression)), node) } function transformAndEmitIfStatement(node) { if (containsYield(node)) if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(), elseLabel = node.elseStatement ? defineLabel() : void 0; emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression), transformAndEmitEmbeddedStatement(node.thenStatement), node.elseStatement && (emitBreak(endLabel), markLabel(elseLabel), transformAndEmitEmbeddedStatement(node.elseStatement)), markLabel(endLabel) } else emitStatement(ts.visitNode(node, visitor, ts.isStatement)); else emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function transformAndEmitDoStatement(node) { if (containsYield(node)) { var conditionLabel = defineLabel(), loopLabel = defineLabel(); beginLoopBlock(conditionLabel), markLabel(loopLabel), transformAndEmitEmbeddedStatement(node.statement), markLabel(conditionLabel), emitBreakWhenTrue(loopLabel, ts.visitNode(node.expression, visitor, ts.isExpression)), endLoopBlock() } else emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function visitDoStatement(node) { return inStatementContainingYield ? (beginScriptLoopBlock(), node = ts.visitEachChild(node, visitor, context), endLoopBlock(), node) : ts.visitEachChild(node, visitor, context) } function transformAndEmitWhileStatement(node) { if (containsYield(node)) { var loopLabel = defineLabel(), endLabel = beginLoopBlock(loopLabel); markLabel(loopLabel), emitBreakWhenFalse(endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)), transformAndEmitEmbeddedStatement(node.statement), emitBreak(loopLabel), endLoopBlock() } else emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function visitWhileStatement(node) { return inStatementContainingYield ? (beginScriptLoopBlock(), node = ts.visitEachChild(node, visitor, context), endLoopBlock(), node) : ts.visitEachChild(node, visitor, context) } function transformAndEmitForStatement(node) { if (containsYield(node)) { var conditionLabel = defineLabel(), incrementLabel = defineLabel(), endLabel = beginLoopBlock(incrementLabel); if (node.initializer) { var initializer = node.initializer; ts.isVariableDeclarationList(initializer) ? transformAndEmitVariableDeclarationList(initializer) : emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer)) } markLabel(conditionLabel), node.condition && emitBreakWhenFalse(endLabel, ts.visitNode(node.condition, visitor, ts.isExpression)), transformAndEmitEmbeddedStatement(node.statement), markLabel(incrementLabel), node.incrementor && emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor)), emitBreak(conditionLabel), endLoopBlock() } else emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function visitForStatement(node) { inStatementContainingYield && beginScriptLoopBlock(); var initializer = node.initializer; if (initializer && ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name) } var variables = ts.getInitializedVariables(initializer); node = ts.updateFor(node, variables.length > 0 ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable)) : void 0, ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)) } else node = ts.visitEachChild(node, visitor, context); return inStatementContainingYield && endLoopBlock(), node } function transformAndEmitForInStatement(node) { if (containsYield(node)) { var keysArray = declareLocal(), key = declareLocal(), keysIndex = ts.createLoopVariable(), initializer = node.initializer; hoistVariableDeclaration(keysIndex), emitAssignment(keysArray, ts.createArrayLiteral()), emitStatement(ts.createForIn(key, ts.visitNode(node.expression, visitor, ts.isExpression), ts.createStatement(ts.createCall(ts.createPropertyAccess(keysArray, "push"), void 0, [key])))), emitAssignment(keysIndex, ts.createLiteral(0)); var conditionLabel = defineLabel(), incrementLabel = defineLabel(), endLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel), emitBreakWhenFalse(endLabel, ts.createLessThan(keysIndex, ts.createPropertyAccess(keysArray, "length"))); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable_1 = _a[_i]; hoistVariableDeclaration(variable_1.name) } variable = ts.getSynthesizedClone(initializer.declarations[0].name) } else variable = ts.visitNode(initializer, visitor, ts.isExpression), ts.Debug.assert(ts.isLeftHandSideExpression(variable)); emitAssignment(variable, ts.createElementAccess(keysArray, keysIndex)), transformAndEmitEmbeddedStatement(node.statement), markLabel(incrementLabel), emitStatement(ts.createStatement(ts.createPostfixIncrement(keysIndex))), emitBreak(conditionLabel), endLoopBlock() } else emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function visitForInStatement(node) { inStatementContainingYield && beginScriptLoopBlock(); var initializer = node.initializer; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name) } node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)) } else node = ts.visitEachChild(node, visitor, context); return inStatementContainingYield && endLoopBlock(), node } function transformAndEmitContinueStatement(node) { var label = findContinueTarget(node.label ? ts.idText(node.label) : void 0); label > 0 ? emitBreak(label, node) : emitStatement(node) } function visitContinueStatement(node) { if (inStatementContainingYield) { var label = findContinueTarget(node.label && ts.idText(node.label)); if (label > 0) return createInlineBreak(label, node) } return ts.visitEachChild(node, visitor, context) } function transformAndEmitBreakStatement(node) { var label = findBreakTarget(node.label ? ts.idText(node.label) : void 0); label > 0 ? emitBreak(label, node) : emitStatement(node) } function visitBreakStatement(node) { if (inStatementContainingYield) { var label = findBreakTarget(node.label && ts.idText(node.label)); if (label > 0) return createInlineBreak(label, node) } return ts.visitEachChild(node, visitor, context) } function transformAndEmitReturnStatement(node) { emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node) } function visitReturnStatement(node) { return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node) } function transformAndEmitWithStatement(node) { containsYield(node) ? (beginWithBlock(cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression))), transformAndEmitEmbeddedStatement(node.statement), endWithBlock()) : emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function transformAndEmitSwitchStatement(node) { if (containsYield(node.caseBlock)) { for (var caseBlock = node.caseBlock, numClauses = caseBlock.clauses.length, endLabel = beginSwitchBlock(), expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression)), clauseLabels = [], defaultClauseIndex = -1, i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()), 266 === clause.kind && defaultClauseIndex === -1 && (defaultClauseIndex = i) } for (var clausesWritten = 0, pendingClauses = []; clausesWritten < numClauses;) { for (var defaultClausesSkipped = 0, i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; if (265 === clause.kind) { if (containsYield(clause.expression) && pendingClauses.length > 0) break; pendingClauses.push(ts.createCaseClause(ts.visitNode(clause.expression, visitor, ts.isExpression), [createInlineBreak(clauseLabels[i], clause.expression)])) } else defaultClausesSkipped++ } pendingClauses.length && (emitStatement(ts.createSwitch(expression, ts.createCaseBlock(pendingClauses))), clausesWritten += pendingClauses.length, pendingClauses = []), defaultClausesSkipped > 0 && (clausesWritten += defaultClausesSkipped, defaultClausesSkipped = 0) } emitBreak(defaultClauseIndex >= 0 ? clauseLabels[defaultClauseIndex] : endLabel); for (var i = 0; i < numClauses; i++)markLabel(clauseLabels[i]), transformAndEmitStatements(caseBlock.clauses[i].statements); endSwitchBlock() } else emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function visitSwitchStatement(node) { return inStatementContainingYield && beginScriptSwitchBlock(), node = ts.visitEachChild(node, visitor, context), inStatementContainingYield && endSwitchBlock(), node } function transformAndEmitLabeledStatement(node) { containsYield(node) ? (beginLabeledBlock(ts.idText(node.label)), transformAndEmitEmbeddedStatement(node.statement), endLabeledBlock()) : emitStatement(ts.visitNode(node, visitor, ts.isStatement)) } function visitLabeledStatement(node) { return inStatementContainingYield && beginScriptLabeledBlock(ts.idText(node.label)), node = ts.visitEachChild(node, visitor, context), inStatementContainingYield && endLabeledBlock(), node } function transformAndEmitThrowStatement(node) { emitThrow(ts.visitNode(node.expression, visitor, ts.isExpression), node) } function transformAndEmitTryStatement(node) { containsYield(node) ? (beginExceptionBlock(), transformAndEmitEmbeddedStatement(node.tryBlock), node.catchClause && (beginCatchBlock(node.catchClause.variableDeclaration), transformAndEmitEmbeddedStatement(node.catchClause.block)), node.finallyBlock && (beginFinallyBlock(), transformAndEmitEmbeddedStatement(node.finallyBlock)), endExceptionBlock()) : emitStatement(ts.visitEachChild(node, visitor, context)) } function containsYield(node) { return node && 0 !== (16777216 & node.transformFlags) } function countInitialNodesWithoutYield(nodes) { for (var numNodes = nodes.length, i = 0; i < numNodes; i++)if (containsYield(nodes[i])) return i; return -1 } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), 1 === hint ? substituteExpression(node) : node } function substituteExpression(node) { return ts.isIdentifier(node) ? substituteExpressionIdentifier(node) : node } function substituteExpressionIdentifier(node) { if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(ts.idText(node))) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; if (name) { var clone_6 = ts.getMutableClone(name); return ts.setSourceMapRange(clone_6, node), ts.setCommentRange(clone_6, node), clone_6 } } } } return node } function cacheExpression(node) { var temp; return ts.isGeneratedIdentifier(node) || 4096 & ts.getEmitFlags(node) ? node : (temp = ts.createTempVariable(hoistVariableDeclaration), emitAssignment(temp, node, node), temp) } function declareLocal(name) { var temp = name ? ts.createUniqueName(name) : ts.createTempVariable(void 0); return hoistVariableDeclaration(temp), temp } function defineLabel() { labelOffsets || (labelOffsets = []); var label = nextLabelId; return nextLabelId++ , labelOffsets[label] = -1, label } function markLabel(label) { ts.Debug.assert(void 0 !== labelOffsets, "No labels were defined."), labelOffsets[label] = operations ? operations.length : 0 } function beginBlock(block) { blocks || (blocks = [], blockActions = [], blockOffsets = [], blockStack = []); var index = blockActions.length; return blockActions[index] = 0, blockOffsets[index] = operations ? operations.length : 0, blocks[index] = block, blockStack.push(block), index } function endBlock() { var block = peekBlock(); ts.Debug.assert(void 0 !== block, "beginBlock was never called."); var index = blockActions.length; return blockActions[index] = 1, blockOffsets[index] = operations ? operations.length : 0, blocks[index] = block, blockStack.pop(), block } function peekBlock() { return ts.lastOrUndefined(blockStack) } function peekBlockKind() { var block = peekBlock(); return block && block.kind } function beginWithBlock(expression) { var startLabel = defineLabel(), endLabel = defineLabel(); markLabel(startLabel), beginBlock({ kind: 1, expression: expression, startLabel: startLabel, endLabel: endLabel }) } function endWithBlock() { ts.Debug.assert(1 === peekBlockKind()); var block = endBlock(); markLabel(block.endLabel) } function beginExceptionBlock() { var startLabel = defineLabel(), endLabel = defineLabel(); return markLabel(startLabel), beginBlock({ kind: 0, state: 0, startLabel: startLabel, endLabel: endLabel }), emitNop(), endLabel } function beginCatchBlock(variable) { ts.Debug.assert(0 === peekBlockKind()); var name; if (ts.isGeneratedIdentifier(variable.name)) name = variable.name, hoistVariableDeclaration(variable.name); else { var text = ts.idText(variable.name); name = declareLocal(text), renamedCatchVariables || (renamedCatchVariables = ts.createMap(), renamedCatchVariableDeclarations = [], context.enableSubstitution(71)), renamedCatchVariables.set(text, !0), renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name } var exception = peekBlock(); ts.Debug.assert(exception.state < 1); var endLabel = exception.endLabel; emitBreak(endLabel); var catchLabel = defineLabel(); markLabel(catchLabel), exception.state = 1, exception.catchVariable = name, exception.catchLabel = catchLabel, emitAssignment(name, ts.createCall(ts.createPropertyAccess(state, "sent"), void 0, [])), emitNop() } function beginFinallyBlock() { ts.Debug.assert(0 === peekBlockKind()); var exception = peekBlock(); ts.Debug.assert(exception.state < 2); var endLabel = exception.endLabel; emitBreak(endLabel); var finallyLabel = defineLabel(); markLabel(finallyLabel), exception.state = 2, exception.finallyLabel = finallyLabel } function endExceptionBlock() { ts.Debug.assert(0 === peekBlockKind()); var exception = endBlock(), state = exception.state; state < 2 ? emitBreak(exception.endLabel) : emitEndfinally(), markLabel(exception.endLabel), emitNop(), exception.state = 3 } function beginScriptLoopBlock() { beginBlock({ kind: 3, isScript: !0, breakLabel: -1, continueLabel: -1 }) } function beginLoopBlock(continueLabel) { var breakLabel = defineLabel(); return beginBlock({ kind: 3, isScript: !1, breakLabel: breakLabel, continueLabel: continueLabel }), breakLabel } function endLoopBlock() { ts.Debug.assert(3 === peekBlockKind()); var block = endBlock(), breakLabel = block.breakLabel; block.isScript || markLabel(breakLabel) } function beginScriptSwitchBlock() { beginBlock({ kind: 2, isScript: !0, breakLabel: -1 }) } function beginSwitchBlock() { var breakLabel = defineLabel(); return beginBlock({ kind: 2, isScript: !1, breakLabel: breakLabel }), breakLabel } function endSwitchBlock() { ts.Debug.assert(2 === peekBlockKind()); var block = endBlock(), breakLabel = block.breakLabel; block.isScript || markLabel(breakLabel) } function beginScriptLabeledBlock(labelText) { beginBlock({ kind: 4, isScript: !0, labelText: labelText, breakLabel: -1 }) } function beginLabeledBlock(labelText) { var breakLabel = defineLabel(); beginBlock({ kind: 4, isScript: !1, labelText: labelText, breakLabel: breakLabel }) } function endLabeledBlock() { ts.Debug.assert(4 === peekBlockKind()); var block = endBlock(); block.isScript || markLabel(block.breakLabel) } function supportsUnlabeledBreak(block) { return 2 === block.kind || 3 === block.kind } function supportsLabeledBreakOrContinue(block) { return 4 === block.kind } function supportsUnlabeledContinue(block) { return 3 === block.kind } function hasImmediateContainingLabeledBlock(labelText, start) { for (var j = start; j >= 0; j--) { var containingBlock = blockStack[j]; if (!supportsLabeledBreakOrContinue(containingBlock)) break; if (containingBlock.labelText === labelText) return !0 } return !1 } function findBreakTarget(labelText) { if (blockStack) if (labelText) for (var i = blockStack.length - 1; i >= 0; i--) { var block = blockStack[i]; if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) return block.breakLabel; if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) return block.breakLabel } else for (var i = blockStack.length - 1; i >= 0; i--) { var block = blockStack[i]; if (supportsUnlabeledBreak(block)) return block.breakLabel } return 0 } function findContinueTarget(labelText) { if (blockStack) if (labelText) for (var i = blockStack.length - 1; i >= 0; i--) { var block = blockStack[i]; if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) return block.continueLabel } else for (var i = blockStack.length - 1; i >= 0; i--) { var block = blockStack[i]; if (supportsUnlabeledContinue(block)) return block.continueLabel } return 0 } function createLabel(label) { if (label > 0) { void 0 === labelExpressions && (labelExpressions = []); var expression = ts.createLiteral(-1); return void 0 === labelExpressions[label] ? labelExpressions[label] = [expression] : labelExpressions[label].push(expression), expression } return ts.createOmittedExpression() } function createInstruction(instruction) { var literal = ts.createLiteral(instruction); return ts.addSyntheticTrailingComment(literal, 3, getInstructionName(instruction)), literal } function createInlineBreak(label, location) { return ts.Debug.assertLessThan(0, label, "Invalid label"), ts.setTextRange(ts.createReturn(ts.createArrayLiteral([createInstruction(3), createLabel(label)])), location) } function createInlineReturn(expression, location) { return ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] : [createInstruction(2)])), location) } function createGeneratorResume(location) { return ts.setTextRange(ts.createCall(ts.createPropertyAccess(state, "sent"), void 0, []), location) } function emitNop() { emitWorker(0) } function emitStatement(node) { node ? emitWorker(1, [node]) : emitNop() } function emitAssignment(left, right, location) { emitWorker(2, [left, right], location) } function emitBreak(label, location) { emitWorker(3, [label], location) } function emitBreakWhenTrue(label, condition, location) { emitWorker(4, [label, condition], location) } function emitBreakWhenFalse(label, condition, location) { emitWorker(5, [label, condition], location) } function emitYieldStar(expression, location) { emitWorker(7, [expression], location) } function emitYield(expression, location) { emitWorker(6, [expression], location) } function emitReturn(expression, location) { emitWorker(8, [expression], location) } function emitThrow(expression, location) { emitWorker(9, [expression], location) } function emitEndfinally() { emitWorker(10) } function emitWorker(code, args, location) { void 0 === operations && (operations = [], operationArguments = [], operationLocations = []), void 0 === labelOffsets && markLabel(defineLabel()); var operationIndex = operations.length; operations[operationIndex] = code, operationArguments[operationIndex] = args, operationLocations[operationIndex] = location } function build() { blockIndex = 0, labelNumber = 0, labelNumbers = void 0, lastOperationWasAbrupt = !1, lastOperationWasCompletion = !1, clauses = void 0, statements = void 0, exceptionBlockStack = void 0, currentExceptionBlock = void 0, withBlockStack = void 0; var buildResult = buildStatements(); return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, state)], void 0, ts.createBlock(buildResult, buildResult.length > 0)), 524288)) } function buildStatements() { if (operations) { for (var operationIndex = 0; operationIndex < operations.length; operationIndex++)writeOperation(operationIndex); flushFinalLabel(operations.length) } else flushFinalLabel(0); if (clauses) { var labelExpression = ts.createPropertyAccess(state, "label"), switchStatement = ts.createSwitch(labelExpression, ts.createCaseBlock(clauses)); return [ts.startOnNewLine(switchStatement)] } return statements ? statements : [] } function flushLabel() { statements && (appendLabel(!lastOperationWasAbrupt), lastOperationWasAbrupt = !1, lastOperationWasCompletion = !1, labelNumber++) } function flushFinalLabel(operationIndex) { isFinalLabelReachable(operationIndex) && (tryEnterLabel(operationIndex), withBlockStack = void 0, writeReturn(void 0, void 0)), statements && clauses && appendLabel(!1), updateLabelExpressions() } function isFinalLabelReachable(operationIndex) { if (!lastOperationWasCompletion) return !0; if (!labelOffsets || !labelExpressions) return !1; for (var label = 0; label < labelOffsets.length; label++)if (labelOffsets[label] === operationIndex && labelExpressions[label]) return !0; return !1 } function appendLabel(markLabelEnd) { if (clauses || (clauses = []), statements) { if (withBlockStack) for (var i = withBlockStack.length - 1; i >= 0; i--) { var withBlock = withBlockStack[i]; statements = [ts.createWith(withBlock.expression, ts.createBlock(statements))] } if (currentExceptionBlock) { var startLabel = currentExceptionBlock.startLabel, catchLabel = currentExceptionBlock.catchLabel, finallyLabel = currentExceptionBlock.finallyLabel, endLabel = currentExceptionBlock.endLabel; statements.unshift(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createPropertyAccess(state, "trys"), "push"), void 0, [ts.createArrayLiteral([createLabel(startLabel), createLabel(catchLabel), createLabel(finallyLabel), createLabel(endLabel)])]))), currentExceptionBlock = void 0 } markLabelEnd && statements.push(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(state, "label"), ts.createLiteral(labelNumber + 1)))) } clauses.push(ts.createCaseClause(ts.createLiteral(labelNumber), statements || [])), statements = void 0 } function tryEnterLabel(operationIndex) { if (labelOffsets) for (var label = 0; label < labelOffsets.length; label++)labelOffsets[label] === operationIndex && (flushLabel(), void 0 === labelNumbers && (labelNumbers = []), void 0 === labelNumbers[labelNumber] ? labelNumbers[labelNumber] = [label] : labelNumbers[labelNumber].push(label)) } function updateLabelExpressions() { if (void 0 !== labelExpressions && void 0 !== labelNumbers) for (var labelNumber_1 = 0; labelNumber_1 < labelNumbers.length; labelNumber_1++) { var labels = labelNumbers[labelNumber_1]; if (void 0 !== labels) for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) { var label = labels_1[_i], expressions = labelExpressions[label]; if (void 0 !== expressions) for (var _a = 0, expressions_1 = expressions; _a < expressions_1.length; _a++) { var expression = expressions_1[_a]; expression.text = String(labelNumber_1) } } } } function tryEnterOrLeaveBlock(operationIndex) { if (blocks) for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) { var block = blocks[blockIndex], blockAction = blockActions[blockIndex]; switch (block.kind) { case 0: 0 === blockAction ? (exceptionBlockStack || (exceptionBlockStack = []), statements || (statements = []), exceptionBlockStack.push(currentExceptionBlock), currentExceptionBlock = block) : 1 === blockAction && (currentExceptionBlock = exceptionBlockStack.pop()); break; case 1: 0 === blockAction ? (withBlockStack || (withBlockStack = []), withBlockStack.push(block)) : 1 === blockAction && withBlockStack.pop() } } } function writeOperation(operationIndex) { if (tryEnterLabel(operationIndex), tryEnterOrLeaveBlock(operationIndex), !lastOperationWasAbrupt) { lastOperationWasAbrupt = !1, lastOperationWasCompletion = !1; var opcode = operations[operationIndex]; if (0 !== opcode) { if (10 === opcode) return writeEndfinally(); var args = operationArguments[operationIndex]; if (1 === opcode) return writeStatement(args[0]); var location = operationLocations[operationIndex]; switch (opcode) { case 2: return writeAssign(args[0], args[1], location); case 3: return writeBreak(args[0], location); case 4: return writeBreakWhenTrue(args[0], args[1], location); case 5: return writeBreakWhenFalse(args[0], args[1], location); case 6: return writeYield(args[0], location); case 7: return writeYieldStar(args[0], location); case 8: return writeReturn(args[0], location); case 9: return writeThrow(args[0], location) } } } } function writeStatement(statement) { statement && (statements ? statements.push(statement) : statements = [statement]) } function writeAssign(left, right, operationLocation) { writeStatement(ts.setTextRange(ts.createStatement(ts.createAssignment(left, right)), operationLocation)) } function writeThrow(expression, operationLocation) { lastOperationWasAbrupt = !0, lastOperationWasCompletion = !0, writeStatement(ts.setTextRange(ts.createThrow(expression), operationLocation)) } function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = !0, lastOperationWasCompletion = !0, writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] : [createInstruction(2)])), operationLocation), 384)) } function writeBreak(label, operationLocation) { lastOperationWasAbrupt = !0, writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([createInstruction(3), createLabel(label)])), operationLocation), 384)) } function writeBreakWhenTrue(label, condition, operationLocation) { writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([createInstruction(3), createLabel(label)])), operationLocation), 384)), 1)) } function writeBreakWhenFalse(label, condition, operationLocation) { writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([createInstruction(3), createLabel(label)])), operationLocation), 384)), 1)) } function writeYield(expression, operationLocation) { lastOperationWasAbrupt = !0, writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4), expression] : [createInstruction(4)])), operationLocation), 384)) } function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = !0, writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([createInstruction(5), expression])), operationLocation), 384)) } function writeEndfinally() { lastOperationWasAbrupt = !0, writeStatement(ts.createReturn(ts.createArrayLiteral([createInstruction(7)]))) } var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration, compilerOptions = context.getCompilerOptions(), languageVersion = ts.getEmitScriptTarget(compilerOptions), resolver = context.getEmitResolver(), previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var renamedCatchVariables, renamedCatchVariableDeclarations, inGeneratorFunctionBody, inStatementContainingYield, blocks, blockOffsets, blockActions, blockStack, labelOffsets, labelExpressions, operations, operationArguments, operationLocations, state, labelNumbers, lastOperationWasAbrupt, lastOperationWasCompletion, clauses, statements, exceptionBlockStack, currentExceptionBlock, withBlockStack, nextLabelId = 1, blockIndex = 0, labelNumber = 0; return ts.chainBundle(transformSourceFile) } function createGeneratorHelper(context, body) { return context.requestEmitHelper(generatorHelper), ts.createCall(ts.getHelperName("__generator"), void 0, [ts.createThis(), body]) } var OpCode; !function (OpCode) { OpCode[OpCode.Nop = 0] = "Nop", OpCode[OpCode.Statement = 1] = "Statement", OpCode[OpCode.Assign = 2] = "Assign", OpCode[OpCode.Break = 3] = "Break", OpCode[OpCode.BreakWhenTrue = 4] = "BreakWhenTrue", OpCode[OpCode.BreakWhenFalse = 5] = "BreakWhenFalse", OpCode[OpCode.Yield = 6] = "Yield", OpCode[OpCode.YieldStar = 7] = "YieldStar", OpCode[OpCode.Return = 8] = "Return", OpCode[OpCode.Throw = 9] = "Throw", OpCode[OpCode.Endfinally = 10] = "Endfinally" }(OpCode || (OpCode = {})); var BlockAction; !function (BlockAction) { BlockAction[BlockAction.Open = 0] = "Open", BlockAction[BlockAction.Close = 1] = "Close" }(BlockAction || (BlockAction = {})); var CodeBlockKind; !function (CodeBlockKind) { CodeBlockKind[CodeBlockKind.Exception = 0] = "Exception", CodeBlockKind[CodeBlockKind.With = 1] = "With", CodeBlockKind[CodeBlockKind.Switch = 2] = "Switch", CodeBlockKind[CodeBlockKind.Loop = 3] = "Loop", CodeBlockKind[CodeBlockKind.Labeled = 4] = "Labeled" }(CodeBlockKind || (CodeBlockKind = {})); var ExceptionBlockState; !function (ExceptionBlockState) { ExceptionBlockState[ExceptionBlockState.Try = 0] = "Try", ExceptionBlockState[ExceptionBlockState.Catch = 1] = "Catch", ExceptionBlockState[ExceptionBlockState.Finally = 2] = "Finally", ExceptionBlockState[ExceptionBlockState.Done = 3] = "Done" }(ExceptionBlockState || (ExceptionBlockState = {})); var Instruction; !function (Instruction) { Instruction[Instruction.Next = 0] = "Next", Instruction[Instruction.Throw = 1] = "Throw", Instruction[Instruction.Return = 2] = "Return", Instruction[Instruction.Break = 3] = "Break", Instruction[Instruction.Yield = 4] = "Yield", Instruction[Instruction.YieldStar = 5] = "YieldStar", Instruction[Instruction.Catch = 6] = "Catch", Instruction[Instruction.Endfinally = 7] = "Endfinally" }(Instruction || (Instruction = {})), ts.transformGenerators = transformGenerators; var generatorHelper = { name: "typescript:generator", scoped: !1, priority: 6, text: '\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };' } }(ts || (ts = {})); var ts; !function (ts) { function transformModule(context) { function getTransformModuleDelegate(moduleKind) { switch (moduleKind) { case ts.ModuleKind.AMD: return transformAMDModule; case ts.ModuleKind.UMD: return transformUMDModule; default: return transformCommonJSModule } } function transformSourceFile(node) { if (node.isDeclarationFile || !(ts.isEffectiveExternalModule(node, compilerOptions) || 67108864 & node.transformFlags)) return node; currentSourceFile = node, currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions), moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; var transformModule = getTransformModuleDelegate(moduleKind), updated = transformModule(node); return currentSourceFile = void 0, currentModuleInfo = void 0, needUMDDynamicImportHelper = !1, ts.aggregateTransformFlags(updated) } function shouldEmitUnderscoreUnderscoreESModule() { return !(currentModuleInfo.exportEquals || !ts.isExternalModule(currentSourceFile)) } function transformCommonJSModule(node) { startLexicalEnvironment(); var statements = [], ensureUseStrict = ts.getStrictOptionValue(compilerOptions, "alwaysStrict") || !compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile), statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); shouldEmitUnderscoreUnderscoreESModule() && ts.append(statements, createUnderscoreUnderscoreESModule()), ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)), ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)), addExportEqualsIfNeeded(statements, !1), ts.prependStatements(statements, endLexicalEnvironment()); var updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); return currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers && ts.addEmitHelper(updated, exportStarHelper), ts.addEmitHelpers(updated, context.readEmitHelpers()), updated } function transformAMDModule(node) { var define = ts.createIdentifier("define"), moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions), _a = collectAsynchronousDependencies(node, !0), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames, updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createCall(define, void 0, (moduleName ? [moduleName] : []).concat([ts.createArrayLiteral([ts.createLiteral("require"), ts.createLiteral("exports")].concat(aliasedModuleNames, unaliasedModuleNames)), ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, "require"), ts.createParameter(void 0, void 0, void 0, "exports")].concat(importAliasNames), void 0, transformAsynchronousModuleBody(node))])))]), node.statements)); return ts.addEmitHelpers(updated, context.readEmitHelpers()), updated } function transformUMDModule(node) { var _a = collectAsynchronousDependencies(node, !1), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames, moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions), umdHeader = ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, "factory")], void 0, ts.setTextRange(ts.createBlock([ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ts.createVariableStatement(void 0, [ts.createVariableDeclaration("v", void 0, ts.createCall(ts.createIdentifier("factory"), void 0, [ts.createIdentifier("require"), ts.createIdentifier("exports")]))]), ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1)]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ts.createStatement(ts.createCall(ts.createIdentifier("define"), void 0, (moduleName ? [moduleName] : []).concat([ts.createArrayLiteral([ts.createLiteral("require"), ts.createLiteral("exports")].concat(aliasedModuleNames, unaliasedModuleNames)), ts.createIdentifier("factory")])))])))], !0), void 0)), updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createCall(umdHeader, void 0, [ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, "require"), ts.createParameter(void 0, void 0, void 0, "exports")].concat(importAliasNames), void 0, transformAsynchronousModuleBody(node))]))]), node.statements)); return ts.addEmitHelpers(updated, context.readEmitHelpers()), updated } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { for (var aliasedModuleNames = [], unaliasedModuleNames = [], importAliasNames = [], _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { var amdDependency = _a[_i]; amdDependency.name ? (aliasedModuleNames.push(ts.createLiteral(amdDependency.path)), importAliasNames.push(ts.createParameter(void 0, void 0, void 0, amdDependency.name))) : unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)) } for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { var importNode = _c[_b], externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions), importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); externalModuleName && (includeNonAmdDependencies && importAliasName ? (ts.setEmitFlags(importAliasName, 4), aliasedModuleNames.push(externalModuleName), importAliasNames.push(ts.createParameter(void 0, void 0, void 0, importAliasName))) : unaliasedModuleNames.push(externalModuleName)) } return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames } } function getAMDImportExpressionForImport(node) { if (!ts.isImportEqualsDeclaration(node) && !ts.isExportDeclaration(node) && ts.getExternalModuleNameLiteral(node, currentSourceFile, host, resolver, compilerOptions)) { var name = ts.getLocalNameForExternalImport(node, currentSourceFile), expr = getHelperExpressionForImport(node, name); if (expr !== name) return ts.createStatement(ts.createAssignment(name, expr)) } } function transformAsynchronousModuleBody(node) { startLexicalEnvironment(); var statements = [], statementOffset = ts.addPrologue(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); shouldEmitUnderscoreUnderscoreESModule() && ts.append(statements, createUnderscoreUnderscoreESModule()), ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)), moduleKind === ts.ModuleKind.AMD && ts.addRange(statements, ts.mapDefined(currentModuleInfo.externalImports, getAMDImportExpressionForImport)), ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)), addExportEqualsIfNeeded(statements, !0), ts.prependStatements(statements, endLexicalEnvironment()); var body = ts.createBlock(statements, !0); return currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers && ts.addEmitHelper(body, exportStarHelper), needUMDDynamicImportHelper && ts.addEmitHelper(body, dynamicImportUMDHelper), body } function addExportEqualsIfNeeded(statements, emitAsReturn) { if (currentModuleInfo.exportEquals) { var expressionResult = ts.visitNode(currentModuleInfo.exportEquals.expression, moduleExpressionElementVisitor); if (expressionResult) if (emitAsReturn) { var statement = ts.createReturn(expressionResult); ts.setTextRange(statement, currentModuleInfo.exportEquals), ts.setEmitFlags(statement, 1920), statements.push(statement) } else { var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), expressionResult)); ts.setTextRange(statement, currentModuleInfo.exportEquals), ts.setEmitFlags(statement, 1536), statements.push(statement) } } } function sourceElementVisitor(node) { switch (node.kind) { case 243: return visitImportDeclaration(node); case 242: return visitImportEqualsDeclaration(node); case 249: return visitExportDeclaration(node); case 248: return visitExportAssignment(node); case 213: return visitVariableStatement(node); case 233: return visitFunctionDeclaration(node); case 234: return visitClassDeclaration(node); case 302: return visitMergeDeclarationMarker(node); case 303: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, moduleExpressionElementVisitor, context) } } function moduleExpressionElementVisitor(node) { return 67108864 & node.transformFlags || 2048 & node.transformFlags ? ts.isImportCall(node) ? visitImportCallExpression(node) : 1024 & node.transformFlags && ts.isBinaryExpression(node) ? visitDestructuringAssignment(node) : ts.visitEachChild(node, moduleExpressionElementVisitor, context) : node } function destructuringNeedsFlattening(node) { if (ts.isObjectLiteralExpression(node)) for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { case 269: if (destructuringNeedsFlattening(elem.initializer)) return !0; break; case 270: if (destructuringNeedsFlattening(elem.name)) return !0; break; case 271: if (destructuringNeedsFlattening(elem.expression)) return !0; break; case 153: case 155: case 156: return !1; default: ts.Debug.assertNever(elem, "Unhandled object member kind") } } else if (ts.isArrayLiteralExpression(node)) for (var _b = 0, _c = node.elements; _b < _c.length; _b++) { var elem = _c[_b]; if (ts.isSpreadElement(elem)) { if (destructuringNeedsFlattening(elem.expression)) return !0 } else if (destructuringNeedsFlattening(elem)) return !0 } else if (ts.isIdentifier(node)) return ts.length(getExports(node)) > (ts.isExportName(node) ? 1 : 0); return !1 } function visitDestructuringAssignment(node) { return destructuringNeedsFlattening(node.left) ? ts.flattenDestructuringAssignment(node, moduleExpressionElementVisitor, context, 0, !1, createAllExportExpressions) : ts.visitEachChild(node, moduleExpressionElementVisitor, context) } function visitImportCallExpression(node) { var argument = ts.visitNode(ts.firstOrUndefined(node.arguments), moduleExpressionElementVisitor), containsLexicalThis = !!(16384 & node.transformFlags); switch (compilerOptions.module) { case ts.ModuleKind.AMD: return createImportCallExpressionAMD(argument, containsLexicalThis); case ts.ModuleKind.UMD: return createImportCallExpressionUMD(argument, containsLexicalThis); case ts.ModuleKind.CommonJS: default: return createImportCallExpressionCommonJS(argument, containsLexicalThis) } } function createImportCallExpressionUMD(arg, containsLexicalThis) { if (needUMDDynamicImportHelper = !0, ts.isSimpleCopiableExpression(arg)) { var argClone = ts.isGeneratedIdentifier(arg) ? arg : ts.isStringLiteral(arg) ? ts.createLiteral(arg) : ts.setEmitFlags(ts.setTextRange(ts.getSynthesizedClone(arg), arg), 1536); return ts.createConditional(ts.createIdentifier("__syncRequire"), createImportCallExpressionCommonJS(arg, containsLexicalThis), createImportCallExpressionAMD(argClone, containsLexicalThis)) } var temp = ts.createTempVariable(hoistVariableDeclaration); return ts.createComma(ts.createAssignment(temp, arg), ts.createConditional(ts.createIdentifier("__syncRequire"), createImportCallExpressionCommonJS(temp, containsLexicalThis), createImportCallExpressionAMD(temp, containsLexicalThis))) } function createImportCallExpressionAMD(arg, containsLexicalThis) { var func, resolve = ts.createUniqueName("resolve"), reject = ts.createUniqueName("reject"), parameters = [ts.createParameter(void 0, void 0, void 0, resolve), ts.createParameter(void 0, void 0, void 0, reject)], body = ts.createBlock([ts.createStatement(ts.createCall(ts.createIdentifier("require"), void 0, [ts.createArrayLiteral([arg || ts.createOmittedExpression()]), resolve, reject]))]); languageVersion >= 2 ? func = ts.createArrowFunction(void 0, void 0, parameters, void 0, void 0, body) : (func = ts.createFunctionExpression(void 0, void 0, void 0, void 0, parameters, void 0, body), containsLexicalThis && ts.setEmitFlags(func, 8)); var promise = ts.createNew(ts.createIdentifier("Promise"), void 0, [func]); return compilerOptions.esModuleInterop ? (context.requestEmitHelper(importStarHelper), ts.createCall(ts.createPropertyAccess(promise, ts.createIdentifier("then")), void 0, [ts.getHelperName("__importStar")])) : promise } function createImportCallExpressionCommonJS(arg, containsLexicalThis) { var promiseResolveCall = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Promise"), "resolve"), void 0, []), requireCall = ts.createCall(ts.createIdentifier("require"), void 0, arg ? [arg] : []); compilerOptions.esModuleInterop && (context.requestEmitHelper(importStarHelper), requireCall = ts.createCall(ts.getHelperName("__importStar"), void 0, [requireCall])); var func; return languageVersion >= 2 ? func = ts.createArrowFunction(void 0, void 0, [], void 0, void 0, requireCall) : (func = ts.createFunctionExpression(void 0, void 0, void 0, void 0, [], void 0, ts.createBlock([ts.createReturn(requireCall)])), containsLexicalThis && ts.setEmitFlags(func, 8)), ts.createCall(ts.createPropertyAccess(promiseResolveCall, "then"), void 0, [func]) } function getHelperExpressionForImport(node, innerExpr) { return !compilerOptions.esModuleInterop || 67108864 & ts.getEmitFlags(node) ? innerExpr : ts.getImportNeedsImportStarHelper(node) ? (context.requestEmitHelper(importStarHelper), ts.createCall(ts.getHelperName("__importStar"), void 0, [innerExpr])) : ts.getImportNeedsImportDefaultHelper(node) ? (context.requestEmitHelper(importDefaultHelper), ts.createCall(ts.getHelperName("__importDefault"), void 0, [innerExpr])) : innerExpr } function visitImportDeclaration(node) { var statements, namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (moduleKind !== ts.ModuleKind.AMD) { if (!node.importClause) return ts.setTextRange(ts.createStatement(createRequireCall(node)), node); var variables = []; namespaceDeclaration && !ts.isDefaultImport(node) ? variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), void 0, getHelperExpressionForImport(node, createRequireCall(node)))) : (variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), void 0, getHelperExpressionForImport(node, createRequireCall(node)))), namespaceDeclaration && ts.isDefaultImport(node) && variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), void 0, ts.getGeneratedNameForNode(node)))), statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement(void 0, ts.createVariableDeclarationList(variables, languageVersion >= 2 ? 2 : 0)), node)) } else namespaceDeclaration && ts.isDefaultImport(node) && (statements = ts.append(statements, ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.setTextRange(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), void 0, ts.getGeneratedNameForNode(node)), node)], languageVersion >= 2 ? 2 : 0)))); if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node) } else statements = appendExportsOfImportDeclaration(statements, node); return ts.singleOrMany(statements) } function createRequireCall(importNode) { var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions), args = []; return moduleName && args.push(moduleName), ts.createCall(ts.createIdentifier("require"), void 0, args) } function visitImportEqualsDeclaration(node) { ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); var statements; if (moduleKind !== ts.ModuleKind.AMD ? statements = ts.hasModifier(node, 1) ? ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(node.name, createRequireCall(node))), node)) : ts.append(statements, ts.setTextRange(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), void 0, createRequireCall(node))], languageVersion >= 2 ? 2 : 0)), node)) : ts.hasModifier(node, 1) && (statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node))), node))), hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node) } else statements = appendExportsOfImportEqualsDeclaration(statements, node); return ts.singleOrMany(statements) } function visitExportDeclaration(node) { if (node.moduleSpecifier) { var generatedName = ts.getGeneratedNameForNode(node); if (node.exportClause) { var statements = []; moduleKind !== ts.ModuleKind.AMD && statements.push(ts.setTextRange(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(generatedName, void 0, createRequireCall(node))])), node)); for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i], exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); statements.push(ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue)), specifier)) } return ts.singleOrMany(statements) } return ts.setTextRange(ts.createStatement(createExportStarHelper(context, moduleKind !== ts.ModuleKind.AMD ? createRequireCall(node) : generatedName)), node) } } function visitExportAssignment(node) { if (!node.isExportEquals) { var statements, original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), ts.visitNode(node.expression, moduleExpressionElementVisitor), node, !0) } else statements = appendExportStatement(statements, ts.createIdentifier("default"), ts.visitNode(node.expression, moduleExpressionElementVisitor), node, !0); return ts.singleOrMany(statements) } } function visitFunctionDeclaration(node) { var statements; if (statements = ts.hasModifier(node, 1) ? ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, !0, !0), void 0, ts.visitNodes(node.parameters, moduleExpressionElementVisitor), void 0, ts.visitEachChild(node.body, moduleExpressionElementVisitor, context)), node), node)) : ts.append(statements, ts.visitEachChild(node, moduleExpressionElementVisitor, context)), hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node) } else statements = appendExportsOfHoistedDeclaration(statements, node); return ts.singleOrMany(statements) } function visitClassDeclaration(node) { var statements; if (statements = ts.hasModifier(node, 1) ? ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration(void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, !0, !0), void 0, ts.visitNodes(node.heritageClauses, moduleExpressionElementVisitor), ts.visitNodes(node.members, moduleExpressionElementVisitor)), node), node)) : ts.append(statements, ts.visitEachChild(node, moduleExpressionElementVisitor, context)), hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node) } else statements = appendExportsOfHoistedDeclaration(statements, node); return ts.singleOrMany(statements) } function visitVariableStatement(node) { var statements, variables, expressions; if (ts.hasModifier(node, 1)) { for (var modifiers = void 0, _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var variable = _a[_i]; ts.isIdentifier(variable.name) && ts.isLocalName(variable.name) ? (modifiers || (modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier)), variables = ts.append(variables, variable)) : variable.initializer && (expressions = ts.append(expressions, transformInitializedVariable(variable))) } variables && (statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables)))), expressions && (statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node))) } else statements = ts.append(statements, ts.visitEachChild(node, moduleExpressionElementVisitor, context)); if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node) } else statements = appendExportsOfVariableStatement(statements, node); return ts.singleOrMany(statements) } function createAllExportExpressions(name, value, location) { var exportedNames = getExports(name); if (exportedNames) { for (var expression = ts.isExportName(name) ? value : ts.createAssignment(name, value), _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) { var exportName = exportedNames_1[_i]; ts.setEmitFlags(expression, 4), expression = createExportExpression(exportName, expression, location) } return expression } return ts.createAssignment(name, value) } function transformInitializedVariable(node) { return ts.isBindingPattern(node.name) ? ts.flattenDestructuringAssignment(ts.visitNode(node, moduleExpressionElementVisitor), void 0, context, 0, !1, createAllExportExpressions) : ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name), node.name), ts.visitNode(node.initializer, moduleExpressionElementVisitor)) } function visitMergeDeclarationMarker(node) { if (hasAssociatedEndOfDeclarationMarker(node) && 213 === node.original.kind) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original) } return node } function hasAssociatedEndOfDeclarationMarker(node) { return 0 !== (4194304 & ts.getEmitFlags(node)) } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node), statements = deferredExports[id]; return statements ? (delete deferredExports[id], ts.append(statements, node)) : node } function appendExportsOfImportDeclaration(statements, decl) { if (currentModuleInfo.exportEquals) return statements; var importClause = decl.importClause; if (!importClause) return statements; importClause.name && (statements = appendExportsOfDeclaration(statements, importClause)); var namedBindings = importClause.namedBindings; if (namedBindings) switch (namedBindings.kind) { case 245: statements = appendExportsOfDeclaration(statements, namedBindings); break; case 246: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding) } }return statements } function appendExportsOfImportEqualsDeclaration(statements, decl) { return currentModuleInfo.exportEquals ? statements : appendExportsOfDeclaration(statements, decl) } function appendExportsOfVariableStatement(statements, node) { if (currentModuleInfo.exportEquals) return statements; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; statements = appendExportsOfBindingElement(statements, decl) } return statements } function appendExportsOfBindingElement(statements, decl) { if (currentModuleInfo.exportEquals) return statements; if (ts.isBindingPattern(decl.name)) for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isOmittedExpression(element) || (statements = appendExportsOfBindingElement(statements, element)) } else ts.isGeneratedIdentifier(decl.name) || (statements = appendExportsOfDeclaration(statements, decl)); return statements } function appendExportsOfHoistedDeclaration(statements, decl) { if (currentModuleInfo.exportEquals) return statements; if (ts.hasModifier(decl, 1)) { var exportName = ts.hasModifier(decl, 512) ? ts.createIdentifier("default") : ts.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), decl) } return decl.name && (statements = appendExportsOfDeclaration(statements, decl)), statements } function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl), exportSpecifiers = currentModuleInfo.exportSpecifiers.get(ts.idText(name)); if (exportSpecifiers) for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; statements = appendExportStatement(statements, exportSpecifier.name, name, exportSpecifier.name) } return statements } function appendExportStatement(statements, exportName, expression, location, allowComments) { return statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)) } function createUnderscoreUnderscoreESModule() { var statement; return statement = 0 === languageVersion ? ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(!0))) : ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), void 0, [ts.createIdentifier("exports"), ts.createLiteral("__esModule"), ts.createObjectLiteral([ts.createPropertyAssignment("value", ts.createLiteral(!0))])])), ts.setEmitFlags(statement, 1048576), statement } function createExportStatement(name, value, location, allowComments) { var statement = ts.setTextRange(ts.createStatement(createExportExpression(name, value)), location); return ts.startOnNewLine(statement), allowComments || ts.setEmitFlags(statement, 1536), statement } function createExportExpression(name, value, location) { return ts.setTextRange(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value), location) } function modifierVisitor(node) { switch (node.kind) { case 84: case 79: return }return node } function onEmitNode(hint, node, emitCallback) { 273 === node.kind ? (currentSourceFile = node, currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)], noSubstitution = [], previousOnEmitNode(hint, node, emitCallback), currentSourceFile = void 0, currentModuleInfo = void 0, noSubstitution = void 0) : previousOnEmitNode(hint, node, emitCallback) } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), node.id && noSubstitution[node.id] ? node : 1 === hint ? substituteExpression(node) : ts.isShorthandPropertyAssignment(node) ? substituteShorthandPropertyAssignment(node) : node } function substituteShorthandPropertyAssignment(node) { var name = node.name, exportedOrImportedName = substituteExpressionIdentifier(name); if (exportedOrImportedName !== name) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node) } return ts.setTextRange(ts.createPropertyAssignment(name, exportedOrImportedName), node) } return node } function substituteExpression(node) { switch (node.kind) { case 71: return substituteExpressionIdentifier(node); case 199: return substituteBinaryExpression(node); case 198: case 197: return substituteUnaryExpression(node) }return node } function substituteExpressionIdentifier(node) { if (4096 & ts.getEmitFlags(node)) { var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); return externalHelpersModuleName ? ts.createPropertyAccess(externalHelpersModuleName, node) : node } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); if (exportContainer && 273 === exportContainer.kind) return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); if (ts.isImportSpecifier(importDeclaration)) { var name = importDeclaration.propertyName || importDeclaration.name; return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name)), node) } } } return node } function substituteBinaryExpression(node) { if (ts.isAssignmentOperator(node.operatorToken.kind) && ts.isIdentifier(node.left) && !ts.isGeneratedIdentifier(node.left) && !ts.isLocalName(node.left) && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) { var exportedNames = getExports(node.left); if (exportedNames) { for (var expression = node, _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { var exportName = exportedNames_2[_i]; noSubstitution[ts.getNodeId(expression)] = !0, expression = createExportExpression(exportName, expression, node) } return expression } } return node } function substituteUnaryExpression(node) { if ((43 === node.operator || 44 === node.operator) && ts.isIdentifier(node.operand) && !ts.isGeneratedIdentifier(node.operand) && !ts.isLocalName(node.operand) && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { for (var expression = 198 === node.kind ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(43 === node.operator ? 59 : 60), ts.createLiteral(1)), node) : node, _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) { var exportName = exportedNames_3[_i]; noSubstitution[ts.getNodeId(expression)] = !0, expression = createExportExpression(exportName, expression) } return expression } } return node } function getExports(name) { if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) return currentModuleInfo && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)] } } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, compilerOptions = context.getCompilerOptions(), resolver = context.getEmitResolver(), host = context.getEmitHost(), languageVersion = ts.getEmitScriptTarget(compilerOptions), moduleKind = ts.getEmitModuleKind(compilerOptions), previousOnSubstituteNode = context.onSubstituteNode, previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode, context.onEmitNode = onEmitNode, context.enableSubstitution(71), context.enableSubstitution(199), context.enableSubstitution(197), context.enableSubstitution(198), context.enableSubstitution(270), context.enableEmitNotification(273); var currentSourceFile, currentModuleInfo, noSubstitution, needUMDDynamicImportHelper, moduleInfoMap = [], deferredExports = []; return ts.chainBundle(transformSourceFile) } function createExportStarHelper(context, module) { var compilerOptions = context.getCompilerOptions(); return compilerOptions.importHelpers ? ts.createCall(ts.getHelperName("__exportStar"), void 0, [module, ts.createIdentifier("exports")]) : ts.createCall(ts.createIdentifier("__export"), void 0, [module]) } ts.transformModule = transformModule; var exportStarHelper = { name: "typescript:export-star", scoped: !0, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }, dynamicImportUMDHelper = { name: "typescript:dynamicimport-sync-require", scoped: !0, text: '\n var __syncRequire = typeof module === "object" && typeof module.exports === "object";' }, importStarHelper = { name: "typescript:commonjsimportstar", scoped: !1, text: '\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result["default"] = mod;\n return result;\n};' }, importDefaultHelper = { name: "typescript:commonjsimportdefault", scoped: !1, text: '\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { "default": mod };\n};' } }(ts || (ts = {})); var ts; !function (ts) { function transformSystemModule(context) { function transformSourceFile(node) { if (node.isDeclarationFile || !(ts.isEffectiveExternalModule(node, compilerOptions) || 67108864 & node.transformFlags)) return node; var id = ts.getOriginalNodeId(node); currentSourceFile = node, enclosingBlockScopedContainer = node, moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions), exportFunction = ts.createUniqueName("exports"), exportFunctionsMap[id] = exportFunction, contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports), moduleBodyBlock = createSystemModuleBody(node, dependencyGroups), moduleBodyFunction = ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, exportFunction), ts.createParameter(void 0, void 0, void 0, contextObject)], void 0, moduleBodyBlock), moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions), dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name })), updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), void 0, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction]))]), node.statements)), 1024); return compilerOptions.outFile || compilerOptions.out || ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped }), noSubstitution && (noSubstitutionMap[id] = noSubstitution, noSubstitution = void 0), currentSourceFile = void 0, moduleInfo = void 0, exportFunction = void 0, contextObject = void 0, hoistedStatements = void 0, enclosingBlockScopedContainer = void 0, ts.aggregateTransformFlags(updated) } function collectDependencyGroups(externalImports) { for (var groupIndices = ts.createMap(), dependencyGroups = [], _i = 0, externalImports_1 = externalImports; _i < externalImports_1.length; _i++) { var externalImport = externalImports_1[_i], externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); if (externalModuleName) { var text = externalModuleName.text, groupIndex = groupIndices.get(text); void 0 !== groupIndex ? dependencyGroups[groupIndex].externalImports.push(externalImport) : (groupIndices.set(text, dependencyGroups.length), dependencyGroups.push({ name: externalModuleName, externalImports: [externalImport] })) } } return dependencyGroups } function createSystemModuleBody(node, dependencyGroups) { var statements = []; startLexicalEnvironment(); var ensureUseStrict = ts.getStrictOptionValue(compilerOptions, "alwaysStrict") || !compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile), statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); statements.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration("__moduleName", void 0, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id")))]))), ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement); var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); ts.addRange(statements, hoistedStatements), ts.prependStatements(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements), moduleObject = ts.createObjectLiteral([ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), ts.createPropertyAssignment("execute", ts.createFunctionExpression(void 0, void 0, void 0, void 0, [], void 0, ts.createBlock(executeStatements, !0)))]); return moduleObject.multiLine = !0, statements.push(ts.createReturn(moduleObject)), ts.createBlock(statements, !0) } function addExportStarIfNeeded(statements) { if (moduleInfo.hasExportStarsToExportValues) { if (!moduleInfo.exportedNames && 0 === moduleInfo.exportSpecifiers.size) { for (var hasExportDeclarationWithExportClause = !1, _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; if (249 === externalImport.kind && externalImport.exportClause) { hasExportDeclarationWithExportClause = !0; break } } if (!hasExportDeclarationWithExportClause) { var exportStarFunction_1 = createExportStarFunction(void 0); return statements.push(exportStarFunction_1), exportStarFunction_1.name } } var exportedNames = []; if (moduleInfo.exportedNames) for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { var exportedLocalName = _c[_b]; "default" !== exportedLocalName.escapedText && exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createTrue())) } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; if (249 === externalImport.kind && externalImport.exportClause) for (var _f = 0, _g = externalImport.exportClause.elements; _f < _g.length; _f++) { var element = _g[_f]; exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(ts.idText(element.name || element.propertyName)), ts.createTrue())) } } var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); statements.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(exportedNamesStorageRef, void 0, ts.createObjectLiteral(exportedNames, !0))]))); var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); return statements.push(exportStarFunction), exportStarFunction.name } } function createExportStarFunction(localNames) { var exportStarFunction = ts.createUniqueName("exportStar"), m = ts.createIdentifier("m"), n = ts.createIdentifier("n"), exports = ts.createIdentifier("exports"), condition = ts.createStrictInequality(n, ts.createLiteral("default")); return localNames && (condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), void 0, [n])))), ts.createFunctionDeclaration(void 0, void 0, void 0, exportStarFunction, void 0, [ts.createParameter(void 0, void 0, void 0, m)], void 0, ts.createBlock([ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(exports, void 0, ts.createObjectLiteral([]))])), ts.createForIn(ts.createVariableDeclarationList([ts.createVariableDeclaration(n, void 0)]), m, ts.createBlock([ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1)])), ts.createStatement(ts.createCall(exportFunction, void 0, [exports]))], !0)) } function createSettersArray(exportStarFunction, dependencyGroups) { for (var setters = [], _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { for (var group_1 = dependencyGroups_1[_i], localName = ts.forEach(group_1.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile) }), parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""), statements = [], _a = 0, _b = group_1.externalImports; _a < _b.length; _a++) { var entry = _b[_a], importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { case 243: if (!entry.importClause) break; case 242: ts.Debug.assert(void 0 !== importVariableName), statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; case 249: if (ts.Debug.assert(void 0 !== importVariableName), entry.exportClause) { for (var properties = [], _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { var e = _d[_c]; properties.push(ts.createPropertyAssignment(ts.createLiteral(ts.idText(e.name)), ts.createElementAccess(parameterName, ts.createLiteral(ts.idText(e.propertyName || e.name))))) } statements.push(ts.createStatement(ts.createCall(exportFunction, void 0, [ts.createObjectLiteral(properties, !0)]))) } else statements.push(ts.createStatement(ts.createCall(exportStarFunction, void 0, [parameterName]))) } } setters.push(ts.createFunctionExpression(void 0, void 0, void 0, void 0, [ts.createParameter(void 0, void 0, void 0, parameterName)], void 0, ts.createBlock(statements, !0))) } return ts.createArrayLiteral(setters, !0) } function sourceElementVisitor(node) { switch (node.kind) { case 243: return visitImportDeclaration(node); case 242: return visitImportEqualsDeclaration(node); case 249: return; case 248: return visitExportAssignment(node); default: return nestedElementVisitor(node) } } function visitImportDeclaration(node) { var statements; if (node.importClause && hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)), hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node) } else statements = appendExportsOfImportDeclaration(statements, node); return ts.singleOrMany(statements) } function visitImportEqualsDeclaration(node) { ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); var statements; if (hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)), hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node) } else statements = appendExportsOfImportEqualsDeclaration(statements, node); return ts.singleOrMany(statements) } function visitExportAssignment(node) { if (!node.isExportEquals) { var expression = ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression), original = node.original; if (!original || !hasAssociatedEndOfDeclarationMarker(original)) return createExportStatement(ts.createIdentifier("default"), expression, !0); var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, !0) } } function visitFunctionDeclaration(node) { if (hoistedStatements = ts.hasModifier(node, 1) ? ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, !0, !0), void 0, ts.visitNodes(node.parameters, destructuringAndImportCallVisitor, ts.isParameterDeclaration), void 0, ts.visitNode(node.body, destructuringAndImportCallVisitor, ts.isBlock))) : ts.append(hoistedStatements, ts.visitEachChild(node, destructuringAndImportCallVisitor, context)), hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node) } else hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node) } function visitClassDeclaration(node) { var statements, name = ts.getLocalName(node); if (hoistVariableDeclaration(name), statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.createAssignment(name, ts.setTextRange(ts.createClassExpression(void 0, node.name, void 0, ts.visitNodes(node.heritageClauses, destructuringAndImportCallVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringAndImportCallVisitor, ts.isClassElement)), node))), node)), hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node) } else statements = appendExportsOfHoistedDeclaration(statements, node); return ts.singleOrMany(statements) } function visitVariableStatement(node) { if (!shouldHoistVariableDeclarationList(node.declarationList)) return ts.visitNode(node, destructuringAndImportCallVisitor, ts.isStatement); for (var expressions, isExportedDeclaration = ts.hasModifier(node, 1), isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node), _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var variable = _a[_i]; variable.initializer ? expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)) : hoistBindingElement(variable) } var statements; if (expressions && (statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node))), isMarkedDeclaration) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration) } else statements = appendExportsOfVariableStatement(statements, node, !1); return ts.singleOrMany(statements) } function hoistBindingElement(node) { if (ts.isBindingPattern(node.name)) for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isOmittedExpression(element) || hoistBindingElement(element) } else hoistVariableDeclaration(ts.getSynthesizedClone(node.name)) } function shouldHoistVariableDeclarationList(node) { return 0 === (2097152 & ts.getEmitFlags(node)) && (273 === enclosingBlockScopedContainer.kind || 0 === (3 & ts.getOriginalNode(node).flags)) } function transformInitializedVariable(node, isExportedDeclaration) { var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; return ts.isBindingPattern(node.name) ? ts.flattenDestructuringAssignment(node, destructuringAndImportCallVisitor, context, 0, !1, createAssignment) : node.initializer ? createAssignment(node.name, ts.visitNode(node.initializer, destructuringAndImportCallVisitor, ts.isExpression)) : node.name } function createExportedVariableAssignment(name, value, location) { return createVariableAssignment(name, value, location, !0) } function createNonExportedVariableAssignment(name, value, location) { return createVariableAssignment(name, value, location, !1) } function createVariableAssignment(name, value, location, isExportedDeclaration) { return hoistVariableDeclaration(ts.getSynthesizedClone(name)), isExportedDeclaration ? createExportExpression(name, preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location))) : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)) } function visitMergeDeclarationMarker(node) { if (hasAssociatedEndOfDeclarationMarker(node) && 213 === node.original.kind) { var id = ts.getOriginalNodeId(node), isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration) } return node } function hasAssociatedEndOfDeclarationMarker(node) { return 0 !== (4194304 & ts.getEmitFlags(node)) } function visitEndOfDeclarationMarker(node) { var id = ts.getOriginalNodeId(node), statements = deferredExports[id]; if (statements) return delete deferredExports[id], ts.append(statements, node); var original = ts.getOriginalNode(node); return ts.isModuleOrEnumDeclaration(original) ? ts.append(appendExportsOfDeclaration(statements, original), node) : node } function appendExportsOfImportDeclaration(statements, decl) { if (moduleInfo.exportEquals) return statements; var importClause = decl.importClause; if (!importClause) return statements; importClause.name && (statements = appendExportsOfDeclaration(statements, importClause)); var namedBindings = importClause.namedBindings; if (namedBindings) switch (namedBindings.kind) { case 245: statements = appendExportsOfDeclaration(statements, namedBindings); break; case 246: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding) } }return statements } function appendExportsOfImportEqualsDeclaration(statements, decl) { return moduleInfo.exportEquals ? statements : appendExportsOfDeclaration(statements, decl) } function appendExportsOfVariableStatement(statements, node, exportSelf) { if (moduleInfo.exportEquals) return statements; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; (decl.initializer || exportSelf) && (statements = appendExportsOfBindingElement(statements, decl, exportSelf)) } return statements } function appendExportsOfBindingElement(statements, decl, exportSelf) { if (moduleInfo.exportEquals) return statements; if (ts.isBindingPattern(decl.name)) for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isOmittedExpression(element) || (statements = appendExportsOfBindingElement(statements, element, exportSelf)) } else if (!ts.isGeneratedIdentifier(decl.name)) { var excludeName = void 0; exportSelf && (statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)), excludeName = ts.idText(decl.name)), statements = appendExportsOfDeclaration(statements, decl, excludeName) } return statements } function appendExportsOfHoistedDeclaration(statements, decl) { if (moduleInfo.exportEquals) return statements; var excludeName; if (ts.hasModifier(decl, 1)) { var exportName = ts.hasModifier(decl, 512) ? ts.createLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)), excludeName = ts.getTextOfIdentifierOrLiteral(exportName) } return decl.name && (statements = appendExportsOfDeclaration(statements, decl, excludeName)), statements } function appendExportsOfDeclaration(statements, decl, excludeName) { if (moduleInfo.exportEquals) return statements; var name = ts.getDeclarationName(decl), exportSpecifiers = moduleInfo.exportSpecifiers.get(ts.idText(name)); if (exportSpecifiers) for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; exportSpecifier.name.escapedText !== excludeName && (statements = appendExportStatement(statements, exportSpecifier.name, name)) } return statements } function appendExportStatement(statements, exportName, expression, allowComments) { return statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)) } function createExportStatement(name, value, allowComments) { var statement = ts.createStatement(createExportExpression(name, value)); return ts.startOnNewLine(statement), allowComments || ts.setEmitFlags(statement, 1536), statement } function createExportExpression(name, value) { var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; return ts.setEmitFlags(value, 1536 | ts.getEmitFlags(value)), ts.setCommentRange(ts.createCall(exportFunction, void 0, [exportName, value]), value) } function nestedElementVisitor(node) { switch (node.kind) { case 213: return visitVariableStatement(node); case 233: return visitFunctionDeclaration(node); case 234: return visitClassDeclaration(node); case 219: return visitForStatement(node); case 220: return visitForInStatement(node); case 221: return visitForOfStatement(node); case 217: return visitDoStatement(node); case 218: return visitWhileStatement(node); case 227: return visitLabeledStatement(node); case 225: return visitWithStatement(node); case 226: return visitSwitchStatement(node); case 240: return visitCaseBlock(node); case 265: return visitCaseClause(node); case 266: return visitDefaultClause(node); case 229: return visitTryStatement(node); case 268: return visitCatchClause(node); case 212: return visitBlock(node); case 302: return visitMergeDeclarationMarker(node); case 303: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node) } } function visitForStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; return enclosingBlockScopedContainer = node, node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNode(node.incrementor, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)), enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer, node } function visitForInStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; return enclosingBlockScopedContainer = node, node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)), enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer, node } function visitForOfStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; return enclosingBlockScopedContainer = node, node = ts.updateForOf(node, node.awaitModifier, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)), enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer, node } function shouldHoistForInitializer(node) { return ts.isVariableDeclarationList(node) && shouldHoistVariableDeclarationList(node) } function visitForInitializer(node) { if (!node) return node; if (shouldHoistForInitializer(node)) { for (var expressions = void 0, _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; expressions = ts.append(expressions, transformInitializedVariable(variable, !1)), variable.initializer || hoistBindingElement(variable) } return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression() } return ts.visitEachChild(node, nestedElementVisitor, context) } function visitDoStatement(node) { return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock), ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression)) } function visitWhileStatement(node) { return ts.updateWhile(node, ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)) } function visitLabeledStatement(node) { return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)) } function visitWithStatement(node) { return ts.updateWith(node, ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)) } function visitSwitchStatement(node) { return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)) } function visitCaseBlock(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; return enclosingBlockScopedContainer = node, node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)), enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer, node } function visitCaseClause(node) { return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringAndImportCallVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)) } function visitDefaultClause(node) { return ts.visitEachChild(node, nestedElementVisitor, context) } function visitTryStatement(node) { return ts.visitEachChild(node, nestedElementVisitor, context) } function visitCatchClause(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; return enclosingBlockScopedContainer = node, node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)), enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer, node } function visitBlock(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; return enclosingBlockScopedContainer = node, node = ts.visitEachChild(node, nestedElementVisitor, context), enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer, node } function destructuringAndImportCallVisitor(node) { return 1024 & node.transformFlags && 199 === node.kind ? visitDestructuringAssignment(node) : ts.isImportCall(node) ? visitImportCallExpression(node) : 2048 & node.transformFlags || 67108864 & node.transformFlags ? ts.visitEachChild(node, destructuringAndImportCallVisitor, context) : node } function visitImportCallExpression(node) { return ts.createCall(ts.createPropertyAccess(contextObject, ts.createIdentifier("import")), void 0, ts.some(node.arguments) ? [ts.visitNode(node.arguments[0], destructuringAndImportCallVisitor)] : []) } function visitDestructuringAssignment(node) { return hasExportedReferenceInDestructuringTarget(node.left) ? ts.flattenDestructuringAssignment(node, destructuringAndImportCallVisitor, context, 0, !0) : ts.visitEachChild(node, destructuringAndImportCallVisitor, context) } function hasExportedReferenceInDestructuringTarget(node) { if (ts.isAssignmentExpression(node, !0)) return hasExportedReferenceInDestructuringTarget(node.left); if (ts.isSpreadElement(node)) return hasExportedReferenceInDestructuringTarget(node.expression); if (ts.isObjectLiteralExpression(node)) return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); if (ts.isArrayLiteralExpression(node)) return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); if (ts.isShorthandPropertyAssignment(node)) return hasExportedReferenceInDestructuringTarget(node.name); if (ts.isPropertyAssignment(node)) return hasExportedReferenceInDestructuringTarget(node.initializer); if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); return void 0 !== container && 273 === container.kind } return !1 } function modifierVisitor(node) { switch (node.kind) { case 84: case 79: return }return node } function onEmitNode(hint, node, emitCallback) { if (273 === node.kind) { var id = ts.getOriginalNodeId(node); currentSourceFile = node, moduleInfo = moduleInfoMap[id], exportFunction = exportFunctionsMap[id], noSubstitution = noSubstitutionMap[id], noSubstitution && delete noSubstitutionMap[id], previousOnEmitNode(hint, node, emitCallback), currentSourceFile = void 0, moduleInfo = void 0, exportFunction = void 0, noSubstitution = void 0 } else previousOnEmitNode(hint, node, emitCallback) } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), isSubstitutionPrevented(node) ? node : 1 === hint ? substituteExpression(node) : 4 === hint ? substituteUnspecified(node) : node } function substituteUnspecified(node) { switch (node.kind) { case 270: return substituteShorthandPropertyAssignment(node) }return node } function substituteShorthandPropertyAssignment(node) { var name = node.name; if (!ts.isGeneratedIdentifier(name) && !ts.isLocalName(name)) { var importDeclaration = resolver.getReferencedImportDeclaration(name); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) return ts.setTextRange(ts.createPropertyAssignment(ts.getSynthesizedClone(name), ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"))), node); if (ts.isImportSpecifier(importDeclaration)) return ts.setTextRange(ts.createPropertyAssignment(ts.getSynthesizedClone(name), ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name))), node) } } return node } function substituteExpression(node) { switch (node.kind) { case 71: return substituteExpressionIdentifier(node); case 199: return substituteBinaryExpression(node); case 197: case 198: return substituteUnaryExpression(node) }return node } function substituteExpressionIdentifier(node) { if (4096 & ts.getEmitFlags(node)) { var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); return externalHelpersModuleName ? ts.createPropertyAccess(externalHelpersModuleName, node) : node } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); if (ts.isImportSpecifier(importDeclaration)) return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name)), node) } } return node } function substituteBinaryExpression(node) { if (ts.isAssignmentOperator(node.operatorToken.kind) && ts.isIdentifier(node.left) && !ts.isGeneratedIdentifier(node.left) && !ts.isLocalName(node.left) && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) { var exportedNames = getExports(node.left); if (exportedNames) { for (var expression = node, _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)) } return expression } } return node } function substituteUnaryExpression(node) { if ((43 === node.operator || 44 === node.operator) && ts.isIdentifier(node.operand) && !ts.isGeneratedIdentifier(node.operand) && !ts.isLocalName(node.operand) && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { for (var expression = 198 === node.kind ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node, _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) { var exportName = exportedNames_5[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)) } return 198 === node.kind && (expression = 43 === node.operator ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1))), expression } } return node } function getExports(name) { var exportedNames; if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, !1); exportContainer && 273 === exportContainer.kind && (exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration))), exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]) } } return exportedNames } function preventSubstitution(node) { return void 0 === noSubstitution && (noSubstitution = []), noSubstitution[ts.getNodeId(node)] = !0, node } function isSubstitutionPrevented(node) { return noSubstitution && node.id && noSubstitution[node.id] } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, compilerOptions = context.getCompilerOptions(), resolver = context.getEmitResolver(), host = context.getEmitHost(), previousOnSubstituteNode = context.onSubstituteNode, previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode, context.onEmitNode = onEmitNode, context.enableSubstitution(71), context.enableSubstitution(270), context.enableSubstitution(199), context.enableSubstitution(197), context.enableSubstitution(198), context.enableEmitNotification(273); var currentSourceFile, moduleInfo, exportFunction, contextObject, hoistedStatements, enclosingBlockScopedContainer, noSubstitution, moduleInfoMap = [], deferredExports = [], exportFunctionsMap = [], noSubstitutionMap = []; return ts.chainBundle(transformSourceFile) } ts.transformSystemModule = transformSystemModule }(ts || (ts = {})); var ts; !function (ts) { function transformES2015Module(context) { function transformSourceFile(node) { if (node.isDeclarationFile) return node; if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); if (externalHelpersModuleName) { var statements = [], statementOffset = ts.addPrologue(statements, node.statements), tslibImport = ts.createImportDeclaration(void 0, void 0, ts.createImportClause(void 0, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); return ts.addEmitFlags(tslibImport, 67108864), ts.append(statements, tslibImport), ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)), ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)) } return ts.visitEachChild(node, visitor, context) } return node } function visitor(node) { switch (node.kind) { case 242: return; case 248: return visitExportAssignment(node) }return node } function visitExportAssignment(node) { return node.isExportEquals ? void 0 : node } function onEmitNode(hint, node, emitCallback) { ts.isSourceFile(node) ? (currentSourceFile = node, previousOnEmitNode(hint, node, emitCallback), currentSourceFile = void 0) : previousOnEmitNode(hint, node, emitCallback) } function onSubstituteNode(hint, node) { return node = previousOnSubstituteNode(hint, node), ts.isIdentifier(node) && 1 === hint ? substituteExpressionIdentifier(node) : node } function substituteExpressionIdentifier(node) { if (4096 & ts.getEmitFlags(node)) { var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); if (externalHelpersModuleName) return ts.createPropertyAccess(externalHelpersModuleName, node) } return node } var compilerOptions = context.getCompilerOptions(), previousOnEmitNode = context.onEmitNode, previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode, context.onSubstituteNode = onSubstituteNode, context.enableEmitNotification(273), context.enableSubstitution(71); var currentSourceFile; return ts.chainBundle(transformSourceFile) } ts.transformES2015Module = transformES2015Module }(ts || (ts = {})); var ts; !function (ts) { function canProduceDiagnostics(node) { return ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertySignature(node) || ts.isBindingElement(node) || ts.isSetAccessor(node) || ts.isGetAccessor(node) || ts.isConstructSignatureDeclaration(node) || ts.isCallSignatureDeclaration(node) || ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || ts.isFunctionDeclaration(node) || ts.isParameter(node) || ts.isTypeParameterDeclaration(node) || ts.isExpressionWithTypeArguments(node) || ts.isImportEqualsDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isConstructorDeclaration(node) || ts.isIndexSignatureDeclaration(node) } function createGetSymbolAccessibilityDiagnosticForNodeName(node) { function getAccessorNameVisibilityError(symbolAccessibilityResult) { var diagnosticMessage = getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult); return void 0 !== diagnosticMessage ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : void 0 } function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { return ts.hasModifier(node, 32) ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1 : 234 === node.parent.kind ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1 : symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1 } function getMethodNameVisibilityError(symbolAccessibilityResult) { var diagnosticMessage = getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult); return void 0 !== diagnosticMessage ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : void 0 } function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { return ts.hasModifier(node, 32) ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1 : 234 === node.parent.kind ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1 : symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1 } return ts.isSetAccessor(node) || ts.isGetAccessor(node) ? getAccessorNameVisibilityError : ts.isMethodSignature(node) || ts.isMethodDeclaration(node) ? getMethodNameVisibilityError : createGetSymbolAccessibilityDiagnosticForNode(node) } function createGetSymbolAccessibilityDiagnosticForNode(node) { function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { return 231 === node.kind || 181 === node.kind ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1 : 151 === node.kind || 150 === node.kind || 148 === node.kind && ts.hasModifier(node.parent, 8) ? ts.hasModifier(node, 32) ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1 : 234 === node.parent.kind || 148 === node.kind ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1 : symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1 : void 0 } function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return void 0 !== diagnosticMessage ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : void 0 } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; return diagnosticMessage = 156 === node.kind ? ts.hasModifier(node, 32) ? symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1 : symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1 : ts.hasModifier(node, 32) ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1 : symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1, { diagnosticMessage: diagnosticMessage, errorNode: node.name, typeName: node.name } } function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { case 158: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 157: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 159: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 153: case 152: diagnosticMessage = ts.hasModifier(node, 32) ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0 : 234 === node.parent.kind ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0 : symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; break; case 233: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind) }return { diagnosticMessage: diagnosticMessage, errorNode: node.name || node } } function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); return void 0 !== diagnosticMessage ? { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } : void 0 } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { case 154: return symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; case 158: case 163: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; case 157: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; case 159: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; case 153: case 152: return ts.hasModifier(node.parent, 32) ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1 : 234 === node.parent.parent.kind ? symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1 : symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; case 233: case 162: return symbolAccessibilityResult.errorModuleName ? 2 === symbolAccessibilityResult.accessibility ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; default: ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]) } } function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { case 234: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; case 235: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 158: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 157: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 153: case 152: diagnosticMessage = ts.hasModifier(node.parent, 32) ? ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1 : 234 === node.parent.parent.kind ? ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1 : ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; break; case 233: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; case 236: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind) }return { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: node.name } } function getHeritageClauseVisibilityError() { var diagnosticMessage; return diagnosticMessage = 234 === node.parent.parent.kind ? 108 === node.parent.token ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1, { diagnosticMessage: diagnosticMessage, errorNode: node, typeName: ts.getNameOfDeclaration(node.parent.parent) } } function getImportEntityNameVisibilityError() { return { diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, errorNode: node, typeName: node.name } } function getTypeAliasDeclarationVisibilityError() { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, errorNode: node.type, typeName: node.name } } return ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertySignature(node) || ts.isBindingElement(node) || ts.isConstructorDeclaration(node) ? getVariableDeclarationTypeVisibilityError : ts.isSetAccessor(node) || ts.isGetAccessor(node) ? getAccessorDeclarationTypeVisibilityError : ts.isConstructSignatureDeclaration(node) || ts.isCallSignatureDeclaration(node) || ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || ts.isFunctionDeclaration(node) || ts.isIndexSignatureDeclaration(node) ? getReturnTypeVisibilityError : ts.isParameter(node) ? ts.isParameterPropertyDeclaration(node) && ts.hasModifier(node.parent, 8) ? getVariableDeclarationTypeVisibilityError : getParameterDeclarationTypeVisibilityError : ts.isTypeParameterDeclaration(node) ? getTypeParameterConstraintVisibilityError : ts.isExpressionWithTypeArguments(node) ? getHeritageClauseVisibilityError : ts.isImportEqualsDeclaration(node) ? getImportEntityNameVisibilityError : ts.isTypeAliasDeclaration(node) ? getTypeAliasDeclarationVisibilityError : void ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]) } ts.canProduceDiagnostics = canProduceDiagnostics, ts.createGetSymbolAccessibilityDiagnosticForNodeName = createGetSymbolAccessibilityDiagnosticForNodeName, ts.createGetSymbolAccessibilityDiagnosticForNode = createGetSymbolAccessibilityDiagnosticForNode }(ts || (ts = {})); var ts; !function (ts) { function getDeclarationDiagnostics(host, resolver, file) { if (file && ts.isSourceFileJavaScript(file)) return []; var compilerOptions = host.getCompilerOptions(), result = ts.transformNodes(resolver, host, compilerOptions, file ? [file] : ts.filter(host.getSourceFiles(), ts.isSourceFileNotJavaScript), [transformDeclarations], !1); return result.diagnostics } function transformDeclarations(context) { function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { if (typeReferenceDirectives) { necessaryTypeRefernces = necessaryTypeRefernces || ts.createMap(); for (var _i = 0, typeReferenceDirectives_2 = typeReferenceDirectives; _i < typeReferenceDirectives_2.length; _i++) { var ref = typeReferenceDirectives_2[_i]; necessaryTypeRefernces.set(ref, !0) } } } function trackReferencedAmbientModule(node) { var container = ts.getSourceFileOfNode(node); refs.set("" + ts.getOriginalNodeId(container), container) } function handleSymbolAccessibilityError(symbolAccessibilityResult) { if (0 === symbolAccessibilityResult.accessibility) { if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) if (lateMarkedStatements) for (var _i = 0, _a = symbolAccessibilityResult.aliasesToMakeVisible; _i < _a.length; _i++) { var ref = _a[_i]; ts.pushIfUnique(lateMarkedStatements, ref) } else lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible } else { var errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); errorInfo && (errorInfo.typeName ? context.addDiagnostic(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)) : context.addDiagnostic(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName))) } } function trackSymbol(symbol, enclosingDeclaration, meaning) { 262144 & symbol.flags || (handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, !0)), recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning))) } function reportPrivateInBaseOfClassExpression(propertyName) { errorNameNode && context.addDiagnostic(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected, propertyName)) } function reportInaccessibleUniqueSymbolError() { errorNameNode && context.addDiagnostic(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode), "unique symbol")) } function reportInaccessibleThisError() { errorNameNode && context.addDiagnostic(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode), "this")) } function transformRoot(node) { function getFileReferencesForUsedTypeReferences() { return necessaryTypeRefernces ? ts.mapDefined(ts.arrayFrom(necessaryTypeRefernces.keys()), getFileReferenceForTypeName) : [] } function getFileReferenceForTypeName(typeName) { if (emittedImports) for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) { var importStatement = emittedImports_1[_i]; if (ts.isImportEqualsDeclaration(importStatement) && ts.isExternalModuleReference(importStatement.moduleReference)) { var expr = importStatement.moduleReference.expression; if (ts.isStringLiteralLike(expr) && expr.text === typeName) return } else if (ts.isImportDeclaration(importStatement) && ts.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) return } return { fileName: typeName, pos: -1, end: -1 } } function mapReferencesIntoArray(references, outputFilePath) { return function (file) { var declFileName; if (file.isDeclarationFile) declFileName = file.fileName; else { if (isBundledEmit && ts.contains(node.sourceFiles, file)) return; var paths = ts.getOutputPathsFor(file, host, !0); declFileName = paths.declarationFilePath || paths.jsFilePath } if (declFileName) { var fileName = ts.getRelativePathToDirectoryOrUrl(outputFilePath, declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, !1); ts.startsWith(fileName, "./") && ts.hasExtension(fileName) && (fileName = fileName.substring(2)), references.push({ pos: -1, end: -1, fileName: fileName }) } } } if (273 === node.kind && (node.isDeclarationFile || ts.isSourceFileJavaScript(node))) return node; if (274 === node.kind) { isBundledEmit = !0; var refs_1 = ts.createMap(), hasNoDefaultLib_1 = !1, bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (!sourceFile.isDeclarationFile && !ts.isSourceFileJavaScript(sourceFile)) { if (hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib, currentSourceFile = sourceFile, enclosingDeclaration = sourceFile, lateMarkedStatements = void 0, suppressNewDiagnosticContexts = !1, lateStatementReplacementMap = ts.createMap(), getSymbolAccessibilityDiagnostic = throwDiagnostic, needsScopeFixMarker = !1, resultHasScopeMarker = !1, collectReferences(sourceFile, refs_1), ts.isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = !1, needsDeclare = !1; var statements_5 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements), newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(124)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_5)), sourceFile.statements)))], !0, [], [], !1); return newFile } needsDeclare = !0; var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), !0, [], [], !1) } }), ts.mapDefined(node.prepends, function (prepend) { if (276 === prepend.kind) return ts.createUnparsedSourceFile(prepend.declarationText) })); bundle.syntheticFileReferences = [], bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences(), bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, !0).declarationFilePath)), referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); return refs_1.forEach(referenceVisitor_1), bundle } needsDeclare = !0, needsScopeFixMarker = !1, resultHasScopeMarker = !1, enclosingDeclaration = node, currentSourceFile = node, getSymbolAccessibilityDiagnostic = throwDiagnostic, isBundledEmit = !1, resultHasExternalModuleIndicator = !1, suppressNewDiagnosticContexts = !1, lateMarkedStatements = void 0, lateStatementReplacementMap = ts.createMap(), necessaryTypeRefernces = void 0, refs = collectReferences(currentSourceFile, ts.createMap()); var references = [], outputFilePath = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, !0).declarationFilePath)), referenceVisitor = mapReferencesIntoArray(references, outputFilePath), statements = ts.visitNodes(node.statements, visitDeclarationStatements), combinedStatements = ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements); refs.forEach(referenceVisitor); var emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax); ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker) && (combinedStatements = ts.setTextRange(ts.createNodeArray(combinedStatements.concat([ts.createExportDeclaration(void 0, void 0, ts.createNamedExports([]), void 0)])), combinedStatements)); var updated = ts.updateSourceFileNode(node, combinedStatements, !0, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib); return updated } function collectReferences(sourceFile, ret) { return noResolve || ts.isSourceFileJavaScript(sourceFile) ? ret : (ts.forEach(sourceFile.referencedFiles, function (f) { var elem = ts.tryResolveScriptReference(host, sourceFile, f); elem && ret.set("" + ts.getOriginalNodeId(elem), elem) }), ret) } function filterBindingPatternInitializers(name) { function visitBindingElement(elem) { return 205 === elem.kind ? elem : ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : void 0) } return 71 === name.kind ? name : 180 === name.kind ? ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)) : ts.updateObjectBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)) } function ensureParameter(p, modifierMask) { var oldDiag; suppressNewDiagnosticContexts || (oldDiag = getSymbolAccessibilityDiagnostic, getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p)); var newParam = ts.updateParameter(p, void 0, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? p.questionToken || ts.createToken(55) : void 0, ensureType(p, p.type, !0), ensureNoInitializer(p)); return suppressNewDiagnosticContexts || (getSymbolAccessibilityDiagnostic = oldDiag), newParam } function shouldPrintWithInitializer(node) { return canHaveLiteralInitializer(node) && resolver.isLiteralConstDeclaration(ts.getParseTreeNode(node)) } function ensureNoInitializer(node) { if (shouldPrintWithInitializer(node)) return resolver.createLiteralConstValue(ts.getParseTreeNode(node)) } function ensureType(node, type, ignorePrivate) { function cleanup(returnValue) { return errorNameNode = void 0, suppressNewDiagnosticContexts || (getSymbolAccessibilityDiagnostic = oldDiag), returnValue || ts.createKeywordTypeNode(119) } if ((ignorePrivate || !ts.hasModifier(node, 8)) && !shouldPrintWithInitializer(node)) { var shouldUseResolverType = 148 === node.kind && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) return ts.visitNode(type, visitDeclarationSubtree); if (!ts.getParseTreeNode(node)) return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(119); if (156 === node.kind) return ts.createKeywordTypeNode(119); errorNameNode = node.name; var oldDiag; return suppressNewDiagnosticContexts || (oldDiag = getSymbolAccessibilityDiagnostic, getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node)), cleanup(231 === node.kind || 181 === node.kind ? resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) : 148 === node.kind || 151 === node.kind || 150 === node.kind ? node.initializer ? resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) : resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) : resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)) } } function isDeclarationAndNotVisible(node) { switch (node = ts.getParseTreeNode(node), node.kind) { case 233: case 238: case 235: case 234: case 236: case 237: return !resolver.isDeclarationVisible(node); case 231: return !getBindingNameVisible(node); case 242: case 243: case 249: case 248: return !1 }return !1 } function getBindingNameVisible(elem) { return !ts.isOmittedExpression(elem) && (ts.isBindingPattern(elem.name) ? ts.forEach(elem.name.elements, getBindingNameVisible) : resolver.isDeclarationVisible(elem)) } function updateParamsList(node, params, modifierMask) { if (!ts.hasModifier(node, 8)) { var newParams = ts.map(params, function (p) { return ensureParameter(p, modifierMask) }); if (newParams) return ts.createNodeArray(newParams, params.hasTrailingComma) } } function ensureTypeParams(node, params) { return ts.hasModifier(node, 8) ? void 0 : ts.visitNodes(params, visitDeclarationSubtree) } function isEnclosingDeclaration(node) { return ts.isSourceFile(node) || ts.isTypeAliasDeclaration(node) || ts.isModuleDeclaration(node) || ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionLike(node) || ts.isIndexSignatureDeclaration(node) || ts.isMappedTypeNode(node) } function checkEntityNameVisibility(entityName, enclosingDeclaration) { var visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult), recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)) } function preserveJsDoc(updated, original) { return ts.hasJSDocNodes(updated) && ts.hasJSDocNodes(original) && (updated.jsDoc = original.jsDoc), ts.setCommentRange(updated, ts.getCommentRange(original)) } function rewriteModuleSpecifier(parent, input) { if (input) { if (resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || 238 !== parent.kind && 178 !== parent.kind, 9 === input.kind && isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); if (newName) return ts.createLiteral(newName) } return input } } function transformImportEqualsDeclaration(decl) { if (resolver.isDeclarationVisible(decl)) { if (253 === decl.moduleReference.kind) { var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return ts.updateImportEqualsDeclaration(decl, void 0, decl.modifiers, decl.name, ts.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))) } var oldDiag = getSymbolAccessibilityDiagnostic; return getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(decl), checkEntityNameVisibility(decl.moduleReference, enclosingDeclaration), getSymbolAccessibilityDiagnostic = oldDiag, decl } } function transformImportDeclaration(decl) { if (!decl.importClause) return ts.updateImportDeclaration(decl, void 0, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier)); var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0; if (!decl.importClause.namedBindings) return visibleDefaultBinding && ts.updateImportDeclaration(decl, void 0, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, void 0), rewriteModuleSpecifier(decl, decl.moduleSpecifier)); if (245 === decl.importClause.namedBindings.kind) { var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : void 0; return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, void 0, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : void 0 } var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : void 0 }); return bindingList && bindingList.length || visibleDefaultBinding ? ts.updateImportDeclaration(decl, void 0, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, bindingList && bindingList.length ? ts.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : void 0 } function transformAndReplaceLatePaintedStatements(statements) { function visitLateVisibilityMarkedStatements(statement) { if (ts.isLateVisibilityPaintedStatement(statement)) { var key = "" + ts.getOriginalNodeId(statement); if (lateStatementReplacementMap.has(key)) { var result = lateStatementReplacementMap.get(key); return lateStatementReplacementMap.delete(key), result && ts.isSourceFile(statement.parent) && ((ts.isArray(result) ? ts.some(result, needsScopeMarker) : needsScopeMarker(result)) && (needsScopeFixMarker = !0), (ts.isArray(result) ? ts.some(result, isExternalModuleIndicator) : isExternalModuleIndicator(result)) && (resultHasExternalModuleIndicator = !0)), result } } return statement } for (; ts.length(lateMarkedStatements);) { var i = lateMarkedStatements.shift(); if (!ts.isLateVisibilityPaintedStatement(i)) return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind)); var result = transformTopLevelDeclaration(i, !0); lateStatementReplacementMap.set("" + ts.getOriginalNodeId(i), result) } return ts.visitNodes(statements, visitLateVisibilityMarkedStatements) } function isExternalModuleIndicator(result) { return ts.isAnyImportOrReExport(result) || ts.isExportAssignment(result) || ts.hasModifier(result, 1) } function needsScopeMarker(result) { return !(ts.isAnyImportOrReExport(result) || ts.isExportAssignment(result) || ts.hasModifier(result, 1) || ts.isAmbientModule(result)) } function visitDeclarationSubtree(input) { function cleanup(returnValue) { return returnValue && canProdiceDiagnostic && ts.hasDynamicName(input) && checkName(input), isEnclosingDeclaration(input) && (enclosingDeclaration = previousEnclosingDeclaration), canProdiceDiagnostic && !suppressNewDiagnosticContexts && (getSymbolAccessibilityDiagnostic = oldDiag), shouldEnterSuppressNewDiagnosticsContextContext && (suppressNewDiagnosticContexts = oldWithinObjectLiteralType), returnValue === input ? returnValue : returnValue && ts.setOriginalNode(preserveJsDoc(returnValue, input), input) } if (!shouldStripInternal(input)) { if (ts.isDeclaration(input)) { if (isDeclarationAndNotVisible(input)) return; if (ts.hasDynamicName(input) && !resolver.isLateBound(ts.getParseTreeNode(input))) return } if (!(ts.isFunctionLike(input) && resolver.isImplementationOfOverload(input) || ts.isSemicolonClassElement(input))) { var previousEnclosingDeclaration; isEnclosingDeclaration(input) && (previousEnclosingDeclaration = enclosingDeclaration, enclosingDeclaration = input); var oldDiag = getSymbolAccessibilityDiagnostic; if ((ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) && ts.hasModifier(input, 8)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; return cleanup(ts.createProperty(void 0, ensureModifiers(input), input.name, void 0, void 0, void 0)) } var canProdiceDiagnostic = ts.canProduceDiagnostics(input); canProdiceDiagnostic && !suppressNewDiagnosticContexts && (getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input)), ts.isTypeQueryNode(input) && checkEntityNameVisibility(input.exprName, enclosingDeclaration); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts, shouldEnterSuppressNewDiagnosticsContextContext = (165 === input.kind || 176 === input.kind) && 236 !== input.parent.kind; if (shouldEnterSuppressNewDiagnosticsContextContext && (suppressNewDiagnosticContexts = !0), isProcessedComponent(input)) switch (input.kind) { case 206: (ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression)) && checkEntityNameVisibility(input.expression, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression)); case 161: checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments))); case 158: return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); case 154: var isPrivate = ts.hasModifier(input, 8), ctor = ts.createSignatureDeclaration(154, isPrivate ? void 0 : ensureTypeParams(input, input.typeParameters), isPrivate ? void 0 : updateParamsList(input, input.parameters, 0), void 0); return ctor.modifiers = ts.createNodeArray(ensureModifiers(input)), cleanup(ctor); case 153: var sig = ts.createSignatureDeclaration(152, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)); return sig.name = input.name, sig.modifiers = ts.createNodeArray(ensureModifiers(input)), sig.questionToken = input.questionToken, cleanup(sig); case 155: var newNode = ensureAccessor(input); return cleanup(newNode); case 156: var newNode = ensureAccessor(input); return cleanup(newNode); case 151: return cleanup(ts.updateProperty(input, void 0, ensureModifiers(input), input.name, input.questionToken, ts.hasModifier(input, 8) ? void 0 : ensureType(input, input.type), ensureNoInitializer(input))); case 150: return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ts.hasModifier(input, 8) ? void 0 : ensureType(input, input.type), ensureNoInitializer(input))); case 152: return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken)); case 157: return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); case 159: return cleanup(ts.updateIndexSignature(input, void 0, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(119))); case 231: return ts.isBindingPattern(input.name) ? recreateBindingPattern(input.name) : (shouldEnterSuppressNewDiagnosticsContextContext = !0, suppressNewDiagnosticContexts = !0, cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)))); case 147: return cleanup(isPrivateMethodTypeParameter(input) && (input.default || input.constraint) ? ts.updateTypeParameterDeclaration(input, input.name, void 0, void 0) : ts.visitEachChild(input, visitDeclarationSubtree, context)); case 170: var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree), extendsType = ts.visitNode(input.extendsType, visitDeclarationSubtree), oldEnclosingDecl = enclosingDeclaration; enclosingDeclaration = input.trueType; var trueType = ts.visitNode(input.trueType, visitDeclarationSubtree); enclosingDeclaration = oldEnclosingDecl; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); case 162: return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); case 163: return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); case 178: return cleanup(ts.isLiteralImportTypeNode(input) ? ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf) : input); default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]) }return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)) } } } function isPrivateMethodTypeParameter(node) { return 153 === node.parent.kind && ts.hasModifier(node.parent, 8) } function visitDeclarationStatements(input) { if (isPreservedDeclarationStatement(input) && !shouldStripInternal(input)) { switch (input.kind) { case 249: return ts.isSourceFile(input.parent) && (resultHasExternalModuleIndicator = !0, resultHasScopeMarker = !0), ts.updateExportDeclaration(input, void 0, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier)); case 248: if (ts.isSourceFile(input.parent) && (resultHasExternalModuleIndicator = !0, resultHasScopeMarker = !0), 71 === input.expression.kind) return input; var newId = ts.createOptimisticUniqueName("_default"); getSymbolAccessibilityDiagnostic = function () { return { diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, errorNode: input } }; var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), void 0), statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(124)] : [], ts.createVariableDeclarationList([varDecl], 2)); return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)] }var result = transformTopLevelDeclaration(input); return lateStatementReplacementMap.set("" + ts.getOriginalNodeId(input), result), input } } function transformTopLevelDeclaration(input, isPrivate) { function cleanup(node) { return isEnclosingDeclaration(input) && (enclosingDeclaration = previousEnclosingDeclaration), canProdiceDiagnostic && (getSymbolAccessibilityDiagnostic = oldDiag), 238 === input.kind && (needsDeclare = previousNeedsDeclare), node === input ? node : node && ts.setOriginalNode(preserveJsDoc(node, input), input) } if (!shouldStripInternal(input)) { switch (input.kind) { case 242: return transformImportEqualsDeclaration(input); case 243: return transformImportDeclaration(input) }if (!(ts.isDeclaration(input) && isDeclarationAndNotVisible(input) || ts.isFunctionLike(input) && resolver.isImplementationOfOverload(input))) { var previousEnclosingDeclaration; isEnclosingDeclaration(input) && (previousEnclosingDeclaration = enclosingDeclaration, enclosingDeclaration = input); var canProdiceDiagnostic = ts.canProduceDiagnostics(input), oldDiag = getSymbolAccessibilityDiagnostic; canProdiceDiagnostic && (getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input)); var previousNeedsDeclare = needsDeclare; switch (input.kind) { case 236: return cleanup(ts.updateTypeAliasDeclaration(input, void 0, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); case 235: return cleanup(ts.updateInterfaceDeclaration(input, void 0, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); case 233: return cleanup(ts.updateFunctionDeclaration(input, void 0, ensureModifiers(input, isPrivate), void 0, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), void 0)); case 238: needsDeclare = !1; var inner = input.body; if (inner && 239 === inner.kind) { var statements = ts.visitNodes(inner.statements, visitDeclarationStatements), body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements)); needsDeclare = previousNeedsDeclare; var mods = ensureModifiers(input, isPrivate); return cleanup(ts.updateModuleDeclaration(input, void 0, mods, ts.isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name, body)) } needsDeclare = previousNeedsDeclare; var mods = ensureModifiers(input, isPrivate); needsDeclare = !1, ts.visitNode(inner, visitDeclarationStatements); var id = "" + ts.getOriginalNodeId(inner), body = lateStatementReplacementMap.get(id); return lateStatementReplacementMap.delete(id), cleanup(ts.updateModuleDeclaration(input, void 0, mods, input.name, body)); case 234: var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate)), typeParameters = ensureTypeParams(input, input.typeParameters), ctor = ts.getFirstConstructorWithBody(input), parameterProperties = void 0; if (ctor) { var oldDiag_1 = getSymbolAccessibilityDiagnostic; parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) { function walkBindingPattern(pattern) { for (var elems, _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var elem = _a[_i]; ts.isOmittedExpression(elem) || (ts.isBindingPattern(elem.name) && (elems = ts.concatenate(elems, walkBindingPattern(elem.name))), elems = elems || [], elems.push(ts.createProperty(void 0, ensureModifiers(param), elem.name, void 0, ensureType(elem, void 0), void 0))) } return elems } if (ts.hasModifier(param, 92)) return getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param), 71 === param.name.kind ? preserveJsDoc(ts.createProperty(void 0, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param) : walkBindingPattern(param.name) })), getSymbolAccessibilityDiagnostic = oldDiag_1 } var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree))), extendsClause_1 = ts.getClassExtendsHeritageClauseElement(input); if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && 95 !== extendsClause_1.expression.kind) { var newId_1 = ts.createOptimisticUniqueName(ts.unescapeLeadingUnderscores(input.name.escapedText) + "_base"); getSymbolAccessibilityDiagnostic = function () { return { diagnosticMessage: ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, errorNode: extendsClause_1, typeName: input.name } }; var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), void 0), statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(124)] : [], ts.createVariableDeclarationList([varDecl], 2)), heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (85 === clause.token) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]); var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1) })); return getSymbolAccessibilityDiagnostic = oldDiag_2, newClause } return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || 95 === t.expression.kind })), visitDeclarationSubtree)) })); return [statement, cleanup(ts.updateClassDeclaration(input, void 0, modifiers, input.name, typeParameters, heritageClauses, members))] } var heritageClauses = transformHeritageClauses(input.heritageClauses); return cleanup(ts.updateClassDeclaration(input, void 0, modifiers, input.name, typeParameters, heritageClauses, members)); case 213: return cleanup(transformVariableStatement(input, isPrivate)); case 237: return cleanup(ts.updateEnumDeclaration(input, void 0, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) { if (!shouldStripInternal(m)) { var constValue = resolver.getConstantValue(m); return preserveJsDoc(ts.updateEnumMember(m, m.name, void 0 !== constValue ? ts.createLiteral(constValue) : void 0), m) } })))) }return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]) } } } function transformVariableStatement(input, privateDeclaration) { if (ts.forEach(input.declarationList.declarations, getBindingNameVisible)) { var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree); if (ts.length(nodes)) return ts.updateVariableStatement(input, ts.createNodeArray(ensureModifiers(input, privateDeclaration)), ts.updateVariableDeclarationList(input.declarationList, nodes)) } } function recreateBindingPattern(d) { return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e) })) } function recreateBindingElement(e) { if (205 !== e.kind && e.name) { if (!getBindingNameVisible(e)) return; return ts.isBindingPattern(e.name) ? recreateBindingPattern(e.name) : ts.createVariableDeclaration(e.name, ensureType(e, void 0), void 0) } } function checkName(node) { var oldDiag; suppressNewDiagnosticContexts || (oldDiag = getSymbolAccessibilityDiagnostic, getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNodeName(node)), errorNameNode = node.name, ts.Debug.assert(resolver.isLateBound(ts.getParseTreeNode(node))); var decl = node, entityName = decl.name.expression; checkEntityNameVisibility(entityName, enclosingDeclaration), suppressNewDiagnosticContexts || (getSymbolAccessibilityDiagnostic = oldDiag), errorNameNode = void 0 } function hasInternalAnnotation(range) { var comment = currentSourceFile.text.substring(range.pos, range.end); return ts.stringContains(comment, "@internal") } function shouldStripInternal(node) { if (stripInternal && node) { var leadingCommentRanges = ts.getLeadingCommentRangesOfNode(ts.getParseTreeNode(node), currentSourceFile); if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) return !0 } return !1 } function ensureModifiers(node, privateDeclaration) { var currentFlags = ts.getModifierFlags(node), newFlags = ensureModifierFlags(node, privateDeclaration); return currentFlags === newFlags ? node.modifiers : ts.createModifiersFromModifierFlags(newFlags) } function ensureModifierFlags(node, privateDeclaration) { var mask = 2811, additions = needsDeclare && !isAlwaysType(node) ? 2 : 0, parentIsFile = 273 === node.parent.kind; return (!parentIsFile || isBundledEmit && parentIsFile && ts.isExternalModule(node.parent)) && (mask ^= 512 | (privateDeclaration || isBundledEmit && parentIsFile ? 0 : 1) | 2, additions = 0), maskModifierFlags(node, mask, additions) } function ensureAccessor(node) { var accessors = resolver.getAllAccessorDeclarations(node); if (node.kind === accessors.firstAccessor.kind) { var accessorType = getTypeAnnotationFromAccessor(node); !accessorType && accessors.secondAccessor && (accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor), getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor)); var prop = ts.createProperty(void 0, maskModifiers(node, void 0, accessors.setAccessor ? 0 : 64), node.name, node.questionToken, ensureType(node, accessorType), void 0), leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile); if (leadingsSyntheticCommentRanges) for (var _loop_9 = function (range) { if (3 === range.kind) { var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2), lines = text.split(/\r\n?|\n/g); if (lines.length > 1) { var lastLines = lines.slice(1), indentation_1 = ts.guessIndentation(lastLines); text = [lines[0]].concat(ts.map(lastLines, function (l) { return l.slice(indentation_1) })).join(newLine) } ts.addSyntheticLeadingComment(prop, range.kind, text, range.hasTrailingNewLine) } }, _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) { var range = leadingsSyntheticCommentRanges_1[_i]; _loop_9(range) } return prop } } function transformHeritageClauses(nodes) { return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || 85 === clause.token && 95 === t.expression.kind })), visitDeclarationSubtree)) }), function (clause) { return clause.types && !!clause.types.length })) } var enclosingDeclaration, necessaryTypeRefernces, lateMarkedStatements, lateStatementReplacementMap, suppressNewDiagnosticContexts, errorNameNode, currentSourceFile, refs, throwDiagnostic = function () { return ts.Debug.fail("Diagnostic emitted without context") }, getSymbolAccessibilityDiagnostic = throwDiagnostic, needsDeclare = !0, isBundledEmit = !1, resultHasExternalModuleIndicator = !1, needsScopeFixMarker = !1, resultHasScopeMarker = !1, host = context.getEmitHost(), symbolTracker = { trackSymbol: trackSymbol, reportInaccessibleThisError: reportInaccessibleThisError, reportInaccessibleUniqueSymbolError: reportInaccessibleUniqueSymbolError, reportPrivateInBaseOfClassExpression: reportPrivateInBaseOfClassExpression, moduleResolverHost: host, trackReferencedAmbientModule: trackReferencedAmbientModule }, resolver = context.getEmitResolver(), options = context.getCompilerOptions(), newLine = ts.getNewLineCharacter(options), noResolve = options.noResolve, stripInternal = options.stripInternal; return transformRoot } function isAlwaysType(node) { return 235 === node.kind } function maskModifiers(node, modifierMask, modifierAdditions) { return ts.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)) } function maskModifierFlags(node, modifierMask, modifierAdditions) { void 0 === modifierMask && (modifierMask = 3067), void 0 === modifierAdditions && (modifierAdditions = 0); var flags = ts.getModifierFlags(node) & modifierMask | modifierAdditions; return 512 & flags && 2 & flags && (flags ^= 2), flags } function getTypeAnnotationFromAccessor(accessor) { if (accessor) return 155 === accessor.kind ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : void 0 } function canHaveLiteralInitializer(node) { switch (node.kind) { case 231: case 151: case 150: case 148: return !0 }return !1 } function isPreservedDeclarationStatement(node) { switch (node.kind) { case 233: case 238: case 242: case 235: case 234: case 236: case 237: case 213: case 243: case 249: case 248: return !0 }return !1 } function isProcessedComponent(node) { switch (node.kind) { case 158: case 154: case 153: case 155: case 156: case 151: case 150: case 152: case 157: case 159: case 231: case 147: case 206: case 161: case 170: case 162: case 163: case 178: return !0 }return !1 } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; var declarationEmitNodeBuilderFlags = 531468; ts.transformDeclarations = transformDeclarations }(ts || (ts = {})); var ts; !function (ts) { function getModuleTransformer(moduleKind) { switch (moduleKind) { case ts.ModuleKind.ESNext: case ts.ModuleKind.ES2015: return ts.transformES2015Module; case ts.ModuleKind.System: return ts.transformSystemModule; default: return ts.transformModule } } function getTransformers(compilerOptions, customTransformers) { var jsx = compilerOptions.jsx, languageVersion = ts.getEmitScriptTarget(compilerOptions), moduleKind = ts.getEmitModuleKind(compilerOptions), transformers = []; return ts.addRange(transformers, customTransformers && customTransformers.before), transformers.push(ts.transformTypeScript), 2 === jsx && transformers.push(ts.transformJsx), languageVersion < 6 && transformers.push(ts.transformESNext), languageVersion < 4 && transformers.push(ts.transformES2017), languageVersion < 3 && transformers.push(ts.transformES2016), languageVersion < 2 && (transformers.push(ts.transformES2015), transformers.push(ts.transformGenerators)), transformers.push(getModuleTransformer(moduleKind)), languageVersion < 1 && transformers.push(ts.transformES5), ts.addRange(transformers, customTransformers && customTransformers.after), transformers } function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { function transformRoot(node) { return !node || ts.isSourceFile(node) && node.isDeclarationFile ? node : transformation(node) } function enableSubstitution(kind) { ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."), enabledSyntaxKindFeatures[kind] |= 1 } function isSubstitutionEnabled(node) { return 0 !== (1 & enabledSyntaxKindFeatures[node.kind]) && 0 === (4 & ts.getEmitFlags(node)) } function substituteNode(hint, node) { return ts.Debug.assert(state < 3, "Cannot substitute a node after the result is disposed."), node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node } function enableEmitNotification(kind) { ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."), enabledSyntaxKindFeatures[kind] |= 2 } function isEmitNotificationEnabled(node) { return 0 !== (2 & enabledSyntaxKindFeatures[node.kind]) || 0 !== (2 & ts.getEmitFlags(node)) } function emitNodeWithNotification(hint, node, emitCallback) { ts.Debug.assert(state < 3, "Cannot invoke TransformationResult callbacks after the result is disposed."), node && (isEmitNotificationEnabled(node) ? onEmitNode(hint, node, emitCallback) : emitCallback(hint, node)) } function hoistVariableDeclaration(name) { ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."), ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); var decl = ts.setEmitFlags(ts.createVariableDeclaration(name), 64); lexicalEnvironmentVariableDeclarations ? lexicalEnvironmentVariableDeclarations.push(decl) : lexicalEnvironmentVariableDeclarations = [decl]; } function hoistFunctionDeclaration(func) { ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."), ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."), lexicalEnvironmentFunctionDeclarations ? lexicalEnvironmentFunctionDeclarations.push(func) : lexicalEnvironmentFunctionDeclarations = [func] } function startLexicalEnvironment() { ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."), ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."), ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."), lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations, lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations, lexicalEnvironmentStackOffset++ , lexicalEnvironmentVariableDeclarations = void 0, lexicalEnvironmentFunctionDeclarations = void 0 } function suspendLexicalEnvironment() { ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."), ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."), ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."), lexicalEnvironmentSuspended = !0 } function resumeLexicalEnvironment() { ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."), ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."), ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."), lexicalEnvironmentSuspended = !1 } function endLexicalEnvironment() { ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."), ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."), ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; if ((lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) && (lexicalEnvironmentFunctionDeclarations && (statements = lexicalEnvironmentFunctionDeclarations.slice()), lexicalEnvironmentVariableDeclarations)) { var statement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); statements ? statements.push(statement) : statements = [statement] } return lexicalEnvironmentStackOffset-- , lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset], lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset], 0 === lexicalEnvironmentStackOffset && (lexicalEnvironmentVariableDeclarationsStack = [], lexicalEnvironmentFunctionDeclarationsStack = []), statements } function requestEmitHelper(helper) { ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."), ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."), ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."), emitHelpers = ts.append(emitHelpers, helper) } function readEmitHelpers() { ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."), ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); var helpers = emitHelpers; return emitHelpers = void 0, helpers } function dispose() { if (state < 3) { for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { var node = nodes_5[_i]; ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))) } lexicalEnvironmentVariableDeclarations = void 0, lexicalEnvironmentVariableDeclarationsStack = void 0, lexicalEnvironmentFunctionDeclarations = void 0, lexicalEnvironmentFunctionDeclarationsStack = void 0, onSubstituteNode = void 0, onEmitNode = void 0, emitHelpers = void 0, state = 3 } } for (var lexicalEnvironmentVariableDeclarations, lexicalEnvironmentFunctionDeclarations, emitHelpers, enabledSyntaxKindFeatures = new Array(304), lexicalEnvironmentVariableDeclarationsStack = [], lexicalEnvironmentFunctionDeclarationsStack = [], lexicalEnvironmentStackOffset = 0, lexicalEnvironmentSuspended = !1, onSubstituteNode = function (_, node) { return node }, onEmitNode = function (hint, node, callback) { return callback(hint, node) }, state = 0, diagnostics = [], context = { getCompilerOptions: function () { return options }, getEmitResolver: function () { return resolver }, getEmitHost: function () { return host }, startLexicalEnvironment: startLexicalEnvironment, suspendLexicalEnvironment: suspendLexicalEnvironment, resumeLexicalEnvironment: resumeLexicalEnvironment, endLexicalEnvironment: endLexicalEnvironment, hoistVariableDeclaration: hoistVariableDeclaration, hoistFunctionDeclaration: hoistFunctionDeclaration, requestEmitHelper: requestEmitHelper, readEmitHelpers: readEmitHelpers, enableSubstitution: enableSubstitution, enableEmitNotification: enableEmitNotification, isSubstitutionEnabled: isSubstitutionEnabled, isEmitNotificationEnabled: isEmitNotificationEnabled, get onSubstituteNode() { return onSubstituteNode }, set onSubstituteNode(value) { ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."), ts.Debug.assert(void 0 !== value, "Value must not be 'undefined'"), onSubstituteNode = value }, get onEmitNode() { return onEmitNode }, set onEmitNode(value) { ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."), ts.Debug.assert(void 0 !== value, "Value must not be 'undefined'"), onEmitNode = value }, addDiagnostic: function (diag) { diagnostics.push(diag) } }, _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { var node = nodes_4[_i]; ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))) } ts.performance.mark("beforeTransform"); var transformation = ts.chain.apply(void 0, transformers)(context); state = 1; var transformed = ts.map(nodes, allowDtsFiles ? transformation : transformRoot); return state = 2, ts.performance.mark("afterTransform"), ts.performance.measure("transformTime", "beforeTransform", "afterTransform"), { transformed: transformed, substituteNode: substituteNode, emitNodeWithNotification: emitNodeWithNotification, dispose: dispose, diagnostics: diagnostics } } var TransformationState; !function (TransformationState) { TransformationState[TransformationState.Uninitialized = 0] = "Uninitialized", TransformationState[TransformationState.Initialized = 1] = "Initialized", TransformationState[TransformationState.Completed = 2] = "Completed", TransformationState[TransformationState.Disposed = 3] = "Disposed" }(TransformationState || (TransformationState = {})); var SyntaxKindFeatureFlags; !function (SyntaxKindFeatureFlags) { SyntaxKindFeatureFlags[SyntaxKindFeatureFlags.Substitution = 1] = "Substitution", SyntaxKindFeatureFlags[SyntaxKindFeatureFlags.EmitNotifications = 2] = "EmitNotifications" }(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})), ts.getTransformers = getTransformers, ts.transformNodes = transformNodes }(ts || (ts = {})); var ts; !function (ts) { function createSourceMapWriter(host, writer, compilerOptions) { function skipSourceTrivia(pos) { return currentSource.skipTrivia ? currentSource.skipTrivia(pos) : ts.skipTrivia(currentSourceText, pos) } function initialize(filePath, sourceMapFilePath, sourceFileOrBundle, outputSourceMapDataList) { disabled || ts.fileExtensionIs(filePath, ".json") || (sourceMapData && reset(), sourceMapDataList = outputSourceMapDataList, currentSource = void 0, currentSourceText = void 0, sourceMapSourceIndex = -1, lastRecordedSourceMapSpan = void 0, lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan, lastEncodedNameIndex = 0, sourceMapData = { sourceMapFilePath: sourceMapFilePath, jsSourceMappingURL: compilerOptions.inlineSourceMap ? void 0 : ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)), sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), sourceMapSourceRoot: compilerOptions.sourceRoot || "", sourceMapSources: [], inputSourceFileNames: [], sourceMapNames: [], sourceMapMappings: "", sourceMapSourcesContent: compilerOptions.inlineSources ? [] : void 0, sourceMapDecodedMappings: [] }, sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot), sourceMapData.sourceMapSourceRoot.length && 47 !== sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) && (sourceMapData.sourceMapSourceRoot += ts.directorySeparator), compilerOptions.mapRoot ? (sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot), 273 === sourceFileOrBundle.kind && (sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir))), ts.isRootedDiskPath(sourceMapDir) || ts.isUrl(sourceMapDir) ? sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL) : (sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir), sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, !0))) : sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath))) } function reset() { disabled || (sourceMapDataList && sourceMapDataList.push(sourceMapData), currentSource = void 0, sourceMapDir = void 0, sourceMapSourceIndex = void 0, lastRecordedSourceMapSpan = void 0, lastEncodedSourceMapSpan = void 0, lastEncodedNameIndex = void 0, sourceMapData = void 0, sourceMapDataList = void 0) } function encodeLastRecordedSourceMapSpan() { if (lastRecordedSourceMapSpan && lastRecordedSourceMapSpan !== lastEncodedSourceMapSpan) { var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) sourceMapData.sourceMapMappings && (sourceMapData.sourceMapMappings += ","); else { for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++)sourceMapData.sourceMapMappings += ";"; prevEncodedEmittedColumn = 1 } sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn), sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex), sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine), sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn), lastRecordedSourceMapSpan.nameIndex >= 0 && (ts.Debug.assert(!1, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"), sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex), lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex), lastEncodedSourceMapSpan = lastRecordedSourceMapSpan, sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan) } } function emitPos(pos) { if (!(disabled || ts.positionIsSynthesized(pos) || isJsonSourceMapSource(currentSource))) { extendedDiagnostics && ts.performance.mark("beforeSourcemap"); var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSource, pos); sourceLinePos.line++ , sourceLinePos.character++; var emittedLine = writer.getLine(), emittedColumn = writer.getColumn(); !lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine !== emittedLine || lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character) ? (encodeLastRecordedSourceMapSpan(), lastRecordedSourceMapSpan = { emittedLine: emittedLine, emittedColumn: emittedColumn, sourceLine: sourceLinePos.line, sourceColumn: sourceLinePos.character, sourceIndex: sourceMapSourceIndex }) : (lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line, lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character, lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex), extendedDiagnostics && (ts.performance.mark("afterSourcemap"), ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap")) } } function emitNodeWithSourceMap(hint, node, emitCallback) { if (disabled || ts.isInJsonFile(node)) return emitCallback(hint, node); if (node) { var emitNode = node.emitNode, emitFlags = emitNode && emitNode.flags, range = emitNode && emitNode.sourceMapRange, _a = range || node, pos = _a.pos, end = _a.end, source = range && range.source, oldSource = currentSource; source === oldSource && (source = void 0), source && setSourceFile(source), 299 !== node.kind && 0 === (16 & emitFlags) && pos >= 0 && emitPos(skipSourceTrivia(pos)), source && setSourceFile(oldSource), 64 & emitFlags ? (disabled = !0, emitCallback(hint, node), disabled = !1) : emitCallback(hint, node), source && setSourceFile(source), 299 !== node.kind && 0 === (32 & emitFlags) && end >= 0 && emitPos(end), source && setSourceFile(oldSource) } } function emitTokenWithSourceMap(node, token, writer, tokenPos, emitCallback) { if (disabled || ts.isInJsonFile(node)) return emitCallback(token, writer, tokenPos); var emitNode = node && node.emitNode, emitFlags = emitNode && emitNode.flags, range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; return tokenPos = skipSourceTrivia(range ? range.pos : tokenPos), 0 === (128 & emitFlags) && tokenPos >= 0 && emitPos(tokenPos), tokenPos = emitCallback(token, writer, tokenPos), range && (tokenPos = range.end), 0 === (256 & emitFlags) && tokenPos >= 0 && emitPos(tokenPos), tokenPos } function isJsonSourceMapSource(sourceFile) { return ts.fileExtensionIs(sourceFile.fileName, ".json") } function setSourceFile(sourceFile) { if (!disabled && (currentSource = sourceFile, currentSourceText = currentSource.text, !isJsonSourceMapSource(sourceFile))) { var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir, source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSource.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, !0); sourceMapSourceIndex = sourceMapData.sourceMapSources.indexOf(source), sourceMapSourceIndex === -1 && (sourceMapSourceIndex = sourceMapData.sourceMapSources.length, sourceMapData.sourceMapSources.push(source), sourceMapData.inputSourceFileNames.push(currentSource.fileName), compilerOptions.inlineSources && sourceMapData.sourceMapSourcesContent.push(currentSource.text)) } } function getText() { if (!disabled && !isJsonSourceMapSource(currentSource)) return encodeLastRecordedSourceMapSpan(), JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, sources: sourceMapData.sourceMapSources, names: sourceMapData.sourceMapNames, mappings: sourceMapData.sourceMapMappings, sourcesContent: sourceMapData.sourceMapSourcesContent }) } function getSourceMappingURL() { if (!disabled && !isJsonSourceMapSource(currentSource)) { if (compilerOptions.inlineSourceMap) { var base64SourceMapText = ts.base64encode(ts.sys, getText()); return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText } return sourceMapData.jsSourceMappingURL } } void 0 === compilerOptions && (compilerOptions = host.getCompilerOptions()); var currentSource, currentSourceText, sourceMapDir, sourceMapSourceIndex, lastRecordedSourceMapSpan, lastEncodedSourceMapSpan, lastEncodedNameIndex, sourceMapData, sourceMapDataList, extendedDiagnostics = compilerOptions.extendedDiagnostics, disabled = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap); return { initialize: initialize, reset: reset, setSourceFile: setSourceFile, emitPos: emitPos, emitNodeWithSourceMap: emitNodeWithSourceMap, emitTokenWithSourceMap: emitTokenWithSourceMap, getText: getText, getSourceMappingURL: getSourceMappingURL } } function base64FormatEncode(inValue) { if (inValue < 64) return base64Chars.charAt(inValue); throw TypeError(inValue + ": not a 64 based value") } function base64VLQFormatEncode(inValue) { inValue < 0 ? inValue = (-inValue << 1) + 1 : inValue <<= 1; var encodedStr = ""; do { var currentDigit = 31 & inValue; inValue >>= 5, inValue > 0 && (currentDigit |= 32), encodedStr += base64FormatEncode(currentDigit) } while (inValue > 0); return encodedStr } var defaultLastEncodedSourceMapSpan = { emittedLine: 1, emittedColumn: 1, sourceLine: 1, sourceColumn: 1, sourceIndex: 0 }; ts.createSourceMapWriter = createSourceMapWriter; var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" }(ts || (ts = {})); var ts; !function (ts) { function createCommentWriter(printerOptions, emitPos) { function emitNodeWithComments(hint, node, emitCallback) { if (disabled) return void emitCallback(hint, node); if (node) { hasWrittenComment = !1; var emitNode = node.emitNode, emitFlags = emitNode && emitNode.flags, _a = emitNode && emitNode.commentRange || node, pos = _a.pos, end = _a.end; if (pos < 0 && end < 0 || pos === end) emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); else { extendedDiagnostics && ts.performance.mark("preEmitNodeWithComment"); var isEmittedNode = 299 !== node.kind, skipLeadingComments = pos < 0 || 0 !== (512 & emitFlags) || 10 === node.kind, skipTrailingComments = end < 0 || 0 !== (1024 & emitFlags) || 10 === node.kind; skipLeadingComments || emitLeadingComments(pos, isEmittedNode); var savedContainerPos = containerPos, savedContainerEnd = containerEnd, savedDeclarationListContainerEnd = declarationListContainerEnd; skipLeadingComments || (containerPos = pos), skipTrailingComments || (containerEnd = end, 232 === node.kind && (declarationListContainerEnd = end)), extendedDiagnostics && ts.performance.measure("commentTime", "preEmitNodeWithComment"), emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback), extendedDiagnostics && ts.performance.mark("postEmitNodeWithComment"), containerPos = savedContainerPos, containerEnd = savedContainerEnd, declarationListContainerEnd = savedDeclarationListContainerEnd, !skipTrailingComments && isEmittedNode && emitTrailingComments(end), extendedDiagnostics && ts.performance.measure("commentTime", "postEmitNodeWithComment") } } } function emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback) { var leadingComments = emitNode && emitNode.leadingComments; ts.some(leadingComments) && (extendedDiagnostics && ts.performance.mark("preEmitNodeWithSynthesizedComments"), ts.forEach(leadingComments, emitLeadingSynthesizedComment), extendedDiagnostics && ts.performance.measure("commentTime", "preEmitNodeWithSynthesizedComments")), emitNodeWithNestedComments(hint, node, emitFlags, emitCallback); var trailingComments = emitNode && emitNode.trailingComments; ts.some(trailingComments) && (extendedDiagnostics && ts.performance.mark("postEmitNodeWithSynthesizedComments"), ts.forEach(trailingComments, emitTrailingSynthesizedComment), extendedDiagnostics && ts.performance.measure("commentTime", "postEmitNodeWithSynthesizedComments")) } function emitLeadingSynthesizedComment(comment) { 2 === comment.kind && writer.writeLine(), writeSynthesizedComment(comment), comment.hasTrailingNewLine || 2 === comment.kind ? writer.writeLine() : writer.write(" ") } function emitTrailingSynthesizedComment(comment) { writer.isAtStartOfLine() || writer.write(" "), writeSynthesizedComment(comment), comment.hasTrailingNewLine && writer.writeLine() } function writeSynthesizedComment(comment) { var text = formatSynthesizedComment(comment), lineMap = 3 === comment.kind ? ts.computeLineStarts(text) : void 0; ts.writeCommentRange(text, lineMap, writer, 0, text.length, newLine) } function formatSynthesizedComment(comment) { return 3 === comment.kind ? "/*" + comment.text + "*/" : "//" + comment.text } function emitNodeWithNestedComments(hint, node, emitFlags, emitCallback) { 2048 & emitFlags ? (disabled = !0, emitCallback(hint, node), disabled = !1) : emitCallback(hint, node) } function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { extendedDiagnostics && ts.performance.mark("preEmitBodyWithDetachedComments"); var pos = detachedRange.pos, end = detachedRange.end, emitFlags = ts.getEmitFlags(node), skipLeadingComments = pos < 0 || 0 !== (512 & emitFlags), skipTrailingComments = disabled || end < 0 || 0 !== (1024 & emitFlags); skipLeadingComments || emitDetachedCommentsAndUpdateCommentsInfo(detachedRange), extendedDiagnostics && ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments"), 2048 & emitFlags && !disabled ? (disabled = !0, emitCallback(node), disabled = !1) : emitCallback(node), extendedDiagnostics && ts.performance.mark("beginEmitBodyWithDetachedCommetns"), skipTrailingComments || (emitLeadingComments(detachedRange.end, !0), hasWrittenComment && !writer.isAtStartOfLine() && writer.writeLine()), extendedDiagnostics && ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns") } function emitLeadingComments(pos, isEmittedNode) { hasWrittenComment = !1, isEmittedNode ? forEachLeadingCommentToEmit(pos, emitLeadingComment) : 0 === pos && forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment) } function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) { isTripleSlashComment(commentPos, commentEnd) && emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) } function shouldWriteComment(text, pos) { return !printerOptions.onlyPrintJsDocStyle || (ts.isJSDocLikeText(text, pos) || ts.isPinnedComment(text, pos)) } function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) { shouldWriteComment(currentText, commentPos) && (hasWrittenComment || (ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos), hasWrittenComment = !0), emitPos && emitPos(commentPos), ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine), emitPos && emitPos(commentEnd), hasTrailingNewLine ? writer.writeLine() : 3 === kind && writer.write(" ")) } function emitLeadingCommentsOfPosition(pos) { disabled || pos === -1 || emitLeadingComments(pos, !0) } function emitTrailingComments(pos) { forEachTrailingCommentToEmit(pos, emitTrailingComment) } function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) { shouldWriteComment(currentText, commentPos) && (writer.isAtStartOfLine() || writer.write(" "), emitPos && emitPos(commentPos), ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine), emitPos && emitPos(commentEnd), hasTrailingNewLine && writer.writeLine()) } function emitTrailingCommentsOfPosition(pos, prefixSpace) { disabled || (extendedDiagnostics && ts.performance.mark("beforeEmitTrailingCommentsOfPosition"), forEachTrailingCommentToEmit(pos, prefixSpace ? emitTrailingComment : emitTrailingCommentOfPosition), extendedDiagnostics && ts.performance.measure("commentTime", "beforeEmitTrailingCommentsOfPosition")) } function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { emitPos && emitPos(commentPos), ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine), emitPos && emitPos(commentEnd), hasTrailingNewLine ? writer.writeLine() : writer.write(" ") } function forEachLeadingCommentToEmit(pos, cb) { containerPos !== -1 && pos === containerPos || (hasDetachedComments(pos) ? forEachLeadingCommentWithoutDetachedComments(cb) : ts.forEachLeadingCommentRange(currentText, pos, cb, pos)) } function forEachTrailingCommentToEmit(end, cb) { (containerEnd === -1 || end !== containerEnd && end !== declarationListContainerEnd) && ts.forEachTrailingCommentRange(currentText, end, cb) } function reset() { currentSourceFile = void 0, currentText = void 0, currentLineMap = void 0, detachedCommentsInfo = void 0 } function setWriter(output) { writer = output } function setSourceFile(sourceFile) { currentSourceFile = sourceFile, currentText = currentSourceFile.text, currentLineMap = ts.getLineStarts(currentSourceFile), detachedCommentsInfo = void 0 } function hasDetachedComments(pos) { return void 0 !== detachedCommentsInfo && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos } function forEachLeadingCommentWithoutDetachedComments(cb) { var pos = ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos; detachedCommentsInfo.length - 1 ? detachedCommentsInfo.pop() : detachedCommentsInfo = void 0, ts.forEachLeadingCommentRange(currentText, pos, cb, pos) } function emitDetachedCommentsAndUpdateCommentsInfo(range) { var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, range, newLine, disabled); currentDetachedCommentInfo && (detachedCommentsInfo ? detachedCommentsInfo.push(currentDetachedCommentInfo) : detachedCommentsInfo = [currentDetachedCommentInfo]) } function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) { shouldWriteComment(currentText, commentPos) && (emitPos && emitPos(commentPos), ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine), emitPos && emitPos(commentEnd)) } function isTripleSlashComment(commentPos, commentEnd) { return ts.isRecognizedTripleSlashComment(currentText, commentPos, commentEnd) } var writer, currentSourceFile, currentText, currentLineMap, detachedCommentsInfo, extendedDiagnostics = printerOptions.extendedDiagnostics, newLine = ts.getNewLineCharacter(printerOptions), containerPos = -1, containerEnd = -1, declarationListContainerEnd = -1, hasWrittenComment = !1, disabled = printerOptions.removeComments; return { reset: reset, setWriter: setWriter, setSourceFile: setSourceFile, emitNodeWithComments: emitNodeWithComments, emitBodyWithDetachedComments: emitBodyWithDetachedComments, emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition: emitLeadingCommentsOfPosition } } ts.createCommentWriter = createCommentWriter }(ts || (ts = {})); var ts; !function (ts) { function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile), options = host.getCompilerOptions(); if (options.outFile || options.out) { if (sourceFiles.length) { var bundle = ts.createBundle(sourceFiles, host.getPrependNodes()), result = action(getOutputPathsFor(bundle, host, emitOnlyDtsFiles), bundle); if (result) return result } } else for (var _a = 0, sourceFiles_1 = sourceFiles; _a < sourceFiles_1.length; _a++) { var sourceFile = sourceFiles_1[_a], result = action(getOutputPathsFor(sourceFile, host, emitOnlyDtsFiles), sourceFile); if (result) return result } } function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); if (274 === sourceFile.kind) { var jsFilePath = options.outFile || options.out, sourceMapFilePath = getSourceMapFilePath(jsFilePath, options), declarationFilePath = forceDtsPaths || options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : void 0, declarationMapPath = ts.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0, bundleInfoPath = options.references && jsFilePath && ts.removeFileExtension(jsFilePath) + infoExtension; return { jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath, declarationMapPath: declarationMapPath, bundleInfoPath: bundleInfoPath } } var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)), sourceMapFilePath = ts.isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options), isJs = ts.isSourceFileJavaScript(sourceFile), declarationFilePath = !forceDtsPaths && !options.declaration || isJs ? void 0 : ts.getDeclarationEmitOutputFilePath(sourceFile, host), declarationMapPath = ts.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0; return { jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath, declarationMapPath: declarationMapPath, bundleInfoPath: void 0 } } function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap && !options.inlineSourceMap ? jsFilePath + ".map" : void 0 } function createDefaultBundleInfo() { return { originalOffset: -1, totalLength: -1 } } function getOutputExtension(sourceFile, options) { if (ts.isJsonSourceFile(sourceFile)) return ".json"; if (1 === options.jsx) if (ts.isSourceFileJavaScript(sourceFile)) { if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) return ".jsx" } else if (1 === sourceFile.languageVariant) return ".jsx"; return ".js" } function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers) { function emitSourceFileOrBundle(_a, sourceFileOrBundle) { var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, bundleInfoPath = _a.bundleInfoPath; emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, bundleInfoPath), emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath), !emitSkipped && emittedFilesList && (emitOnlyDtsFiles || emittedFilesList.push(jsFilePath), sourceMapFilePath && emittedFilesList.push(sourceMapFilePath), declarationFilePath && emittedFilesList.push(declarationFilePath), bundleInfoPath && emittedFilesList.push(bundleInfoPath)) } function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, bundleInfoPath) { if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit || compilerOptions.emitDeclarationOnly) return void (emitSkipped = !0); if (!emitOnlyDtsFiles) { var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, !1), printer = createPrinter(__assign({}, compilerOptions, { noEmitHelpers: compilerOptions.noEmitHelpers }), { hasGlobalName: resolver.hasGlobalName, onEmitNode: transform.emitNodeWithNotification, substituteNode: transform.substituteNode, onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, onEmitSourceMapOfPosition: sourceMap.emitPos, onSetSourceFile: setSourceFile }); ts.Debug.assert(1 === transform.transformed.length, "Should only see one output from the transform"), printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], bundleInfoPath, printer, sourceMap), transform.dispose() } } function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath) { if (declarationFilePath && !ts.isInJavaScriptFile(sourceFileOrBundle)) { var sourceFiles = ts.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles, nonJsFiles = ts.filter(sourceFiles, ts.isSourceFileNotJavaScript), inputListOrBundle = compilerOptions.outFile || compilerOptions.out ? [ts.createBundle(nonJsFiles, ts.isSourceFile(sourceFileOrBundle) ? void 0 : sourceFileOrBundle.prepends)] : nonJsFiles, declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), !1); if (ts.length(declarationTransform.diagnostics)) for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) { var diagnostic = _b[_a]; emitterDiagnostics.add(diagnostic) } var declarationPrinter = createPrinter(__assign({}, compilerOptions, { onlyPrintJsDocStyle: !0, noEmitHelpers: !0 }), { hasGlobalName: resolver.hasGlobalName, onEmitSourceMapOfNode: declarationSourceMap.emitNodeWithSourceMap, onEmitSourceMapOfToken: declarationSourceMap.emitTokenWithSourceMap, onEmitSourceMapOfPosition: declarationSourceMap.emitPos, onSetSourceFile: setSourceFileForDeclarationSourceMaps, onEmitNode: declarationTransform.emitNodeWithNotification, substituteNode: declarationTransform.substituteNode }), declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit; emitSkipped = emitSkipped || declBlocked, declBlocked && !emitOnlyDtsFiles || (ts.Debug.assert(1 === declarationTransform.transformed.length, "Should only see one output from the decl transform"), printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], void 0, declarationPrinter, declarationSourceMap)), declarationTransform.dispose() } } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, bundleInfoPath, printer, mapRecorder) { var bundle = 274 === sourceFileOrBundle.kind ? sourceFileOrBundle : void 0, sourceFile = 273 === sourceFileOrBundle.kind ? sourceFileOrBundle : void 0, sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; mapRecorder.initialize(jsFilePath, sourceMapFilePath || "", sourceFileOrBundle, sourceMapDataList), bundle ? printer.writeBundle(bundle, writer, bundleInfo) : printer.writeFile(sourceFile, writer), writer.writeLine(); var sourceMappingURL = mapRecorder.getSourceMappingURL(); sourceMappingURL && writer.write("//# sourceMappingURL=" + sourceMappingURL), sourceMapFilePath && ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, mapRecorder.getText(), !1, sourceFiles), ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles), bundleInfoPath && (bundleInfo.totalLength = writer.getTextPos(), ts.writeFile(host, emitterDiagnostics, bundleInfoPath, JSON.stringify(bundleInfo, void 0, 2), !1)), mapRecorder.reset(), writer.clear(), bundleInfo = createDefaultBundleInfo(); } function setSourceFile(node) { sourceMap.setSourceFile(node) } function setSourceFileForDeclarationSourceMaps(node) { declarationSourceMap.setSourceFile(node) } var compilerOptions = host.getCompilerOptions(), sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0, emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0, emitterDiagnostics = ts.createDiagnosticCollection(), newLine = host.getNewLine(), writer = ts.createTextWriter(newLine), sourceMap = ts.createSourceMapWriter(host, writer), declarationSourceMap = ts.createSourceMapWriter(host, writer, { sourceMap: compilerOptions.declarationMap, sourceRoot: compilerOptions.sourceRoot, mapRoot: compilerOptions.mapRoot, extendedDiagnostics: compilerOptions.extendedDiagnostics }), bundleInfo = createDefaultBundleInfo(), emitSkipped = !1; return ts.performance.mark("beforePrint"), forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile), emitOnlyDtsFiles), ts.performance.measure("printTime", "beforePrint"), { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList } } function createPrinter(printerOptions, handlers) { function printNode(hint, node, sourceFile) { switch (hint) { case 0: ts.Debug.assert(ts.isSourceFile(node), "Expected a SourceFile node."); break; case 2: ts.Debug.assert(ts.isIdentifier(node), "Expected an Identifier node."); break; case 1: ts.Debug.assert(ts.isExpression(node), "Expected an Expression node.") }switch (node.kind) { case 273: return printFile(node); case 274: return printBundle(node); case 275: return printUnparsedSource(node) }return writeNode(hint, node, sourceFile, beginPrint()), endPrint() } function printList(format, nodes, sourceFile) { return writeList(format, nodes, sourceFile, beginPrint()), endPrint() } function printBundle(bundle) { return writeBundle(bundle, beginPrint()), endPrint() } function printFile(sourceFile) { return writeFile(sourceFile, beginPrint()), endPrint() } function printUnparsedSource(unparsed) { return writeUnparsedSource(unparsed, beginPrint()), endPrint() } function writeNode(hint, node, sourceFile, output) { var previousWriter = writer; setWriter(output), print(hint, node, sourceFile), reset(), writer = previousWriter } function writeList(format, nodes, sourceFile, output) { var previousWriter = writer; setWriter(output), sourceFile && setSourceFile(sourceFile), emitList(syntheticParent, nodes, format), reset(), writer = previousWriter } function writeBundle(bundle, output, bundleInfo) { isOwnFileEmit = !1; var previousWriter = writer; setWriter(output), emitShebangIfNeeded(bundle), emitPrologueDirectivesIfNeeded(bundle), emitHelpers(bundle), emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (var _a = 0, _b = bundle.prepends; _a < _b.length; _a++) { var prepend = _b[_a]; print(4, prepend, void 0), writeLine() } bundleInfo && (bundleInfo.originalOffset = writer.getTextPos()); for (var _c = 0, _d = bundle.sourceFiles; _c < _d.length; _c++) { var sourceFile = _d[_c]; print(0, sourceFile, sourceFile) } reset(), writer = previousWriter } function writeUnparsedSource(unparsed, output) { var previousWriter = writer; setWriter(output), print(4, unparsed, void 0), reset(), writer = previousWriter } function writeFile(sourceFile, output) { isOwnFileEmit = !0; var previousWriter = writer; setWriter(output), emitShebangIfNeeded(sourceFile), emitPrologueDirectivesIfNeeded(sourceFile), print(0, sourceFile, sourceFile), reset(), writer = previousWriter } function beginPrint() { return ownWriter || (ownWriter = ts.createTextWriter(newLine)) } function endPrint() { var text = ownWriter.getText(); return ownWriter.clear(), text } function print(hint, node, sourceFile) { sourceFile && setSourceFile(sourceFile); var pipelinePhase = getPipelinePhase(0, hint); pipelinePhase(hint, node) } function setSourceFile(sourceFile) { currentSourceFile = sourceFile, comments.setSourceFile(sourceFile), onSetSourceFile && onSetSourceFile(sourceFile) } function setWriter(output) { writer = output, comments.setWriter(output) } function reset() { nodeIdToGeneratedName = [], autoGeneratedIdToGeneratedName = [], generatedNames = ts.createMap(), tempFlagsStack = [], tempFlags = 0, reservedNamesStack = [], comments.reset(), setWriter(void 0) } function emit(node) { if (node) { var pipelinePhase = getPipelinePhase(0, 4); pipelinePhase(4, node) } } function emitIdentifierName(node) { if (node) { var pipelinePhase = getPipelinePhase(0, 2); pipelinePhase(2, node) } } function emitExpression(node) { if (node) { var pipelinePhase = getPipelinePhase(0, 1); pipelinePhase(1, node) } } function getPipelinePhase(phase, hint) { switch (phase) { case 0: if (onEmitNode) return pipelineEmitWithNotification; case 1: return emitNodeWithComments && 0 !== hint ? pipelineEmitWithComments : pipelineEmitWithoutComments; case 2: if (onEmitSourceMapOfNode && 0 !== hint && 2 !== hint) return pipelineEmitWithSourceMap; case 3: return pipelineEmitWithHint; default: return ts.Debug.assertNever(phase, "Unexpected value for PipelinePhase: " + phase) } } function getNextPipelinePhase(currentPhase, hint) { return getPipelinePhase(currentPhase + 1, hint) } function pipelineEmitWithNotification(hint, node) { ts.Debug.assertDefined(onEmitNode), onEmitNode(hint, node, getNextPipelinePhase(0, hint)) } function pipelineEmitWithComments(hint, node) { ts.Debug.assertDefined(emitNodeWithComments), ts.Debug.assert(0 !== hint), emitNodeWithComments(hint, trySubstituteNode(hint, node), getNextPipelinePhase(1, hint)) } function pipelineEmitWithoutComments(hint, node) { var pipelinePhase = getNextPipelinePhase(1, hint); pipelinePhase(hint, trySubstituteNode(hint, node)) } function pipelineEmitWithSourceMap(hint, node) { ts.Debug.assertDefined(onEmitSourceMapOfNode), ts.Debug.assert(0 !== hint && 2 !== hint), onEmitSourceMapOfNode(hint, node, pipelineEmitWithHint) } function pipelineEmitWithHint(hint, node) { if (0 === hint) return emitSourceFile(ts.cast(node, ts.isSourceFile)); if (2 === hint) return emitIdentifier(ts.cast(node, ts.isIdentifier)); if (3 === hint) return emitMappedTypeParameter(ts.cast(node, ts.isTypeParameterDeclaration)); if (4 === hint) { if (ts.isKeyword(node.kind)) return writeTokenNode(node, writeKeyword); switch (node.kind) { case 14: case 15: case 16: return emitLiteral(node); case 275: return emitUnparsedSource(node); case 71: return emitIdentifier(node); case 145: return emitQualifiedName(node); case 146: return emitComputedPropertyName(node); case 147: return emitTypeParameter(node); case 148: return emitParameter(node); case 149: return emitDecorator(node); case 150: return emitPropertySignature(node); case 151: return emitPropertyDeclaration(node); case 152: return emitMethodSignature(node); case 153: return emitMethodDeclaration(node); case 154: return emitConstructor(node); case 155: case 156: return emitAccessorDeclaration(node); case 157: return emitCallSignature(node); case 158: return emitConstructSignature(node); case 159: return emitIndexSignature(node); case 160: return emitTypePredicate(node); case 161: return emitTypeReference(node); case 162: return emitFunctionType(node); case 283: return emitJSDocFunctionType(node); case 163: return emitConstructorType(node); case 164: return emitTypeQuery(node); case 165: return emitTypeLiteral(node); case 166: return emitArrayType(node); case 167: return emitTupleType(node); case 168: return emitUnionType(node); case 169: return emitIntersectionType(node); case 170: return emitConditionalType(node); case 171: return emitInferType(node); case 172: return emitParenthesizedType(node); case 206: return emitExpressionWithTypeArguments(node); case 173: return emitThisType(); case 174: return emitTypeOperator(node); case 175: return emitIndexedAccessType(node); case 176: return emitMappedType(node); case 177: return emitLiteralType(node); case 178: return emitImportTypeNode(node); case 278: return void write("*"); case 279: return void write("?"); case 280: return emitJSDocNullableType(node); case 281: return emitJSDocNonNullableType(node); case 282: return emitJSDocOptionalType(node); case 284: return emitJSDocVariadicType(node); case 179: return emitObjectBindingPattern(node); case 180: return emitArrayBindingPattern(node); case 181: return emitBindingElement(node); case 210: return emitTemplateSpan(node); case 211: return emitSemicolonClassElement(); case 212: return emitBlock(node); case 213: return emitVariableStatement(node); case 214: return emitEmptyStatement(); case 215: return emitExpressionStatement(node); case 216: return emitIfStatement(node); case 217: return emitDoStatement(node); case 218: return emitWhileStatement(node); case 219: return emitForStatement(node); case 220: return emitForInStatement(node); case 221: return emitForOfStatement(node); case 222: return emitContinueStatement(node); case 223: return emitBreakStatement(node); case 224: return emitReturnStatement(node); case 225: return emitWithStatement(node); case 226: return emitSwitchStatement(node); case 227: return emitLabeledStatement(node); case 228: return emitThrowStatement(node); case 229: return emitTryStatement(node); case 230: return emitDebuggerStatement(node); case 231: return emitVariableDeclaration(node); case 232: return emitVariableDeclarationList(node); case 233: return emitFunctionDeclaration(node); case 234: return emitClassDeclaration(node); case 235: return emitInterfaceDeclaration(node); case 236: return emitTypeAliasDeclaration(node); case 237: return emitEnumDeclaration(node); case 238: return emitModuleDeclaration(node); case 239: return emitModuleBlock(node); case 240: return emitCaseBlock(node); case 241: return emitNamespaceExportDeclaration(node); case 242: return emitImportEqualsDeclaration(node); case 243: return emitImportDeclaration(node); case 244: return emitImportClause(node); case 245: return emitNamespaceImport(node); case 246: return emitNamedImports(node); case 247: return emitImportSpecifier(node); case 248: return emitExportAssignment(node); case 249: return emitExportDeclaration(node); case 250: return emitNamedExports(node); case 251: return emitExportSpecifier(node); case 252: return; case 253: return emitExternalModuleReference(node); case 10: return emitJsxText(node); case 256: case 259: return emitJsxOpeningElementOrFragment(node); case 257: case 260: return emitJsxClosingElementOrFragment(node); case 261: return emitJsxAttribute(node); case 262: return emitJsxAttributes(node); case 263: return emitJsxSpreadAttribute(node); case 264: return emitJsxExpression(node); case 265: return emitCaseClause(node); case 266: return emitDefaultClause(node); case 267: return emitHeritageClause(node); case 268: return emitCatchClause(node); case 269: return emitPropertyAssignment(node); case 270: return emitShorthandPropertyAssignment(node); case 271: return emitSpreadAssignment(node); case 272: return emitEnumMember(node) }if (ts.isExpression(node)) hint = 1, node = trySubstituteNode(1, node); else if (ts.isToken(node)) return writeTokenNode(node, writePunctuation) } if (1 === hint) switch (node.kind) { case 8: return emitNumericLiteral(node); case 9: case 12: case 13: return emitLiteral(node); case 71: return emitIdentifier(node); case 86: case 95: case 97: case 101: case 99: case 91: return void writeTokenNode(node, writeKeyword); case 182: return emitArrayLiteralExpression(node); case 183: return emitObjectLiteralExpression(node); case 184: return emitPropertyAccessExpression(node); case 185: return emitElementAccessExpression(node); case 186: return emitCallExpression(node); case 187: return emitNewExpression(node); case 188: return emitTaggedTemplateExpression(node); case 189: return emitTypeAssertionExpression(node); case 190: return emitParenthesizedExpression(node); case 191: return emitFunctionExpression(node); case 192: return emitArrowFunction(node); case 193: return emitDeleteExpression(node); case 194: return emitTypeOfExpression(node); case 195: return emitVoidExpression(node); case 196: return emitAwaitExpression(node); case 197: return emitPrefixUnaryExpression(node); case 198: return emitPostfixUnaryExpression(node); case 199: return emitBinaryExpression(node); case 200: return emitConditionalExpression(node); case 201: return emitTemplateExpression(node); case 202: return emitYieldExpression(node); case 203: return emitSpreadExpression(node); case 204: return emitClassExpression(node); case 205: return; case 207: return emitAsExpression(node); case 208: return emitNonNullExpression(node); case 209: return emitMetaProperty(node); case 254: return emitJsxElement(node); case 255: return emitJsxSelfClosingElement(node); case 258: return emitJsxFragment(node); case 300: return emitPartiallyEmittedExpression(node); case 301: return emitCommaList(node) } } function emitMappedTypeParameter(node) { emit(node.name), writeSpace(), writeKeyword("in"), writeSpace(), emit(node.constraint) } function trySubstituteNode(hint, node) { return node && substituteNode && substituteNode(hint, node) || node } function emitHelpers(node) { var helpersEmitted = !1, bundle = 274 === node.kind ? node : void 0; if (!bundle || moduleKind !== ts.ModuleKind.None) { for (var numNodes = bundle ? bundle.sourceFiles.length : 1, i = 0; i < numNodes; i++) { var currentNode = bundle ? bundle.sourceFiles[i] : node, sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile, shouldSkip = printerOptions.noEmitHelpers || void 0 !== ts.getExternalHelpersModuleName(sourceFile), shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit, helpers = ts.getEmitHelpers(currentNode); if (helpers) for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { var helper = _b[_a]; if (helper.scoped) { if (bundle) continue } else { if (shouldSkip) continue; if (shouldBundle) { if (bundledHelpers.get(helper.name)) continue; bundledHelpers.set(helper.name, !0) } } writeLines("string" == typeof helper.text ? helper.text : helper.text(makeFileLevelOptmiisticUniqueName)), helpersEmitted = !0 } } return helpersEmitted } } function emitNumericLiteral(node) { emitLiteral(node) } function emitLiteral(node) { var text = getLiteralTextOfNode(node); !printerOptions.sourceMap && !printerOptions.inlineSourceMap || 9 !== node.kind && !ts.isTemplateLiteralKind(node.kind) ? writeStringLiteral(text) : writeLiteral(text) } function emitUnparsedSource(unparsed) { write(unparsed.text) } function emitIdentifier(node) { var writeText = node.symbol ? writeSymbol : write; writeText(getTextOfNode(node, !1), node.symbol), emitList(node, node.typeArguments, 26896) } function emitQualifiedName(node) { emitEntityName(node.left), writePunctuation("."), emit(node.right) } function emitEntityName(node) { 71 === node.kind ? emitExpression(node) : emit(node) } function emitComputedPropertyName(node) { writePunctuation("["), emitExpression(node.expression), writePunctuation("]") } function emitTypeParameter(node) { emit(node.name), node.constraint && (writeSpace(), writeKeyword("extends"), writeSpace(), emit(node.constraint)), node.default && (writeSpace(), writeOperator("="), writeSpace(), emit(node.default)) } function emitParameter(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emit(node.dotDotDotToken), emitNodeWithWriter(node.name, writeParameter), emit(node.questionToken), node.parent && 283 === node.parent.kind && !node.name ? emit(node.type) : emitTypeAnnotation(node.type), emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name ? node.name.end : node.modifiers ? node.modifiers.end : node.decorators ? node.decorators.end : node.pos, node) } function emitDecorator(decorator) { writePunctuation("@"), emitExpression(decorator.expression) } function emitPropertySignature(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emitNodeWithWriter(node.name, writeProperty), emit(node.questionToken), emitTypeAnnotation(node.type), writeSemicolon() } function emitPropertyDeclaration(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emit(node.name), emit(node.questionToken), emit(node.exclamationToken), emitTypeAnnotation(node.type), emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name.end, node), writeSemicolon() } function emitMethodSignature(node) { pushNameGenerationScope(node), emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emit(node.name), emit(node.questionToken), emitTypeParameters(node, node.typeParameters), emitParameters(node, node.parameters), emitTypeAnnotation(node.type), writeSemicolon(), popNameGenerationScope(node) } function emitMethodDeclaration(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emit(node.asteriskToken), emit(node.name), emit(node.questionToken), emitSignatureAndBody(node, emitSignatureHead) } function emitConstructor(node) { emitModifiers(node, node.modifiers), writeKeyword("constructor"), emitSignatureAndBody(node, emitSignatureHead) } function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), writeKeyword(155 === node.kind ? "get" : "set"), writeSpace(), emit(node.name), emitSignatureAndBody(node, emitSignatureHead) } function emitCallSignature(node) { pushNameGenerationScope(node), emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emitTypeParameters(node, node.typeParameters), emitParameters(node, node.parameters), emitTypeAnnotation(node.type), writeSemicolon(), popNameGenerationScope(node) } function emitConstructSignature(node) { pushNameGenerationScope(node), emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), writeKeyword("new"), writeSpace(), emitTypeParameters(node, node.typeParameters), emitParameters(node, node.parameters), emitTypeAnnotation(node.type), writeSemicolon(), popNameGenerationScope(node) } function emitIndexSignature(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emitParametersForIndexSignature(node, node.parameters), emitTypeAnnotation(node.type), writeSemicolon() } function emitSemicolonClassElement() { writeSemicolon() } function emitTypePredicate(node) { emit(node.parameterName), writeSpace(), writeKeyword("is"), writeSpace(), emit(node.type) } function emitTypeReference(node) { emit(node.typeName), emitTypeArguments(node, node.typeArguments) } function emitFunctionType(node) { pushNameGenerationScope(node), emitTypeParameters(node, node.typeParameters), emitParametersForArrow(node, node.parameters), writeSpace(), writePunctuation("=>"), writeSpace(), emit(node.type), popNameGenerationScope(node) } function emitJSDocFunctionType(node) { write("function"), emitParameters(node, node.parameters), write(":"), emit(node.type) } function emitJSDocNullableType(node) { write("?"), emit(node.type) } function emitJSDocNonNullableType(node) { write("!"), emit(node.type) } function emitJSDocOptionalType(node) { emit(node.type), write("=") } function emitConstructorType(node) { pushNameGenerationScope(node), writeKeyword("new"), writeSpace(), emitTypeParameters(node, node.typeParameters), emitParameters(node, node.parameters), writeSpace(), writePunctuation("=>"), writeSpace(), emit(node.type), popNameGenerationScope(node) } function emitTypeQuery(node) { writeKeyword("typeof"), writeSpace(), emit(node.exprName) } function emitTypeLiteral(node) { writePunctuation("{"); var flags = 1 & ts.getEmitFlags(node) ? 384 : 16449; emitList(node, node.members, 262144 | flags), writePunctuation("}") } function emitArrayType(node) { emit(node.elementType), writePunctuation("["), writePunctuation("]") } function emitJSDocVariadicType(node) { write("..."), emit(node.type) } function emitTupleType(node) { writePunctuation("["), emitList(node, node.elementTypes, 272), writePunctuation("]") } function emitUnionType(node) { emitList(node, node.types, 260) } function emitIntersectionType(node) { emitList(node, node.types, 264) } function emitConditionalType(node) { emit(node.checkType), writeSpace(), writeKeyword("extends"), writeSpace(), emit(node.extendsType), writeSpace(), writePunctuation("?"), writeSpace(), emit(node.trueType), writeSpace(), writePunctuation(":"), writeSpace(), emit(node.falseType) } function emitInferType(node) { writeKeyword("infer"), writeSpace(), emit(node.typeParameter) } function emitParenthesizedType(node) { writePunctuation("("), emit(node.type), writePunctuation(")") } function emitThisType() { writeKeyword("this") } function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword), writeSpace(), emit(node.type) } function emitIndexedAccessType(node) { emit(node.objectType), writePunctuation("["), emit(node.indexType), writePunctuation("]") } function emitMappedType(node) { var emitFlags = ts.getEmitFlags(node); writePunctuation("{"), 1 & emitFlags ? writeSpace() : (writeLine(), increaseIndent()), node.readonlyToken && (emit(node.readonlyToken), 132 !== node.readonlyToken.kind && writeKeyword("readonly"), writeSpace()), writePunctuation("["); var pipelinePhase = getPipelinePhase(0, 3); pipelinePhase(3, node.typeParameter), writePunctuation("]"), node.questionToken && (emit(node.questionToken), 55 !== node.questionToken.kind && writePunctuation("?")), writePunctuation(":"), writeSpace(), emit(node.type), writeSemicolon(), 1 & emitFlags ? writeSpace() : (writeLine(), decreaseIndent()), writePunctuation("}") } function emitLiteralType(node) { emitExpression(node.literal) } function emitImportTypeNode(node) { node.isTypeOf && (writeKeyword("typeof"), writeSpace()), writeKeyword("import"), writePunctuation("("), emit(node.argument), writePunctuation(")"), node.qualifier && (writePunctuation("."), emit(node.qualifier)), emitTypeArguments(node, node.typeArguments) } function emitObjectBindingPattern(node) { writePunctuation("{"), emitList(node, node.elements, 262576), writePunctuation("}") } function emitArrayBindingPattern(node) { writePunctuation("["), emitList(node, node.elements, 262448), writePunctuation("]") } function emitBindingElement(node) { emit(node.dotDotDotToken), node.propertyName && (emit(node.propertyName), writePunctuation(":"), writeSpace()), emit(node.name), emitInitializer(node.initializer, node.name.end, node) } function emitArrayLiteralExpression(node) { var elements = node.elements, preferNewLine = node.multiLine ? 32768 : 0; emitExpressionList(node, elements, 4466 | preferNewLine) } function emitObjectLiteralExpression(node) { ts.forEach(node.properties, generateMemberNames); var indentedFlag = 65536 & ts.getEmitFlags(node); indentedFlag && increaseIndent(); var preferNewLine = node.multiLine ? 32768 : 0, allowTrailingComma = currentSourceFile.languageVersion >= 1 && !ts.isJsonSourceFile(currentSourceFile) ? 32 : 0; emitList(node, node.properties, 263122 | allowTrailingComma | preferNewLine), indentedFlag && decreaseIndent() } function emitPropertyAccessExpression(node) { var indentBeforeDot = !1, indentAfterDot = !1; if (!(131072 & ts.getEmitFlags(node))) { var dotRangeStart = node.expression.end, dotRangeEnd = ts.skipTrivia(currentSourceFile.text, node.expression.end) + 1, dotToken = ts.createToken(23); dotToken.pos = dotRangeStart, dotToken.end = dotRangeEnd, indentBeforeDot = needsIndentation(node, node.expression, dotToken), indentAfterDot = needsIndentation(node, dotToken, node.name) } emitExpression(node.expression), increaseIndentIf(indentBeforeDot); var shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression); shouldEmitDotDot && writePunctuation("."), emitTokenWithComment(23, node.expression.end, writePunctuation, node), increaseIndentIf(indentAfterDot), emit(node.name), decreaseIndentIf(indentBeforeDot, indentAfterDot) } function needsDotDotForPropertyAccess(expression) { if (expression = ts.skipPartiallyEmittedExpressions(expression), ts.isNumericLiteral(expression)) { var text = getLiteralTextOfNode(expression); return !expression.numericLiteralFlags && !ts.stringContains(text, ts.tokenToString(23)) } if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { var constantValue = ts.getConstantValue(expression); return "number" == typeof constantValue && isFinite(constantValue) && Math.floor(constantValue) === constantValue && printerOptions.removeComments } } function emitElementAccessExpression(node) { emitExpression(node.expression), emitTokenWithComment(21, node.expression.end, writePunctuation, node), emitExpression(node.argumentExpression), emitTokenWithComment(22, node.argumentExpression.end, writePunctuation, node) } function emitCallExpression(node) { emitExpression(node.expression), emitTypeArguments(node, node.typeArguments), emitExpressionList(node, node.arguments, 1296) } function emitNewExpression(node) { emitTokenWithComment(94, node.pos, writeKeyword, node), writeSpace(), emitExpression(node.expression), emitTypeArguments(node, node.typeArguments), emitExpressionList(node, node.arguments, 9488) } function emitTaggedTemplateExpression(node) { emitExpression(node.tag), emitTypeArguments(node, node.typeArguments), writeSpace(), emitExpression(node.template) } function emitTypeAssertionExpression(node) { writePunctuation("<"), emit(node.type), writePunctuation(">"), emitExpression(node.expression) } function emitParenthesizedExpression(node) { var openParenPos = emitTokenWithComment(19, node.pos, writePunctuation, node); emitExpression(node.expression), emitTokenWithComment(20, node.expression ? node.expression.end : openParenPos, writePunctuation, node) } function emitFunctionExpression(node) { generateNameIfNeeded(node.name), emitFunctionDeclarationOrExpression(node) } function emitArrowFunction(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), emitSignatureAndBody(node, emitArrowFunctionHead) } function emitArrowFunctionHead(node) { emitTypeParameters(node, node.typeParameters), emitParametersForArrow(node, node.parameters), emitTypeAnnotation(node.type), writeSpace(), emit(node.equalsGreaterThanToken) } function emitDeleteExpression(node) { emitTokenWithComment(80, node.pos, writeKeyword, node), writeSpace(), emitExpression(node.expression) } function emitTypeOfExpression(node) { emitTokenWithComment(103, node.pos, writeKeyword, node), writeSpace(), emitExpression(node.expression) } function emitVoidExpression(node) { emitTokenWithComment(105, node.pos, writeKeyword, node), writeSpace(), emitExpression(node.expression) } function emitAwaitExpression(node) { emitTokenWithComment(121, node.pos, writeKeyword, node), writeSpace(), emitExpression(node.expression) } function emitPrefixUnaryExpression(node) { writeTokenText(node.operator, writeOperator), shouldEmitWhitespaceBeforeOperand(node) && writeSpace(), emitExpression(node.operand) } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; return 197 === operand.kind && (37 === node.operator && (37 === operand.operator || 43 === operand.operator) || 38 === node.operator && (38 === operand.operator || 44 === operand.operator)) } function emitPostfixUnaryExpression(node) { emitExpression(node.operand), writeTokenText(node.operator, writeOperator) } function emitBinaryExpression(node) { var isCommaOperator = 26 !== node.operatorToken.kind, indentBeforeOperator = needsIndentation(node, node.left, node.operatorToken), indentAfterOperator = needsIndentation(node, node.operatorToken, node.right); emitExpression(node.left), increaseIndentIf(indentBeforeOperator, isCommaOperator ? " " : void 0), emitLeadingCommentsOfPosition(node.operatorToken.pos), writeTokenNode(node.operatorToken, writeOperator), emitTrailingCommentsOfPosition(node.operatorToken.end, !0), increaseIndentIf(indentAfterOperator, " "), emitExpression(node.right), decreaseIndentIf(indentBeforeOperator, indentAfterOperator) } function emitConditionalExpression(node) { var indentBeforeQuestion = needsIndentation(node, node.condition, node.questionToken), indentAfterQuestion = needsIndentation(node, node.questionToken, node.whenTrue), indentBeforeColon = needsIndentation(node, node.whenTrue, node.colonToken), indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse); emitExpression(node.condition), increaseIndentIf(indentBeforeQuestion, " "), emit(node.questionToken), increaseIndentIf(indentAfterQuestion, " "), emitExpression(node.whenTrue), decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion), increaseIndentIf(indentBeforeColon, " "), emit(node.colonToken), increaseIndentIf(indentAfterColon, " "), emitExpression(node.whenFalse), decreaseIndentIf(indentBeforeColon, indentAfterColon) } function emitTemplateExpression(node) { emit(node.head), emitList(node, node.templateSpans, 131072) } function emitYieldExpression(node) { emitTokenWithComment(116, node.pos, writeKeyword, node), emit(node.asteriskToken), emitExpressionWithLeadingSpace(node.expression) } function emitSpreadExpression(node) { writePunctuation("..."), emitExpression(node.expression) } function emitClassExpression(node) { generateNameIfNeeded(node.name), emitClassDeclarationOrExpression(node) } function emitExpressionWithTypeArguments(node) { emitExpression(node.expression), emitTypeArguments(node, node.typeArguments) } function emitAsExpression(node) { emitExpression(node.expression), node.type && (writeSpace(), writeKeyword("as"), writeSpace(), emit(node.type)) } function emitNonNullExpression(node) { emitExpression(node.expression), writeOperator("!") } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation), writePunctuation("."), emit(node.name) } function emitTemplateSpan(node) { emitExpression(node.expression), emit(node.literal) } function emitBlock(node) { emitBlockStatements(node, !node.multiLine && isEmptyBlock(node)) } function emitBlockStatements(node, forceSingleLine) { emitTokenWithComment(17, node.pos, writePunctuation, node); var format = forceSingleLine || 1 & ts.getEmitFlags(node) ? 384 : 65; emitList(node, node.statements, format), emitTokenWithComment(18, node.statements.end, writePunctuation, node, !!(1 & format)) } function emitVariableStatement(node) { emitModifiers(node, node.modifiers), emit(node.declarationList), writeSemicolon() } function emitEmptyStatement() { writeSemicolon() } function emitExpressionStatement(node) { emitExpression(node.expression), ts.isJsonSourceFile(currentSourceFile) || writeSemicolon() } function emitIfStatement(node) { var openParenPos = emitTokenWithComment(90, node.pos, writeKeyword, node); writeSpace(), emitTokenWithComment(19, openParenPos, writePunctuation, node), emitExpression(node.expression), emitTokenWithComment(20, node.expression.end, writePunctuation, node), emitEmbeddedStatement(node, node.thenStatement), node.elseStatement && (writeLineOrSpace(node), emitTokenWithComment(82, node.thenStatement.end, writeKeyword, node), 216 === node.elseStatement.kind ? (writeSpace(), emit(node.elseStatement)) : emitEmbeddedStatement(node, node.elseStatement)) } function emitWhileClause(node, startPos) { var openParenPos = emitTokenWithComment(106, startPos, writeKeyword, node); writeSpace(), emitTokenWithComment(19, openParenPos, writePunctuation, node), emitExpression(node.expression), emitTokenWithComment(20, node.expression.end, writePunctuation, node) } function emitDoStatement(node) { emitTokenWithComment(81, node.pos, writeKeyword, node), emitEmbeddedStatement(node, node.statement), ts.isBlock(node.statement) ? writeSpace() : writeLineOrSpace(node), emitWhileClause(node, node.statement.end), writePunctuation(";") } function emitWhileStatement(node) { emitWhileClause(node, node.pos), emitEmbeddedStatement(node, node.statement) } function emitForStatement(node) { var openParenPos = emitTokenWithComment(88, node.pos, writeKeyword, node); writeSpace(); var pos = emitTokenWithComment(19, openParenPos, writePunctuation, node); emitForBinding(node.initializer), pos = emitTokenWithComment(25, node.initializer ? node.initializer.end : pos, writeSemicolon, node), emitExpressionWithLeadingSpace(node.condition), pos = emitTokenWithComment(25, node.condition ? node.condition.end : pos, writeSemicolon, node), emitExpressionWithLeadingSpace(node.incrementor), emitTokenWithComment(20, node.incrementor ? node.incrementor.end : pos, writePunctuation, node), emitEmbeddedStatement(node, node.statement) } function emitForInStatement(node) { var openParenPos = emitTokenWithComment(88, node.pos, writeKeyword, node); writeSpace(), emitTokenWithComment(19, openParenPos, writePunctuation, node), emitForBinding(node.initializer), writeSpace(), emitTokenWithComment(92, node.initializer.end, writeKeyword, node), writeSpace(), emitExpression(node.expression), emitTokenWithComment(20, node.expression.end, writePunctuation, node), emitEmbeddedStatement(node, node.statement) } function emitForOfStatement(node) { var openParenPos = emitTokenWithComment(88, node.pos, writeKeyword, node); writeSpace(), emitWithTrailingSpace(node.awaitModifier), emitTokenWithComment(19, openParenPos, writePunctuation, node), emitForBinding(node.initializer), writeSpace(), emitTokenWithComment(144, node.initializer.end, writeKeyword, node), writeSpace(), emitExpression(node.expression), emitTokenWithComment(20, node.expression.end, writePunctuation, node), emitEmbeddedStatement(node, node.statement) } function emitForBinding(node) { void 0 !== node && (232 === node.kind ? emit(node) : emitExpression(node)) } function emitContinueStatement(node) { emitTokenWithComment(77, node.pos, writeKeyword, node), emitWithLeadingSpace(node.label), writeSemicolon() } function emitBreakStatement(node) { emitTokenWithComment(72, node.pos, writeKeyword, node), emitWithLeadingSpace(node.label), writeSemicolon() } function emitTokenWithComment(token, pos, writer, contextNode, indentLeading) { var node = ts.getParseTreeNode(contextNode), isSimilarNode = node && node.kind === contextNode.kind, startPos = pos; if (isSimilarNode && (pos = ts.skipTrivia(currentSourceFile.text, pos)), emitLeadingCommentsOfPosition && isSimilarNode && contextNode.pos !== startPos) { var needsIndent = indentLeading && !ts.positionsAreOnSameLine(startPos, pos, currentSourceFile); needsIndent && increaseIndent(), emitLeadingCommentsOfPosition(startPos), needsIndent && decreaseIndent() } return pos = writeTokenText(token, writer, pos), emitTrailingCommentsOfPosition && isSimilarNode && contextNode.end !== pos && emitTrailingCommentsOfPosition(pos, !0), pos } function emitReturnStatement(node) { emitTokenWithComment(96, node.pos, writeKeyword, node), emitExpressionWithLeadingSpace(node.expression), writeSemicolon() } function emitWithStatement(node) { var openParenPos = emitTokenWithComment(107, node.pos, writeKeyword, node); writeSpace(), emitTokenWithComment(19, openParenPos, writePunctuation, node), emitExpression(node.expression), emitTokenWithComment(20, node.expression.end, writePunctuation, node), emitEmbeddedStatement(node, node.statement) } function emitSwitchStatement(node) { var openParenPos = emitTokenWithComment(98, node.pos, writeKeyword, node); writeSpace(), emitTokenWithComment(19, openParenPos, writePunctuation, node), emitExpression(node.expression), emitTokenWithComment(20, node.expression.end, writePunctuation, node), writeSpace(), emit(node.caseBlock) } function emitLabeledStatement(node) { emit(node.label), emitTokenWithComment(56, node.label.end, writePunctuation, node), writeSpace(), emit(node.statement) } function emitThrowStatement(node) { emitTokenWithComment(100, node.pos, writeKeyword, node), emitExpressionWithLeadingSpace(node.expression), writeSemicolon() } function emitTryStatement(node) { emitTokenWithComment(102, node.pos, writeKeyword, node), writeSpace(), emit(node.tryBlock), node.catchClause && (writeLineOrSpace(node), emit(node.catchClause)), node.finallyBlock && (writeLineOrSpace(node), emitTokenWithComment(87, (node.catchClause || node.tryBlock).end, writeKeyword, node), writeSpace(), emit(node.finallyBlock)) } function emitDebuggerStatement(node) { writeToken(78, node.pos, writeKeyword), writeSemicolon() } function emitVariableDeclaration(node) { emit(node.name), emitTypeAnnotation(node.type), emitInitializer(node.initializer, node.type ? node.type.end : node.name.end, node) } function emitVariableDeclarationList(node) { writeKeyword(ts.isLet(node) ? "let" : ts.isConst(node) ? "const" : "var"), writeSpace(), emitList(node, node.declarations, 272) } function emitFunctionDeclaration(node) { emitFunctionDeclarationOrExpression(node) } function emitFunctionDeclarationOrExpression(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), writeKeyword("function"), emit(node.asteriskToken), writeSpace(), emitIdentifierName(node.name), emitSignatureAndBody(node, emitSignatureHead) } function emitBlockCallback(_hint, body) { emitBlockFunctionBody(body) } function emitSignatureAndBody(node, emitSignatureHead) { var body = node.body; if (body) if (ts.isBlock(body)) { var indentedFlag = 65536 & ts.getEmitFlags(node); indentedFlag && increaseIndent(), pushNameGenerationScope(node), ts.forEach(node.parameters, generateNames), generateNames(node.body), emitSignatureHead(node), onEmitNode ? onEmitNode(4, body, emitBlockCallback) : emitBlockFunctionBody(body), popNameGenerationScope(node), indentedFlag && decreaseIndent() } else emitSignatureHead(node), writeSpace(), emitExpression(body); else emitSignatureHead(node), writeSemicolon() } function emitSignatureHead(node) { emitTypeParameters(node, node.typeParameters), emitParameters(node, node.parameters), emitTypeAnnotation(node.type) } function shouldEmitBlockFunctionBodyOnSingleLine(body) { if (1 & ts.getEmitFlags(body)) return !0; if (body.multiLine) return !1; if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) return !1; if (shouldWriteLeadingLineTerminator(body, body.statements, 2) || shouldWriteClosingLineTerminator(body, body.statements, 2)) return !1; for (var previousStatement, _a = 0, _b = body.statements; _a < _b.length; _a++) { var statement = _b[_a]; if (shouldWriteSeparatingLineTerminator(previousStatement, statement, 2)) return !1; previousStatement = statement } return !0 } function emitBlockFunctionBody(body) { writeSpace(), writePunctuation("{"), increaseIndent(); var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine : emitBlockFunctionBodyWorker; emitBodyWithDetachedComments ? emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody) : emitBlockFunctionBody(body), decreaseIndent(), writeToken(18, body.statements.end, writePunctuation, body) } function emitBlockFunctionBodyOnSingleLine(body) { emitBlockFunctionBodyWorker(body, !0) } function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { var statementOffset = emitPrologueDirectives(body.statements, !0), pos = writer.getTextPos(); emitHelpers(body), 0 === statementOffset && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine ? (decreaseIndent(), emitList(body, body.statements, 384), increaseIndent()) : emitList(body, body.statements, 1, statementOffset) } function emitClassDeclaration(node) { emitClassDeclarationOrExpression(node) } function emitClassDeclarationOrExpression(node) { ts.forEach(node.members, generateMemberNames), emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), writeKeyword("class"), node.name && (writeSpace(), emitIdentifierName(node.name)); var indentedFlag = 65536 & ts.getEmitFlags(node); indentedFlag && increaseIndent(), emitTypeParameters(node, node.typeParameters), emitList(node, node.heritageClauses, 0), writeSpace(), writePunctuation("{"), emitList(node, node.members, 65), writePunctuation("}"), indentedFlag && decreaseIndent() } function emitInterfaceDeclaration(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), writeKeyword("interface"), writeSpace(), emit(node.name), emitTypeParameters(node, node.typeParameters), emitList(node, node.heritageClauses, 256), writeSpace(), writePunctuation("{"), emitList(node, node.members, 65), writePunctuation("}") } function emitTypeAliasDeclaration(node) { emitDecorators(node, node.decorators), emitModifiers(node, node.modifiers), writeKeyword("type"), writeSpace(), emit(node.name), emitTypeParameters(node, node.typeParameters), writeSpace(), writePunctuation("="), writeSpace(), emit(node.type), writeSemicolon() } function emitEnumDeclaration(node) { emitModifiers(node, node.modifiers), writeKeyword("enum"), writeSpace(), emit(node.name), writeSpace(), writePunctuation("{"), emitList(node, node.members, 81), writePunctuation("}") } function emitModuleDeclaration(node) { emitModifiers(node, node.modifiers), 512 & ~node.flags && (writeKeyword(16 & node.flags ? "namespace" : "module"), writeSpace()), emit(node.name); var body = node.body; if (!body) return writeSemicolon(); for (; 238 === body.kind;)writePunctuation("."), emit(body.name), body = body.body; writeSpace(), emit(body) } function emitModuleBlock(node) { pushNameGenerationScope(node), ts.forEach(node.statements, generateNames), emitBlockStatements(node, isEmptyBlock(node)), popNameGenerationScope(node) } function emitCaseBlock(node) { emitTokenWithComment(17, node.pos, writePunctuation, node), emitList(node, node.clauses, 65), emitTokenWithComment(18, node.clauses.end, writePunctuation, node, !0) } function emitImportEqualsDeclaration(node) { emitModifiers(node, node.modifiers), emitTokenWithComment(91, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node), writeSpace(), emit(node.name), writeSpace(), emitTokenWithComment(58, node.name.end, writePunctuation, node), writeSpace(), emitModuleReference(node.moduleReference), writeSemicolon() } function emitModuleReference(node) { 71 === node.kind ? emitExpression(node) : emit(node) } function emitImportDeclaration(node) { emitModifiers(node, node.modifiers), emitTokenWithComment(91, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node), writeSpace(), node.importClause && (emit(node.importClause), writeSpace(), emitTokenWithComment(142, node.importClause.end, writeKeyword, node), writeSpace()), emitExpression(node.moduleSpecifier), writeSemicolon() } function emitImportClause(node) { emit(node.name), node.name && node.namedBindings && (emitTokenWithComment(26, node.name.end, writePunctuation, node), writeSpace()), emit(node.namedBindings) } function emitNamespaceImport(node) { var asPos = emitTokenWithComment(39, node.pos, writePunctuation, node); writeSpace(), emitTokenWithComment(118, asPos, writeKeyword, node), writeSpace(), emit(node.name) } function emitNamedImports(node) { emitNamedImportsOrExports(node) } function emitImportSpecifier(node) { emitImportOrExportSpecifier(node) } function emitExportAssignment(node) { var nextPos = emitTokenWithComment(84, node.pos, writeKeyword, node); writeSpace(), node.isExportEquals ? emitTokenWithComment(58, nextPos, writeOperator, node) : emitTokenWithComment(79, nextPos, writeKeyword, node), writeSpace(), emitExpression(node.expression), writeSemicolon() } function emitExportDeclaration(node) { var nextPos = emitTokenWithComment(84, node.pos, writeKeyword, node); if (writeSpace(), node.exportClause ? emit(node.exportClause) : nextPos = emitTokenWithComment(39, nextPos, writePunctuation, node), node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; emitTokenWithComment(142, fromPos, writeKeyword, node), writeSpace(), emitExpression(node.moduleSpecifier) } writeSemicolon() } function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(84, node.pos, writeKeyword, node); writeSpace(), nextPos = emitTokenWithComment(118, nextPos, writeKeyword, node), writeSpace(), nextPos = emitTokenWithComment(130, nextPos, writeKeyword, node), writeSpace(), emit(node.name), writeSemicolon() } function emitNamedExports(node) { emitNamedImportsOrExports(node) } function emitExportSpecifier(node) { emitImportOrExportSpecifier(node) } function emitNamedImportsOrExports(node) { writePunctuation("{"), emitList(node, node.elements, 262576), writePunctuation("}") } function emitImportOrExportSpecifier(node) { node.propertyName && (emit(node.propertyName), writeSpace(), emitTokenWithComment(118, node.propertyName.end, writeKeyword, node), writeSpace()), emit(node.name) } function emitExternalModuleReference(node) { writeKeyword("require"), writePunctuation("("), emitExpression(node.expression), writePunctuation(")") } function emitJsxElement(node) { emit(node.openingElement), emitList(node, node.children, 131072), emit(node.closingElement) } function emitJsxSelfClosingElement(node) { writePunctuation("<"), emitJsxTagName(node.tagName), writeSpace(), emit(node.attributes), writePunctuation("/>") } function emitJsxFragment(node) { emit(node.openingFragment), emitList(node, node.children, 131072), emit(node.closingFragment) } function emitJsxOpeningElementOrFragment(node) { writePunctuation("<"), ts.isJsxOpeningElement(node) && (emitJsxTagName(node.tagName), node.attributes.properties && node.attributes.properties.length > 0 && writeSpace(), emit(node.attributes)), writePunctuation(">") } function emitJsxText(node) { commitPendingSemicolon(), writer.writeLiteral(getTextOfNode(node, !0)) } function emitJsxClosingElementOrFragment(node) { writePunctuation("") } function emitJsxAttributes(node) { emitList(node, node.properties, 131328) } function emitJsxAttribute(node) { emit(node.name), emitNodeWithPrefix("=", writePunctuation, node.initializer, emit) } function emitJsxSpreadAttribute(node) { writePunctuation("{..."), emitExpression(node.expression), writePunctuation("}") } function emitJsxExpression(node) { node.expression && (writePunctuation("{"), emit(node.dotDotDotToken), emitExpression(node.expression), writePunctuation("}")) } function emitJsxTagName(node) { 71 === node.kind ? emitExpression(node) : emit(node) } function emitCaseClause(node) { emitTokenWithComment(73, node.pos, writeKeyword, node), writeSpace(), emitExpression(node.expression), emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end) } function emitDefaultClause(node) { var pos = emitTokenWithComment(79, node.pos, writeKeyword, node); emitCaseOrDefaultClauseRest(node, node.statements, pos) } function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) { var emitAsSingleStatement = 1 === statements.length && (ts.nodeIsSynthesized(parentNode) || ts.nodeIsSynthesized(statements[0]) || ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile)), format = 81985; emitAsSingleStatement ? (writeToken(56, colonPos, writePunctuation, parentNode), writeSpace(), format &= -66) : emitTokenWithComment(56, colonPos, writePunctuation, parentNode), emitList(parentNode, statements, format) } function emitHeritageClause(node) { writeSpace(), writeTokenText(node.token, writeKeyword), writeSpace(), emitList(node, node.types, 272) } function emitCatchClause(node) { var openParenPos = emitTokenWithComment(74, node.pos, writeKeyword, node); writeSpace(), node.variableDeclaration && (emitTokenWithComment(19, openParenPos, writePunctuation, node), emit(node.variableDeclaration), emitTokenWithComment(20, node.variableDeclaration.end, writePunctuation, node), writeSpace()), emit(node.block) } function emitPropertyAssignment(node) { emit(node.name), writePunctuation(":"), writeSpace(); var initializer = node.initializer; if (emitTrailingCommentsOfPosition && 0 === (512 & ts.getEmitFlags(initializer))) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos) } emitExpression(initializer) } function emitShorthandPropertyAssignment(node) { emit(node.name), node.objectAssignmentInitializer && (writeSpace(), writePunctuation("="), writeSpace(), emitExpression(node.objectAssignmentInitializer)) } function emitSpreadAssignment(node) { node.expression && (writePunctuation("..."), emitExpression(node.expression)) } function emitEnumMember(node) { emit(node.name), emitInitializer(node.initializer, node.name.end, node) } function emitSourceFile(node) { writeLine(); var statements = node.statements; if (emitBodyWithDetachedComments) { var shouldEmitDetachedComment = 0 === statements.length || !ts.isPrologueDirective(statements[0]) || ts.nodeIsSynthesized(statements[0]); if (shouldEmitDetachedComment) return void emitBodyWithDetachedComments(node, statements, emitSourceFileWorker) } emitSourceFileWorker(node) } function emitSyntheticTripleSlashReferencesIfNeeded(node) { emitTripleSlashDirectives(node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || []) } function emitTripleSlashDirectivesIfNeeded(node) { node.isDeclarationFile && emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives) } function emitTripleSlashDirectives(hasNoDefaultLib, files, types) { if (hasNoDefaultLib && (write('/// '), writeLine()), currentSourceFile && currentSourceFile.moduleName && (write('/// '), writeLine()), currentSourceFile && currentSourceFile.amdDependencies) for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) { var dep = _b[_a]; write(dep.name ? '/// ' : '/// '), writeLine() } for (var _c = 0, files_1 = files; _c < files_1.length; _c++) { var directive = files_1[_c]; write('/// '), writeLine() } for (var _d = 0, types_17 = types; _d < types_17.length; _d++) { var directive = types_17[_d]; write('/// '), writeLine() } } function emitSourceFileWorker(node) { var statements = node.statements; pushNameGenerationScope(node), ts.forEach(node.statements, generateNames), emitHelpers(node); var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement) }); emitTripleSlashDirectivesIfNeeded(node), emitList(node, statements, 1, index === -1 ? statements.length : index), popNameGenerationScope(node) } function emitPartiallyEmittedExpression(node) { emitExpression(node.expression) } function emitCommaList(node) { emitExpressionList(node, node.elements, 272) } function emitPrologueDirectives(statements, startWithNewLine, seenPrologueDirectives) { for (var i = 0; i < statements.length; i++) { var statement = statements[i]; if (!ts.isPrologueDirective(statement)) return i; var shouldEmitPrologueDirective = !seenPrologueDirectives || !seenPrologueDirectives.has(statement.expression.text); shouldEmitPrologueDirective && ((startWithNewLine || i > 0) && writeLine(), emit(statement), seenPrologueDirectives && seenPrologueDirectives.set(statement.expression.text, !0)) } return statements.length } function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) { if (ts.isSourceFile(sourceFileOrBundle)) setSourceFile(sourceFileOrBundle), emitPrologueDirectives(sourceFileOrBundle.statements); else for (var seenPrologueDirectives = ts.createMap(), _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { var sourceFile = _b[_a]; setSourceFile(sourceFile), emitPrologueDirectives(sourceFile.statements, !0, seenPrologueDirectives) } } function emitShebangIfNeeded(sourceFileOrBundle) { if (ts.isSourceFile(sourceFileOrBundle)) { var shebang = ts.getShebang(sourceFileOrBundle.text); if (shebang) return write(shebang), writeLine(), !0 } else for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { var sourceFile = _b[_a]; if (emitShebangIfNeeded(sourceFile)) break } } function emitNodeWithWriter(node, writer) { if (node) { var savedWrite = write; write = writer, emit(node), write = savedWrite } } function emitModifiers(node, modifiers) { modifiers && modifiers.length && (emitList(node, modifiers, 131328), writeSpace()) } function emitTypeAnnotation(node) { node && (writePunctuation(":"), writeSpace(), emit(node)) } function emitInitializer(node, equalCommentStartPos, container) { node && (writeSpace(), emitTokenWithComment(58, equalCommentStartPos, writeOperator, container), writeSpace(), emitExpression(node)) } function emitNodeWithPrefix(prefix, prefixWriter, node, emit) { node && (prefixWriter(prefix), emit(node)) } function emitWithLeadingSpace(node) { node && (writeSpace(), emit(node)) } function emitExpressionWithLeadingSpace(node) { node && (writeSpace(), emitExpression(node)) } function emitWithTrailingSpace(node) { node && (emit(node), writeSpace()) } function emitEmbeddedStatement(parent, node) { ts.isBlock(node) || 1 & ts.getEmitFlags(parent) ? (writeSpace(), emit(node)) : (writeLine(), increaseIndent(), emit(node), decreaseIndent()) } function emitDecorators(parentNode, decorators) { emitList(parentNode, decorators, 24577) } function emitTypeArguments(parentNode, typeArguments) { emitList(parentNode, typeArguments, 26896) } function emitTypeParameters(parentNode, typeParameters) { return ts.isFunctionLike(parentNode) && parentNode.typeArguments ? emitTypeArguments(parentNode, parentNode.typeArguments) : void emitList(parentNode, typeParameters, 26896) } function emitParameters(parentNode, parameters) { emitList(parentNode, parameters, 1296) } function canEmitSimpleArrowHead(parentNode, parameters) { var parameter = ts.singleOrUndefined(parameters); return parameter && parameter.pos === parentNode.pos && !(ts.isArrowFunction(parentNode) && parentNode.type) && !ts.some(parentNode.decorators) && !ts.some(parentNode.modifiers) && !ts.some(parentNode.typeParameters) && !ts.some(parameter.decorators) && !ts.some(parameter.modifiers) && !parameter.dotDotDotToken && !parameter.questionToken && !parameter.type && !parameter.initializer && ts.isIdentifier(parameter.name) } function emitParametersForArrow(parentNode, parameters) { canEmitSimpleArrowHead(parentNode, parameters) ? emitList(parentNode, parameters, 272) : emitParameters(parentNode, parameters) } function emitParametersForIndexSignature(parentNode, parameters) { emitList(parentNode, parameters, 4432) } function emitList(parentNode, children, format, start, count) { emitNodeList(emit, parentNode, children, format, start, count) } function emitExpressionList(parentNode, children, format, start, count) { emitNodeList(emitExpression, parentNode, children, format, start, count) } function writeDelimiter(format) { switch (28 & format) { case 0: break; case 16: writePunctuation(","); break; case 4: writeSpace(), writePunctuation("|"); break; case 8: writeSpace(), writePunctuation("&") } } function emitNodeList(emit, parentNode, children, format, start, count) { void 0 === start && (start = 0), void 0 === count && (count = children ? children.length - start : 0); var isUndefined = void 0 === children; if (!(isUndefined && 8192 & format)) { var isEmpty = isUndefined || start >= children.length || 0 === count; if (isEmpty && 16384 & format) return onBeforeEmitNodeArray && onBeforeEmitNodeArray(children), void (onAfterEmitNodeArray && onAfterEmitNodeArray(children)); if (7680 & format && (writePunctuation(getOpeningBracket(format)), isEmpty && !isUndefined && emitTrailingCommentsOfPosition(children.pos, !0)), onBeforeEmitNodeArray && onBeforeEmitNodeArray(children), isEmpty) 1 & format ? writeLine() : 128 & format && !(262144 & format) && writeSpace(); else { var mayEmitInterveningComments = 0 === (131072 & format), shouldEmitInterveningComments = mayEmitInterveningComments; shouldWriteLeadingLineTerminator(parentNode, children, format) ? (writeLine(), shouldEmitInterveningComments = !1) : 128 & format && writeSpace(), 64 & format && increaseIndent(); for (var previousSibling = void 0, shouldDecreaseIndentAfterEmit = void 0, i = 0; i < count; i++) { var child = children[start + i]; if (previousSibling && (28 & format && previousSibling.end !== parentNode.end && emitLeadingCommentsOfPosition(previousSibling.end), writeDelimiter(format), shouldWriteSeparatingLineTerminator(previousSibling, child, format) ? (0 === (67 & format) && (increaseIndent(), shouldDecreaseIndentAfterEmit = !0), writeLine(), shouldEmitInterveningComments = !1) : previousSibling && 256 & format && writeSpace()), shouldEmitInterveningComments) { if (emitTrailingCommentsOfPosition) { var commentRange = ts.getCommentRange(child); emitTrailingCommentsOfPosition(commentRange.pos) } } else shouldEmitInterveningComments = mayEmitInterveningComments; emit(child), shouldDecreaseIndentAfterEmit && (decreaseIndent(), shouldDecreaseIndentAfterEmit = !1), previousSibling = child } var hasTrailingComma = 32 & format && children.hasTrailingComma; 16 & format && hasTrailingComma && writePunctuation(","), previousSibling && 28 & format && previousSibling.end !== parentNode.end && !(1024 & ts.getEmitFlags(previousSibling)) && emitLeadingCommentsOfPosition(previousSibling.end), 64 & format && decreaseIndent(), shouldWriteClosingLineTerminator(parentNode, children, format) ? writeLine() : 128 & format && writeSpace() } onAfterEmitNodeArray && onAfterEmitNodeArray(children), 7680 & format && (isEmpty && !isUndefined && emitLeadingCommentsOfPosition(children.end), writePunctuation(getClosingBracket(format))) } } function commitPendingSemicolonInternal() { pendingSemicolon && (writeSemicolonInternal(), pendingSemicolon = !1) } function writeLiteral(s) { commitPendingSemicolon(), writer.writeLiteral(s) } function writeStringLiteral(s) { commitPendingSemicolon(), writer.writeStringLiteral(s) } function writeBase(s) { commitPendingSemicolon(), writer.write(s) } function writeSymbol(s, sym) { commitPendingSemicolon(), writer.writeSymbol(s, sym) } function writePunctuation(s) { commitPendingSemicolon(), writer.writePunctuation(s) } function deferWriteSemicolon() { pendingSemicolon = !0 } function writeSemicolonInternal() { writer.writePunctuation(";") } function writeKeyword(s) { commitPendingSemicolon(), writer.writeKeyword(s) } function writeOperator(s) { commitPendingSemicolon(), writer.writeOperator(s) } function writeParameter(s) { commitPendingSemicolon(), writer.writeParameter(s) } function writeSpace() { commitPendingSemicolon(), writer.writeSpace(" ") } function writeProperty(s) { commitPendingSemicolon(), writer.writeProperty(s) } function writeLine() { commitPendingSemicolon(), writer.writeLine() } function increaseIndent() { commitPendingSemicolon(), writer.increaseIndent() } function decreaseIndent() { commitPendingSemicolon(), writer.decreaseIndent() } function writeToken(token, pos, writer, contextNode) { return onEmitSourceMapOfToken ? onEmitSourceMapOfToken(contextNode, token, writer, pos, writeTokenText) : writeTokenText(token, writer, pos) } function writeTokenNode(node, writer) { onBeforeEmitToken && onBeforeEmitToken(node), writer(ts.tokenToString(node.kind)), onAfterEmitToken && onAfterEmitToken(node) } function writeTokenText(token, writer, pos) { var tokenString = ts.tokenToString(token); return writer(tokenString), pos < 0 ? pos : pos + tokenString.length } function writeLineOrSpace(node) { 1 & ts.getEmitFlags(node) ? writeSpace() : writeLine() } function writeLines(text) { for (var lines = text.split(/\r\n?|\n/g), indentation = ts.guessIndentation(lines), _a = 0, lines_2 = lines; _a < lines_2.length; _a++) { var lineText = lines_2[_a], line = indentation ? lineText.slice(indentation) : lineText; line.length && (writeLine(), write(line), writeLine()) } } function increaseIndentIf(value, valueToWriteWhenNotIndenting) { value ? (increaseIndent(), writeLine()) : valueToWriteWhenNotIndenting && write(valueToWriteWhenNotIndenting) } function decreaseIndentIf(value1, value2) { value1 && decreaseIndent(), value2 && decreaseIndent() } function shouldWriteLeadingLineTerminator(parentNode, children, format) { if (1 & format) return !0; if (2 & format) { if (32768 & format) return !0; var firstChild = children[0]; return void 0 === firstChild ? !ts.rangeIsOnSingleLine(parentNode, currentSourceFile) : ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(firstChild) ? synthesizedNodeStartsOnNewLine(firstChild, format) : !ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile) } return !1 } function shouldWriteSeparatingLineTerminator(previousNode, nextNode, format) { return !!(1 & format) || (2 & format ? void 0 !== previousNode && void 0 !== nextNode && (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode) ? synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format) : !ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile)) : ts.getStartsOnNewLine(nextNode)) } function shouldWriteClosingLineTerminator(parentNode, children, format) { if (1 & format) return 0 === (65536 & format); if (2 & format) { if (32768 & format) return !0; var lastChild = ts.lastOrUndefined(children); return void 0 === lastChild ? !ts.rangeIsOnSingleLine(parentNode, currentSourceFile) : ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(lastChild) ? synthesizedNodeStartsOnNewLine(lastChild, format) : !ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile) } return !1 } function synthesizedNodeStartsOnNewLine(node, format) { if (ts.nodeIsSynthesized(node)) { var startsOnNewLine = ts.getStartsOnNewLine(node); return void 0 === startsOnNewLine ? 0 !== (32768 & format) : startsOnNewLine } return 0 !== (32768 & format) } function needsIndentation(parent, node1, node2) { return parent = skipSynthesizedParentheses(parent), node1 = skipSynthesizedParentheses(node1), node2 = skipSynthesizedParentheses(node2), !!ts.getStartsOnNewLine(node2) || !(ts.nodeIsSynthesized(parent) || ts.nodeIsSynthesized(node1) || ts.nodeIsSynthesized(node2) || ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile)) } function isEmptyBlock(block) { return 0 === block.statements.length && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile) } function skipSynthesizedParentheses(node) { for (; 190 === node.kind && ts.nodeIsSynthesized(node);)node = node.expression; return node } function getTextOfNode(node, includeTrivia) { return ts.isGeneratedIdentifier(node) ? generateName(node) : ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent || !currentSourceFile || node.parent && currentSourceFile && ts.getSourceFileOfNode(node) !== ts.getOriginalNode(currentSourceFile)) ? ts.idText(node) : 9 === node.kind && node.textSourceNode ? getTextOfNode(node.textSourceNode, includeTrivia) : !ts.isLiteralExpression(node) || !ts.nodeIsSynthesized(node) && node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia) : node.text } function getLiteralTextOfNode(node) { if (9 === node.kind && node.textSourceNode) { var textSourceNode = node.textSourceNode; return ts.isIdentifier(textSourceNode) ? 16777216 & ts.getEmitFlags(node) ? '"' + ts.escapeString(getTextOfNode(textSourceNode)) + '"' : '"' + ts.escapeNonAsciiString(getTextOfNode(textSourceNode)) + '"' : getLiteralTextOfNode(textSourceNode) } return ts.getLiteralText(node, currentSourceFile) } function pushNameGenerationScope(node) { node && 524288 & ts.getEmitFlags(node) || (tempFlagsStack.push(tempFlags), tempFlags = 0, reservedNamesStack.push(reservedNames)) } function popNameGenerationScope(node) { node && 524288 & ts.getEmitFlags(node) || (tempFlags = tempFlagsStack.pop(), reservedNames = reservedNamesStack.pop()) } function reserveNameInNestedScopes(name) { reservedNames && reservedNames !== ts.lastOrUndefined(reservedNamesStack) || (reservedNames = ts.createMap()), reservedNames.set(name, !0) } function generateNames(node) { if (node) switch (node.kind) { case 212: ts.forEach(node.statements, generateNames); break; case 227: case 225: case 217: case 218: generateNames(node.statement); break; case 216: generateNames(node.thenStatement), generateNames(node.elseStatement); break; case 219: case 221: case 220: generateNames(node.initializer), generateNames(node.statement); break; case 226: generateNames(node.caseBlock); break; case 240: ts.forEach(node.clauses, generateNames); break; case 265: case 266: ts.forEach(node.statements, generateNames); break; case 229: generateNames(node.tryBlock), generateNames(node.catchClause), generateNames(node.finallyBlock); break; case 268: generateNames(node.variableDeclaration), generateNames(node.block); break; case 213: generateNames(node.declarationList); break; case 232: ts.forEach(node.declarations, generateNames); break; case 231: case 148: case 181: case 234: generateNameIfNeeded(node.name); break; case 233: generateNameIfNeeded(node.name), 524288 & ts.getEmitFlags(node) && (ts.forEach(node.parameters, generateNames), generateNames(node.body)); break; case 179: case 180: ts.forEach(node.elements, generateNames); break; case 243: generateNames(node.importClause); break; case 244: generateNameIfNeeded(node.name), generateNames(node.namedBindings); break; case 245: generateNameIfNeeded(node.name); break; case 246: ts.forEach(node.elements, generateNames); break; case 247: generateNameIfNeeded(node.propertyName || node.name) } } function generateMemberNames(node) { if (node) switch (node.kind) { case 269: case 270: case 151: case 153: case 155: case 156: generateNameIfNeeded(node.name) } } function generateNameIfNeeded(name) { name && (ts.isGeneratedIdentifier(name) ? generateName(name) : ts.isBindingPattern(name) && generateNames(name)) } function generateName(name) { if (4 === (7 & name.autoGenerateFlags)) return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); var autoGenerateId = name.autoGenerateId; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)) } function generateNameCached(node, flags) { var nodeId = ts.getNodeId(node); return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)) } function isUniqueName(name) { return isFileLevelUniqueName(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name)) } function isFileLevelUniqueName(name) { return !currentSourceFile || ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer)if (node.locals) { var local = node.locals.get(ts.escapeLeadingUnderscores(name)); if (local && 70362047 & local.flags) return !1 } return !0 } function makeTempVariableName(flags, reservedInNestedScopes) { if (flags && !(tempFlags & flags)) { var name = 268435456 === flags ? "_i" : "_n"; if (isUniqueName(name)) return tempFlags |= flags, reservedInNestedScopes && reserveNameInNestedScopes(name), name } for (; ;) { var count = 268435455 & tempFlags; if (tempFlags++ , 8 !== count && 13 !== count) { var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); if (isUniqueName(name)) return reservedInNestedScopes && reserveNameInNestedScopes(name), name } } } function makeUniqueName(baseName, checkFn, optimistic, scoped) { if (void 0 === checkFn && (checkFn = isUniqueName), optimistic && checkFn(baseName)) return scoped ? reserveNameInNestedScopes(baseName) : generatedNames.set(baseName, !0), baseName; 95 !== baseName.charCodeAt(baseName.length - 1) && (baseName += "_"); for (var i = 1; ;) { var generatedName = baseName + i; if (checkFn(generatedName)) return scoped ? reserveNameInNestedScopes(generatedName) : generatedNames.set(generatedName, !0), generatedName; i++ } } function makeFileLevelOptmiisticUniqueName(name) { return makeUniqueName(name, isFileLevelUniqueName, !0) } function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); return isUniqueLocalName(name, node) ? name : makeUniqueName(name) } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node), baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; return makeUniqueName(baseName) } function generateNameForExportDefault() { return makeUniqueName("default") } function generateNameForClassExpression() { return makeUniqueName("class") } function generateNameForMethodOrAccessor(node) { return ts.isIdentifier(node.name) ? generateNameCached(node.name) : makeTempVariableName(0) } function generateNameForNode(node, flags) { switch (node.kind) { case 71: return makeUniqueName(getTextOfNode(node), isUniqueName, !!(16 & flags), !!(8 & flags)); case 238: case 237: return generateNameForModuleOrEnum(node); case 243: case 249: return generateNameForImportOrExportDeclaration(node); case 233: case 234: case 248: return generateNameForExportDefault(); case 204: return generateNameForClassExpression(); case 153: case 155: case 156: return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0) } } function makeName(name) { switch (7 & name.autoGenerateFlags) { case 1: return makeTempVariableName(0, !!(8 & name.autoGenerateFlags)); case 2: return makeTempVariableName(268435456, !!(8 & name.autoGenerateFlags)); case 3: return makeUniqueName(ts.idText(name), 32 & name.autoGenerateFlags ? isFileLevelUniqueName : isUniqueName, !!(16 & name.autoGenerateFlags), !!(8 & name.autoGenerateFlags)) }ts.Debug.fail("Unsupported GeneratedIdentifierKind.") } function getNodeForGeneratedName(name) { for (var autoGenerateId = name.autoGenerateId, node = name, original = node.original; original && (node = original, !(ts.isIdentifier(node) && 4 & node.autoGenerateFlags && node.autoGenerateId !== autoGenerateId));)original = node.original; return node } void 0 === printerOptions && (printerOptions = {}), void 0 === handlers && (handlers = {}); var currentSourceFile, nodeIdToGeneratedName, autoGeneratedIdToGeneratedName, generatedNames, tempFlagsStack, tempFlags, reservedNamesStack, reservedNames, writer, ownWriter, hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken, newLine = ts.getNewLineCharacter(printerOptions), comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition), emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition, write = writeBase, commitPendingSemicolon = ts.noop, writeSemicolon = writeSemicolonInternal, pendingSemicolon = !1; printerOptions.omitTrailingSemicolon && (commitPendingSemicolon = commitPendingSemicolonInternal, writeSemicolon = deferWriteSemicolon); var isOwnFileEmit, syntheticParent = { pos: -1, end: -1 }, moduleKind = ts.getEmitModuleKind(printerOptions), bundledHelpers = ts.createMap(); return reset(), { printNode: printNode, printList: printList, printFile: printFile, printBundle: printBundle, writeNode: writeNode, writeList: writeList, writeFile: writeFile, writeBundle: writeBundle } } function createBracketsMap() { var brackets = []; return brackets[512] = ["{", "}"], brackets[1024] = ["(", ")"], brackets[2048] = ["<", ">"], brackets[4096] = ["[", "]"], brackets } function getOpeningBracket(format) { return brackets[7680 & format][0] } function getClosingBracket(format) { return brackets[7680 & format][1] } var infoExtension = ".tsbundleinfo", brackets = createBracketsMap(); ts.forEachEmittedFile = forEachEmittedFile, ts.getOutputPathsFor = getOutputPathsFor, ts.getOutputExtension = getOutputExtension, ts.emitFiles = emitFiles; var PipelinePhase; !function (PipelinePhase) { PipelinePhase[PipelinePhase.Notification = 0] = "Notification", PipelinePhase[PipelinePhase.Comments = 1] = "Comments", PipelinePhase[PipelinePhase.SourceMaps = 2] = "SourceMaps", PipelinePhase[PipelinePhase.Emit = 3] = "Emit" }(PipelinePhase || (PipelinePhase = {})), ts.createPrinter = createPrinter; var TempFlags; !function (TempFlags) { TempFlags[TempFlags.Auto = 0] = "Auto", TempFlags[TempFlags.CountMask = 268435455] = "CountMask", TempFlags[TempFlags._i = 268435456] = "_i" }(TempFlags || (TempFlags = {})) }(ts || (ts = {})); var ts; !function (ts) { function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames) { function toPath(fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName) } function getCachedFileSystemEntries(rootDirPath) { return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)) } function getCachedFileSystemEntriesForBaseDir(path) { return getCachedFileSystemEntries(ts.getDirectoryPath(path)) } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)) } function createCachedFileSystemEntries(rootDir, rootDirPath) { var resultFromHost = { files: ts.map(host.readDirectory(rootDir, void 0, void 0, ["*.*"]), getBaseNameOfFileName) || [], directories: host.getDirectories(rootDir) || [] }; return cachedReadDirectoryResult.set(ts.ensureTrailingDirectorySeparator(rootDirPath), resultFromHost), resultFromHost } function tryReadDirectory(rootDir, rootDirPath) { rootDirPath = ts.ensureTrailingDirectorySeparator(rootDirPath); var cachedResult = getCachedFileSystemEntries(rootDirPath); if (cachedResult) return cachedResult; try { return createCachedFileSystemEntries(rootDir, rootDirPath) } catch (_e) { return void ts.Debug.assert(!cachedReadDirectoryResult.has(ts.ensureTrailingDirectorySeparator(rootDirPath))) } } function fileNameEqual(name1, name2) { return getCanonicalFileName(name1) === getCanonicalFileName(name2) } function hasEntry(entries, name) { return ts.some(entries, function (file) { return fileNameEqual(file, name) }) } function updateFileSystemEntry(entries, baseName, isValid) { if (hasEntry(entries, baseName)) { if (!isValid) return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName) }) } else if (isValid) return entries.push(baseName) } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName), result = getCachedFileSystemEntriesForBaseDir(path); return result && updateFilesOfFileSystemEntry(result, getBaseNameOfFileName(fileName), !0), host.writeFile(fileName, data, writeByteOrderMark) } function fileExists(fileName) { var path = toPath(fileName), result = getCachedFileSystemEntriesForBaseDir(path); return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || host.fileExists(fileName) } function directoryExists(dirPath) { var path = toPath(dirPath); return cachedReadDirectoryResult.has(ts.ensureTrailingDirectorySeparator(path)) || host.directoryExists(dirPath) } function createDirectory(dirPath) { var path = toPath(dirPath), result = getCachedFileSystemEntriesForBaseDir(path), baseFileName = getBaseNameOfFileName(dirPath); result && updateFileSystemEntry(result.directories, baseFileName, !0), host.createDirectory(dirPath) } function getDirectories(rootDir) { var rootDirPath = toPath(rootDir), result = tryReadDirectory(rootDir, rootDirPath); return result ? result.directories.slice() : host.getDirectories(rootDir) } function readDirectory(rootDir, extensions, excludes, includes, depth) { function getFileSystemEntries(dir) { var path = toPath(dir); return path === rootDirPath ? result : tryReadDirectory(dir, path) || ts.emptyFileSystemEntries } var rootDirPath = toPath(rootDir), result = tryReadDirectory(rootDir, rootDirPath); return result ? ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) : host.readDirectory(rootDir, extensions, excludes, includes, depth) } function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); if (existingResult) return void clearCache(); var parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath); if (parentResult) { if (!host.directoryExists) return void clearCache(); var baseName = getBaseNameOfFileName(fileOrDirectory), fsQueryResult = { fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; return fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName) ? clearCache() : updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists), fsQueryResult } } function addOrDeleteFile(fileName, filePath, eventKind) { if (eventKind !== ts.FileWatcherEventKind.Changed) { var parentResult = getCachedFileSystemEntriesForBaseDir(filePath); parentResult && updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === ts.FileWatcherEventKind.Created) } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { updateFileSystemEntry(parentResult.files, baseName, fileExists) } function clearCache() { cachedReadDirectoryResult.clear() } if (host.getDirectories && host.readDirectory) { var cachedReadDirectoryResult = ts.createMap(), getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); return { useCaseSensitiveFileNames: useCaseSensitiveFileNames, fileExists: fileExists, readFile: function (path, encoding) { return host.readFile(path, encoding) }, directoryExists: host.directoryExists && directoryExists, getDirectories: getDirectories, readDirectory: readDirectory, createDirectory: host.createDirectory && createDirectory, writeFile: host.writeFile && writeFile, addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory, addOrDeleteFile: addOrDeleteFile, clearCache: clearCache } } } function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) { var missingFilePaths = program.getMissingFilePaths(), newMissingFilePathMap = ts.arrayToSet(missingFilePaths); ts.mutateMap(missingFileWatches, newMissingFilePathMap, { createNewValue: createMissingFileWatch, onDeleteValue: ts.closeFileWatcher }) } function updateWatchingWildcardDirectories(existingWatchedForWildcards, wildcardDirectories, watchDirectory) { function createWildcardDirectoryWatcher(directory, flags) { return { watcher: watchDirectory(directory, flags), flags: flags } } function updateWildcardDirectoryWatcher(existingWatcher, flags, directory) { existingWatcher.flags !== flags && (existingWatcher.watcher.close(), existingWatchedForWildcards.set(directory, createWildcardDirectoryWatcher(directory, flags))) } ts.mutateMap(existingWatchedForWildcards, wildcardDirectories, { createNewValue: createWildcardDirectoryWatcher, onDeleteValue: closeFileWatcherOf, onExistingValue: updateWildcardDirectoryWatcher }) } function isEmittedFileOfProgram(program, file) { return !!program && program.isEmittedFile(file) } function getWatchFactory(watchLogLevel, log, getDetailWatchInfo) { return getWatchFactoryWith(watchLogLevel, log, getDetailWatchInfo, watchFile, watchDirectory) } function getWatchFactoryWith(watchLogLevel, log, getDetailWatchInfo, watchFile, watchDirectory) { function watchFilePath(host, file, callback, pollingInterval, path) { return watchFile(host, file, function (fileName, eventKind) { return callback(fileName, eventKind, path) }, pollingInterval) } var createFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile), createFilePathWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher, createDirectoryWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory); return { watchFile: function (host, file, callback, pollingInterval, detailInfo1, detailInfo2) { return createFileWatcher(host, file, callback, pollingInterval, void 0, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo) }, watchFilePath: function (host, file, callback, pollingInterval, path, detailInfo1, detailInfo2) { return createFilePathWatcher(host, file, callback, pollingInterval, path, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo) }, watchDirectory: function (host, directory, callback, flags, detailInfo1, detailInfo2) { return createDirectoryWatcher(host, directory, callback, flags, void 0, detailInfo1, detailInfo2, watchDirectory, log, "DirectoryWatcher", getDetailWatchInfo) } } } function watchFile(host, file, callback, pollingInterval) { return host.watchFile(file, callback, pollingInterval) } function watchDirectory(host, directory, callback, flags) { return host.watchDirectory(directory, callback, 0 !== (1 & flags)) } function getCreateFileWatcher(watchLogLevel, addWatch) { switch (watchLogLevel) { case WatchLogLevel.None: return addWatch; case WatchLogLevel.TriggerOnly: return createFileWatcherWithTriggerLogging; case WatchLogLevel.Verbose: return createFileWatcherWithLogging } } function createFileWatcherWithLogging(host, file, cb, flags, passThrough, detailInfo1, detailInfo2, addWatch, log, watchCaption, getDetailWatchInfo) { log(watchCaption + ":: Added:: " + getWatchInfo(file, flags, detailInfo1, detailInfo2, getDetailWatchInfo)); var watcher = createFileWatcherWithTriggerLogging(host, file, cb, flags, passThrough, detailInfo1, detailInfo2, addWatch, log, watchCaption, getDetailWatchInfo); return { close: function () { log(watchCaption + ":: Close:: " + getWatchInfo(file, flags, detailInfo1, detailInfo2, getDetailWatchInfo)), watcher.close() } } } function createFileWatcherWithTriggerLogging(host, file, cb, flags, passThrough, detailInfo1, detailInfo2, addWatch, log, watchCaption, getDetailWatchInfo) { return addWatch(host, file, function (fileName, cbOptional) { var triggerredInfo = watchCaption + ":: Triggered with " + fileName + (void 0 !== cbOptional ? cbOptional : "") + ":: " + getWatchInfo(file, flags, detailInfo1, detailInfo2, getDetailWatchInfo); log(triggerredInfo); var start = ts.timestamp(); cb(fileName, cbOptional, passThrough); var elapsed = ts.timestamp() - start; log("Elapsed:: " + elapsed + "ms " + triggerredInfo) }, flags) } function getWatchInfo(file, flags, detailInfo1, detailInfo2, getDetailWatchInfo) { return "WatchInfo: " + file + " " + flags + " " + (getDetailWatchInfo ? getDetailWatchInfo(detailInfo1, detailInfo2) : detailInfo1) } function closeFileWatcherOf(objWithWatcher) { objWithWatcher.watcher.close() } ts.createCachedDirectoryStructureHost = createCachedDirectoryStructureHost; var ConfigFileProgramReloadLevel; !function (ConfigFileProgramReloadLevel) { ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel.None = 0] = "None", ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel.Partial = 1] = "Partial", ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel.Full = 2] = "Full" }(ConfigFileProgramReloadLevel = ts.ConfigFileProgramReloadLevel || (ts.ConfigFileProgramReloadLevel = {})), ts.updateMissingFilePathsWatch = updateMissingFilePathsWatch, ts.updateWatchingWildcardDirectories = updateWatchingWildcardDirectories, ts.isEmittedFileOfProgram = isEmittedFileOfProgram; var WatchLogLevel; !function (WatchLogLevel) { WatchLogLevel[WatchLogLevel.None = 0] = "None", WatchLogLevel[WatchLogLevel.TriggerOnly = 1] = "TriggerOnly", WatchLogLevel[WatchLogLevel.Verbose = 2] = "Verbose" }(WatchLogLevel = ts.WatchLogLevel || (ts.WatchLogLevel = {})), ts.getWatchFactory = getWatchFactory, ts.closeFileWatcherOf = closeFileWatcherOf }(ts || (ts = {})); var ts; !function (ts) { function findConfigFile(searchPath, fileExists, configName) { return void 0 === configName && (configName = "tsconfig.json"), ts.forEachAncestorDirectory(searchPath, function (ancestor) { var fileName = ts.combinePaths(ancestor, configName); return fileExists(fileName) ? fileName : void 0 }) } function resolveTripleslashReference(moduleName, containingFile) { var basePath = ts.getDirectoryPath(containingFile), referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); return ts.normalizePath(referencedFileName) } function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { var commonPathComponents, failed = ts.forEach(fileNames, function (sourceFile) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); if (sourcePathComponents.pop(), !commonPathComponents) return void (commonPathComponents = sourcePathComponents); for (var n = Math.min(commonPathComponents.length, sourcePathComponents.length), i = 0; i < n; i++)if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (0 === i) return !0; commonPathComponents.length = i; break } sourcePathComponents.length < commonPathComponents.length && (commonPathComponents.length = sourcePathComponents.length) }); return failed ? "" : commonPathComponents ? ts.getPathFromPathComponents(commonPathComponents) : currentDirectory } function createCompilerHost(options, setParentNodes) { function getCanonicalFileName(fileName) { return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase() } function getSourceFile(fileName, languageVersion, onError) { var text; try { ts.performance.mark("beforeIORead"), text = ts.sys.readFile(fileName, options.charset), ts.performance.mark("afterIORead"), ts.performance.measure("I/O Read", "beforeIORead", "afterIORead") } catch (e) { onError && onError(e.message), text = "" } return void 0 !== text ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : void 0 } function directoryExists(directoryPath) { return !!existingDirectories.has(directoryPath) || !!ts.sys.directoryExists(directoryPath) && (existingDirectories.set(directoryPath, !0), !0) } function ensureDirectoriesExist(directoryPath) { if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { var parentDirectory = ts.getDirectoryPath(directoryPath); ensureDirectoriesExist(parentDirectory), ts.sys.createDirectory(directoryPath) } } function writeFileIfUpdated(fileName, data, writeByteOrderMark) { outputFingerprints || (outputFingerprints = ts.createMap()); var hash = ts.sys.createHash(data), mtimeBefore = ts.sys.getModifiedTime(fileName); if (mtimeBefore) { var fingerprint = outputFingerprints.get(fileName); if (fingerprint && fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) return } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter }) } function writeFile(fileName, data, writeByteOrderMark, onError) { try { ts.performance.mark("beforeIOWrite"), ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))), ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime ? writeFileIfUpdated(fileName, data, writeByteOrderMark) : ts.sys.writeFile(fileName, data, writeByteOrderMark), ts.performance.mark("afterIOWrite"), ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite") } catch (e) { onError && onError(e.message) } } function getDefaultLibLocation() { return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())) } var outputFingerprints, existingDirectories = ts.createMap(), newLine = ts.getNewLineCharacter(options), realpath = ts.sys.realpath && function (path) { return ts.sys.realpath(path) }; return { getSourceFile: getSourceFile, getDefaultLibLocation: getDefaultLibLocation, getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)) }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory() }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames }, getCanonicalFileName: getCanonicalFileName, getNewLine: function () { return newLine }, fileExists: function (fileName) { return ts.sys.fileExists(fileName) }, readFile: function (fileName) { return ts.sys.readFile(fileName) }, trace: function (s) { return ts.sys.write(s + newLine) }, directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName) }, getEnvironmentVariable: function (name) { return ts.sys.getEnvironmentVariable ? ts.sys.getEnvironmentVariable(name) : "" }, getDirectories: function (path) { return ts.sys.getDirectories(path) }, realpath: realpath, readDirectory: function (path, extensions, include, exclude, depth) { return ts.sys.readDirectory(path, extensions, include, exclude, depth) } } } function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { var diagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(cancellationToken), program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); return program.getCompilerOptions().declaration && ts.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken)), ts.sortAndDeduplicateDiagnostics(diagnostics) } function formatDiagnostics(diagnostics, host) { for (var output = "", _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { var diagnostic = diagnostics_1[_i]; output += formatDiagnostic(diagnostic, host) } return output } function formatDiagnostic(diagnostic, host) { var errorMessage = ts.diagnosticCategoryName(diagnostic) + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine(); if (diagnostic.file) { var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character, fileName = diagnostic.file.fileName, relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName) }); return relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): " + errorMessage } return errorMessage } function getCategoryFormat(category) { switch (category) { case ts.DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red; case ts.DiagnosticCategory.Warning: return ForegroundColorEscapeSequences.Yellow; case ts.DiagnosticCategory.Suggestion: return ts.Debug.fail("Should never get an Info diagnostic on the command line."); case ts.DiagnosticCategory.Message: return ForegroundColorEscapeSequences.Blue } } function formatColorAndReset(text, formatStyle) { return formatStyle + text + resetEscapeSequence } function padLeft(s, length) { for (; s.length < length;)s = " " + s; return s } function formatDiagnosticsWithColorAndContext(diagnostics, host) { for (var output = "", _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) { var diagnostic = diagnostics_2[_i], context_2 = ""; if (diagnostic.file) { var start = diagnostic.start, length_4 = diagnostic.length, file_9 = diagnostic.file, _a = ts.getLineAndCharacterOfPosition(file_9, start), firstLine = _a.line, firstLineChar = _a.character, _b = ts.getLineAndCharacterOfPosition(file_9, start + length_4), lastLine = _b.line, lastLineChar = _b.character, lastLineInFile = ts.getLineAndCharacterOfPosition(file_9, file_9.text.length).line, relativeFileName = host ? ts.convertToRelativePath(file_9.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName) }) : file_9.fileName, hasMoreThanFiveLines = lastLine - firstLine >= 4, gutterWidth = (lastLine + 1 + "").length; hasMoreThanFiveLines && (gutterWidth = Math.max(ellipsis.length, gutterWidth)); for (var i = firstLine; i <= lastLine; i++) { context_2 += host.getNewLine(), hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1 && (context_2 += formatColorAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine(), i = lastLine - 1); var lineStart = ts.getPositionOfLineAndCharacter(file_9, i, 0), lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file_9, i + 1, 0) : file_9.text.length, lineContent = file_9.text.slice(lineStart, lineEnd); if (lineContent = lineContent.replace(/\s+$/g, ""), lineContent = lineContent.replace("\t", " "), context_2 += formatColorAndReset(padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator, context_2 += lineContent + host.getNewLine(), context_2 += formatColorAndReset(padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator, context_2 += ForegroundColorEscapeSequences.Red, i === firstLine) { var lastCharForLine = i === lastLine ? lastLineChar : void 0; context_2 += lineContent.slice(0, firstLineChar).replace(/\S/g, " "), context_2 += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~") } else context_2 += i === lastLine ? lineContent.slice(0, lastLineChar).replace(/./g, "~") : lineContent.replace(/./g, "~"); context_2 += resetEscapeSequence } output += formatColorAndReset(relativeFileName, ForegroundColorEscapeSequences.Cyan), output += ":", output += formatColorAndReset("" + (firstLine + 1), ForegroundColorEscapeSequences.Yellow), output += ":", output += formatColorAndReset("" + (firstLineChar + 1), ForegroundColorEscapeSequences.Yellow), output += " - " } output += formatColorAndReset(ts.diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category)), output += formatColorAndReset(" TS" + diagnostic.code + ": ", ForegroundColorEscapeSequences.Grey), output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()), diagnostic.file && (output += host.getNewLine(), output += context_2), output += host.getNewLine() } return output + host.getNewLine() } function flattenDiagnosticMessageText(messageText, newLine) { if (ts.isString(messageText)) return messageText; for (var diagnosticChain = messageText, result = "", indent = 0; diagnosticChain;) { if (indent) { result += newLine; for (var i = 0; i < indent; i++)result += " " } result += diagnosticChain.messageText, indent++ , diagnosticChain = diagnosticChain.next } return result } function loadWithLocalCache(names, containingFile, loader) { if (0 === names.length) return []; for (var resolutions = [], cache = ts.createMap(), _i = 0, names_1 = names; _i < names_1.length; _i++) { var name = names_1[_i], result = void 0; cache.has(name) ? result = cache.get(name) : cache.set(name, result = loader(name, containingFile)), resolutions.push(result) } return resolutions } function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames) { function sourceFileNotUptoDate(sourceFile) { return sourceFile.version !== getSourceVersion(sourceFile.path) || hasInvalidatedResolution(sourceFile.path) } if (!program || hasChangedAutomaticTypeDirectiveNames) return !1; if (program.getRootFileNames().length !== rootFileNames.length) return !1; if (program.getSourceFiles().some(sourceFileNotUptoDate)) return !1; if (program.getMissingFilePaths().some(fileExists)) return !1; var currentOptions = program.getCompilerOptions(); return !!ts.compareDataObjects(currentOptions, newOptions) && (!currentOptions.configFile || !newOptions.configFile || currentOptions.configFile.text === newOptions.configFile.text) } function getConfigFileParsingDiagnostics(configFileParseResult) { return configFileParseResult.options.configFile ? configFileParseResult.options.configFile.parseDiagnostics.concat(configFileParseResult.errors) : configFileParseResult.errors } function shouldProgramCreateNewSourceFiles(program, newOptions) { var oldOptions = program && program.getCompilerOptions(); return oldOptions && (oldOptions.target !== newOptions.target || oldOptions.module !== newOptions.module || oldOptions.moduleResolution !== newOptions.moduleResolution || oldOptions.noResolve !== newOptions.noResolve || oldOptions.jsx !== newOptions.jsx || oldOptions.allowJs !== newOptions.allowJs || oldOptions.disableSizeLimit !== newOptions.disableSizeLimit || oldOptions.baseUrl !== newOptions.baseUrl || !ts.equalOwnProperties(oldOptions.paths, newOptions.paths)) } function createCreateProgramOptions(rootNames, options, host, oldProgram, configFileParsingDiagnostics) { return { rootNames: rootNames, options: options, host: host, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics } } function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) { function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) { return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache) } function toPath(fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName) } function getCommonSourceDirectory() { if (void 0 === commonSourceDirectory) { var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary) }); options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir) ? commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory) : options.composite ? (commonSourceDirectory = ts.getDirectoryPath(ts.normalizeSlashes(options.configFilePath)), checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory)) : commonSourceDirectory = computeCommonSourceDirectory(emittedFiles), commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator && (commonSourceDirectory += ts.directorySeparator) } return commonSourceDirectory } function getClassifiableNames() { if (!classifiableNames) { getTypeChecker(), classifiableNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; ts.copyEntries(sourceFile.classifiableNames, classifiableNames) } } return classifiableNames } function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) { function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) { var resolutionToFile = ts.getResolvedModule(oldProgramState.oldSourceFile, moduleName), resolvedFile = resolutionToFile && oldProgramState.program && oldProgramState.program.getSourceFile(resolutionToFile.resolvedFileName); if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) return !1; var ambientModule = oldProgramState.program && oldProgramState.program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName); if (!ambientModule || !ambientModule.declarations) return !1; var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) { var f = ts.getSourceFileOfNode(d); return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f }); return !!firstUnmodifiedFile && (ts.isTraceEnabled(options, host) && ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName), !0) } if (0 === structuralIsReused && !file.ambientModuleNames.length) return resolveModuleNamesWorker(moduleNames, containingFile); var oldSourceFile = oldProgramState.program && oldProgramState.program.getSourceFile(containingFile); if (oldSourceFile !== file && file.resolvedModules) { for (var result_4 = [], _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { var moduleName = moduleNames_1[_i], resolvedModule = file.resolvedModules.get(moduleName); result_4.push(resolvedModule) } return result_4 } for (var unknownModuleNames, result, reusedNames, predictedToResolveToAmbientModuleMarker = {}, i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { var oldResolvedModule = oldSourceFile && oldSourceFile.resolvedModules.get(moduleName); if (oldResolvedModule) { ts.isTraceEnabled(options, host) && ts.trace(host, ts.Diagnostics.Reusing_resolution_of_module_0_to_file_1_from_old_program, moduleName, containingFile), (result || (result = new Array(moduleNames.length)))[i] = oldResolvedModule, (reusedNames || (reusedNames = [])).push(moduleName); continue } } var resolvesToAmbientModuleInNonModifiedFile = !1; ts.contains(file.ambientModuleNames, moduleName) ? (resolvesToAmbientModuleInNonModifiedFile = !0, ts.isTraceEnabled(options, host) && ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile)) : resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, oldProgramState), resolvesToAmbientModuleInNonModifiedFile ? (result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker : (unknownModuleNames || (unknownModuleNames = [])).push(moduleName) } var resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, containingFile, reusedNames) : ts.emptyArray; if (!result) return ts.Debug.assert(resolutions.length === moduleNames.length), resolutions; for (var j = 0, i = 0; i < result.length; i++)result[i] ? result[i] === predictedToResolveToAmbientModuleMarker && (result[i] = void 0) : (result[i] = resolutions[j], j++); return ts.Debug.assert(j === resolutions.length), result } function tryReuseStructureFromOldProgram() { if (!oldProgram) return 0; var oldOptions = oldProgram.getCompilerOptions(); if (ts.changesAffectModuleResolution(oldOptions, options)) return oldProgram.structureIsReused = 0; ts.Debug.assert(!(3 & oldProgram.structureIsReused)); var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) return oldProgram.structureIsReused = 0; if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) return oldProgram.structureIsReused = 0; var oldRefs = oldProgram.getProjectReferences(); if (projectReferences) { if (!oldRefs) return oldProgram.structureIsReused = 0; for (var i = 0; i < projectReferences.length; i++) { var oldRef = oldRefs[i]; if (oldRef) { var newRef = parseProjectReferenceConfigFile(projectReferences[i]); if (!newRef || newRef.sourceFile !== oldRef.sourceFile) return oldProgram.structureIsReused = 0 } else if (void 0 !== parseProjectReferenceConfigFile(projectReferences[i])) return oldProgram.structureIsReused = 0 } } else if (oldRefs) return oldProgram.structureIsReused = 0; var newSourceFiles = [], filePaths = [], modifiedSourceFiles = []; if (oldProgram.structureIsReused = 2, oldProgram.getMissingFilePaths().some(function (missingFilePath) { return host.fileExists(missingFilePath) })) return oldProgram.structureIsReused = 0; var SeenPackageName, oldSourceFiles = oldProgram.getSourceFiles(); !function (SeenPackageName) { SeenPackageName[SeenPackageName.Exists = 0] = "Exists", SeenPackageName[SeenPackageName.Modified = 1] = "Modified"; }(SeenPackageName || (SeenPackageName = {})); for (var seenPackageNames = ts.createMap(), _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) { var oldSourceFile = oldSourceFiles_2[_i], newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target, void 0, shouldCreateNewSourceFile) : host.getSourceFile(oldSourceFile.fileName, options.target, void 0, shouldCreateNewSourceFile); if (!newSourceFile) return oldProgram.structureIsReused = 0; ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`"); var fileChanged = void 0; if (oldSourceFile.redirectInfo) { if (newSourceFile !== oldSourceFile.redirectInfo.unredirected) return oldProgram.structureIsReused = 0; fileChanged = !1, newSourceFile = oldSourceFile } else if (oldProgram.redirectTargetsSet.has(oldSourceFile.path)) { if (newSourceFile !== oldSourceFile) return oldProgram.structureIsReused = 0; fileChanged = !1 } else fileChanged = newSourceFile !== oldSourceFile; newSourceFile.path = oldSourceFile.path, filePaths.push(newSourceFile.path); var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path); if (void 0 !== packageName) { var prevKind = seenPackageNames.get(packageName), newKind = fileChanged ? 1 : 0; if (void 0 !== prevKind && 1 === newKind || 1 === prevKind) return oldProgram.structureIsReused = 0; seenPackageNames.set(packageName, newKind) } fileChanged ? (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib && (oldProgram.structureIsReused = 1), ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo) || (oldProgram.structureIsReused = 1), collectExternalModuleReferences(newSourceFile), ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo) || (oldProgram.structureIsReused = 1), ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo) || (oldProgram.structureIsReused = 1), (1572864 & oldSourceFile.flags) !== (1572864 & newSourceFile.flags) && (oldProgram.structureIsReused = 1), ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo) || (oldProgram.structureIsReused = 1), modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile })) : hasInvalidatedResolution(oldSourceFile.path) && (oldProgram.structureIsReused = 1, modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile })), newSourceFiles.push(newSourceFile) } if (2 !== oldProgram.structureIsReused) return oldProgram.structureIsReused; modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path }); for (var _a = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _a < modifiedSourceFiles_1.length; _a++) { var _b = modifiedSourceFiles_1[_a], oldSourceFile = _b.oldFile, newSourceFile = _b.newFile, newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); if (resolveModuleNamesWorker) { var moduleNames = getModuleNames(newSourceFile), oldProgramState = { program: oldProgram, oldSourceFile: oldSourceFile, modifiedFilePaths: modifiedFilePaths }, resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, oldProgramState), resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); resolutionsChanged ? (oldProgram.structureIsReused = 1, newSourceFile.resolvedModules = ts.zipToMap(moduleNames, resolutions)) : newSourceFile.resolvedModules = oldSourceFile.resolvedModules } if (resolveTypeReferenceDirectiveNamesWorker) { var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName }), resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath), resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); resolutionsChanged ? (oldProgram.structureIsReused = 1, newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToMap(typesReferenceDirectives, resolutions)) : newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames } } if (2 !== oldProgram.structureIsReused) return oldProgram.structureIsReused; if (host.hasChangedAutomaticTypeDirectiveNames) return oldProgram.structureIsReused = 1; missingFilePaths = oldProgram.getMissingFilePaths(); for (var i = 0; i < newSourceFiles.length; i++)filesByName.set(filePaths[i], newSourceFiles[i]), oldProgram.isSourceFileFromExternalLibrary(oldProgram.getSourceFileByPath(filePaths[i])) && sourceFilesFoundSearchingNodeModules.set(filePaths[i], !0); files = newSourceFiles, fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); for (var _c = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _c < modifiedSourceFiles_2.length; _c++) { var modifiedFile = modifiedSourceFiles_2[_c]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile) } return resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(), sourceFileToPackageName = oldProgram.sourceFileToPackageName, redirectTargetsSet = oldProgram.redirectTargetsSet, oldProgram.structureIsReused = 2 } function getEmitHost(writeFileCallback) { return __assign({ getPrependNodes: getPrependNodes, getCanonicalFileName: getCanonicalFileName, getCommonSourceDirectory: program.getCommonSourceDirectory, getCompilerOptions: program.getCompilerOptions, getCurrentDirectory: function () { return currentDirectory }, getNewLine: function () { return host.getNewLine() }, getSourceFile: program.getSourceFile, getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, writeFile: writeFileCallback || function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles) }, isEmitBlocked: isEmitBlocked, readFile: function (f) { return host.readFile(f) }, fileExists: function (f) { return host.fileExists(f) } }, host.directoryExists ? { directoryExists: function (f) { return host.directoryExists(f) } } : {}) } function getProjectReferences() { if (resolvedProjectReferences) return resolvedProjectReferences } function getPrependNodes() { if (!projectReferences) return ts.emptyArray; for (var nodes = [], i = 0; i < projectReferences.length; i++) { var ref = projectReferences[i], resolvedRefOpts = resolvedProjectReferences[i].commandLine; if (ref.prepend && resolvedRefOpts && resolvedRefOpts.options) { if (!resolvedRefOpts.options.outFile) continue; var dtsFilename = ts.changeExtension(resolvedRefOpts.options.outFile, ".d.ts"), js = host.readFile(resolvedRefOpts.options.outFile) || "/* Input file " + resolvedRefOpts.options.outFile + " was missing */\r\n", dts = host.readFile(dtsFilename) || "/* Input file " + dtsFilename + " was missing */\r\n", node = ts.createInputFiles(js, dts); nodes.push(node) } } return nodes } function isSourceFileFromExternalLibrary(file) { return sourceFilesFoundSearchingNodeModules.get(file.path) } function isSourceFileDefaultLibrary(file) { if (file.hasNoDefaultLib) return !0; if (!options.noLib) return !1; var equalityComparer = host.useCaseSensitiveFileNames() ? ts.equateStringsCaseSensitive : ts.equateStringsCaseInsensitive; return options.lib ? ts.forEach(options.lib, function (libFileName) { return equalityComparer(file.fileName, ts.combinePaths(defaultLibraryPath, libFileName)) }) : equalityComparer(file.fileName, getDefaultLibraryFileName()) } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, !0)) } function dropDiagnosticsProducingTypeChecker() { diagnosticsProducingTypeChecker = void 0 } function getTypeChecker() { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, !1)) } function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers) { return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers) }) } function isEmitBlocked(emitFileName) { return hasEmitBlockingDiagnostics.has(toPath(emitFileName)) } function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers) { var declarationDiagnostics = []; if (!emitOnlyDtsFiles) { if (options.noEmit) return { diagnostics: declarationDiagnostics, sourceMaps: void 0, emittedFiles: void 0, emitSkipped: !0 }; if (options.noEmitOnError) { var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (0 === diagnostics.length && program.getCompilerOptions().declaration && (declarationDiagnostics = program.getDeclarationDiagnostics(void 0, cancellationToken)), diagnostics.length > 0 || declarationDiagnostics.length > 0) return { diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), sourceMaps: void 0, emittedFiles: void 0, emitSkipped: !0 } } } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.outFile || options.out ? void 0 : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers), emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations); return ts.performance.mark("afterEmit"), ts.performance.measure("Emit", "beforeEmit", "afterEmit"), emitResult } function getSourceFile(fileName) { return getSourceFileByPath(toPath(fileName)) } function getSourceFileByPath(path) { return filesByName.get(path) } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { return sourceFile ? getDiagnostics(sourceFile, cancellationToken) : ts.sortAndDeduplicateDiagnostics(ts.flatMap(program.getSourceFiles(), function (sourceFile) { return cancellationToken && cancellationToken.throwIfCancellationRequested(), getDiagnostics(sourceFile, cancellationToken) })) } function getSyntacticDiagnostics(sourceFile, cancellationToken) { return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken) } function getSemanticDiagnostics(sourceFile, cancellationToken) { return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken) } function getDeclarationDiagnostics(sourceFile, cancellationToken) { var options = program.getCompilerOptions(); return !sourceFile || options.out || options.outFile ? getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) : getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken) } function getSyntacticDiagnosticsForFile(sourceFile) { return ts.isSourceFileJavaScript(sourceFile) ? (sourceFile.additionalSyntacticDiagnostics || (sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile)), ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics)) : sourceFile.parseDiagnostics } function runWithCancellationToken(func) { try { return func() } catch (e) { throw e instanceof ts.OperationCanceledException && (noDiagnosticsTypeChecker = void 0, diagnosticsProducingTypeChecker = void 0), e } } function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedSemanticDiagnosticsForFile, getSemanticDiagnosticsForFileNoCache) } function getSemanticDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { if (options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) return ts.emptyArray; var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); for (var diagnostics, isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options), includeBindAndCheckDiagnostics = 3 === sourceFile.scriptKind || 4 === sourceFile.scriptKind || 5 === sourceFile.scriptKind || isCheckJs || 7 === sourceFile.scriptKind, bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray, checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray, fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName), programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName), _i = 0, _a = [bindDiagnostics, checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile, isCheckJs ? sourceFile.jsDocDiagnostics : void 0]; _i < _a.length; _i++) { var diags = _a[_i]; if (diags) for (var _b = 0, diags_1 = diags; _b < diags_1.length; _b++) { var diag = diags_1[_b]; shouldReportDiagnostic(diag) && (diagnostics = ts.append(diagnostics, diag)) } } return diagnostics }) } function shouldReportDiagnostic(diagnostic) { var file = diagnostic.file, start = diagnostic.start; if (file) for (var lineStarts = ts.getLineStarts(file), line = ts.computeLineAndCharacterOfPosition(lineStarts, start).line; line > 0;) { var previousLineText = file.text.slice(lineStarts[line - 1], lineStarts[line]), result = ignoreDiagnosticCommentRegEx.exec(previousLineText); if (!result) return !0; if (result[3]) return !1; line-- } return !0 } function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { return runWithCancellationToken(function () { function walk(node) { switch (parent.kind) { case 148: case 151: if (parent.questionToken === node) return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); case 153: case 152: case 154: case 155: case 156: case 191: case 233: case 192: case 231: if (parent.type === node) return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)) }switch (node.kind) { case 242: return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); case 248: if (node.isExportEquals) return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); break; case 267: var heritageClause = node; if (108 === heritageClause.token) return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); break; case 235: return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); case 238: return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); case 236: return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); case 237: return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); case 208: return void diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); case 207: return void diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); case 189: ts.Debug.fail() }var prevParent = parent; parent = node, ts.forEachChild(node, walk, walkArray), parent = prevParent } function walkArray(nodes) { switch (parent.decorators !== nodes || options.experimentalDecorators || diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)), parent.kind) { case 234: case 153: case 152: case 154: case 155: case 156: case 191: case 233: case 192: if (nodes === parent.typeParameters) return void diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); case 213: if (nodes === parent.modifiers) return checkModifiers(nodes, 213 === parent.kind); break; case 151: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; 115 !== modifier.kind && diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))) } return } break; case 148: if (nodes === parent.modifiers) return void diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); break; case 186: case 187: case 206: case 255: case 256: if (nodes === parent.typeArguments) return void diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)) }for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { var node = nodes_6[_b]; walk(node) } } function checkModifiers(modifiers, isConstValid) { for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { var modifier = modifiers_1[_i]; switch (modifier.kind) { case 76: if (isConstValid) continue; case 114: case 112: case 113: case 132: case 124: case 117: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); break; case 115: case 84: case 79: } } } function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) { var start = nodes.pos; return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2) } function createDiagnosticForNode(node, message, arg0, arg1, arg2) { return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) } var diagnostics = [], parent = sourceFile; return walk(sourceFile), diagnostics }) } function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache) } function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile) }) } function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) { var cachedResult = sourceFile ? cache.perFile && cache.perFile.get(sourceFile.path) : cache.allDiagnostics; if (cachedResult) return cachedResult; var result = getDiagnostics(sourceFile, cancellationToken) || ts.emptyArray; return sourceFile ? (cache.perFile || (cache.perFile = ts.createMap()), cache.perFile.set(sourceFile.path, result)) : cache.allDiagnostics = result, result } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) } function getOptionsDiagnostics() { return ts.sortAndDeduplicateDiagnostics(ts.concatenate(fileProcessingDiagnostics.getGlobalDiagnostics(), ts.concatenate(programDiagnostics.getGlobalDiagnostics(), options.configFile ? programDiagnostics.getDiagnostics(options.configFile.fileName) : []))) } function getGlobalDiagnostics() { return ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()) } function getConfigFileParsingDiagnostics() { return configFileParsingDiagnostics || ts.emptyArray } function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib, void 0) } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName } function moduleNameIsEqualTo(a, b) { return 71 === a.kind ? 71 === b.kind && a.escapedText === b.escapedText : 9 === b.kind && a.text === b.text } function collectExternalModuleReferences(file) { function collectModuleReferences(node, inAmbientModule) { if (ts.isAnyImportOrReExport(node)) { var moduleNameExpr = ts.getExternalModuleName(node); !(moduleNameExpr && ts.isStringLiteral(moduleNameExpr) && moduleNameExpr.text) || inAmbientModule && ts.isExternalModuleNameRelative(moduleNameExpr.text) || (imports = ts.append(imports, moduleNameExpr)) } else if (ts.isModuleDeclaration(node) && ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || file.isDeclarationFile)) { var nameText = ts.getTextOfIdentifierOrLiteral(node.name); if (isExternalModuleFile || inAmbientModule && !ts.isExternalModuleNameRelative(nameText)) (moduleAugmentations || (moduleAugmentations = [])).push(node.name); else if (!inAmbientModule) { file.isDeclarationFile && (ambientModules || (ambientModules = [])).push(nameText); var body = node.body; if (body) for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var statement = _a[_i]; collectModuleReferences(statement, !0) } } } } function collectDynamicImportOrRequireCalls(node) { ts.isRequireCall(node, !0) ? imports = ts.append(imports, node.arguments[0]) : ts.isImportCall(node) && 1 === node.arguments.length && ts.isStringLiteralLike(node.arguments[0]) ? imports = ts.append(imports, node.arguments[0]) : ts.isLiteralImportTypeNode(node) && (imports = ts.append(imports, node.argument.literal)), collectDynamicImportOrRequireCallsForEachChild(node), ts.hasJSDocNodes(node) && ts.forEach(node.jsDoc, collectDynamicImportOrRequireCallsForEachChild) } function collectDynamicImportOrRequireCallsForEachChild(node) { ts.forEachChild(node, collectDynamicImportOrRequireCalls) } if (!file.imports) { var imports, moduleAugmentations, ambientModules, isJavaScriptFile = ts.isSourceFileJavaScript(file), isExternalModuleFile = ts.isExternalModule(file); if (options.importHelpers && (options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) { var externalHelpersModuleReference = ts.createLiteral(ts.externalHelpersModuleNameText), importDecl = ts.createImportDeclaration(void 0, void 0, void 0, externalHelpersModuleReference); ts.addEmitFlags(importDecl, 67108864), externalHelpersModuleReference.parent = importDecl, importDecl.parent = file, imports = [externalHelpersModuleReference] } for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; collectModuleReferences(node, !1), (524288 & file.flags || isJavaScriptFile) && collectDynamicImportOrRequireCalls(node) } (524288 & file.flags || isJavaScriptFile) && collectDynamicImportOrRequireCalls(file.endOfFileToken), file.imports = imports || ts.emptyArray, file.moduleAugmentations = moduleAugmentations || ts.emptyArray, file.ambientModuleNames = ambientModules || ts.emptyArray } } function getSourceFileFromReference(referencingFile, ref) { return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), function (fileName) { return filesByName.get(toPath(fileName)) }) } function getSourceFileFromReferenceWorker(fileName, getSourceFile, fail, refFile) { if (ts.hasExtension(fileName)) { if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension) })) return void (fail && fail(ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + supportedExtensions.join("', '") + "'")); var sourceFile = getSourceFile(fileName); if (fail) if (sourceFile) refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName) && fail(ts.Diagnostics.A_file_cannot_have_a_reference_to_itself); else { var redirect = getProjectReferenceRedirect(fileName); redirect ? fail(ts.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, fileName) : fail(ts.Diagnostics.File_0_not_found, fileName) } return sourceFile } var sourceFileNoExtension = options.allowNonTsExtensions && getSourceFile(fileName); if (sourceFileNoExtension) return sourceFileNoExtension; if (fail && options.allowNonTsExtensions) return void fail(ts.Diagnostics.File_0_not_found, fileName); var sourceFileWithAddedExtension = ts.forEach(supportedExtensions, function (extension) { return getSourceFile(fileName + extension) }); return fail && !sourceFileWithAddedExtension && fail(ts.Diagnostics.File_0_not_found, fileName + ".ts"), sourceFileWithAddedExtension } function processSourceFile(fileName, isDefaultLib, packageId, refFile, refPos, refEnd) { getSourceFileFromReferenceWorker(fileName, function (fileName) { return findSourceFile(fileName, toPath(fileName), isDefaultLib, refFile, refPos, refEnd, packageId) }, function (diagnostic) { for (var args = [], _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; fileProcessingDiagnostics.add(void 0 !== refFile && void 0 !== refEnd && void 0 !== refPos ? ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(args)) : ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(args))) }, refFile) } function reportFileNamesDifferOnlyInCasingError(fileName, existingFileName, refFile, refPos, refEnd) { void 0 !== refFile && void 0 !== refPos && void 0 !== refEnd ? fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)) : fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)) } function createRedirectSourceFile(redirectTarget, unredirected, fileName, path) { var redirect = Object.create(redirectTarget); return redirect.fileName = fileName, redirect.path = path, redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected }, Object.defineProperties(redirect, { id: { get: function () { return this.redirectInfo.redirectTarget.id }, set: function (value) { this.redirectInfo.redirectTarget.id = value } }, symbol: { get: function () { return this.redirectInfo.redirectTarget.symbol }, set: function (value) { this.redirectInfo.redirectTarget.symbol = value } } }), redirect } function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd, packageId) { if (filesByName.has(path)) { var file_10 = filesByName.get(path); return file_10 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_10.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory) && reportFileNamesDifferOnlyInCasingError(fileName, file_10.fileName, refFile, refPos, refEnd), file_10 && sourceFilesFoundSearchingNodeModules.get(file_10.path) && 0 === currentNodeModulesDepth ? (sourceFilesFoundSearchingNodeModules.set(file_10.path, !1), options.noResolve || (processReferencedFiles(file_10, isDefaultLib), processTypeReferenceDirectives(file_10)), modulesWithElidedImports.set(file_10.path, !1), processImportedModules(file_10)) : file_10 && modulesWithElidedImports.get(file_10.path) && currentNodeModulesDepth < maxNodeModuleJsDepth && (modulesWithElidedImports.set(file_10.path, !1), processImportedModules(file_10)), file_10 } var redirectedPath; if (refFile) { var redirect = getProjectReferenceRedirect(fileName); redirect && ((refFile.redirectedReferences || (refFile.redirectedReferences = [])).push(fileName), fileName = redirect, redirectedPath = toPath(redirect)) } var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { void 0 !== refFile && void 0 !== refPos && void 0 !== refEnd ? fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)) : fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)) }, shouldCreateNewSourceFile); if (packageId) { var packageIdKey = ts.packageIdToString(packageId), fileFromPackageId = packageIdToSourceFile.get(packageIdKey); if (fileFromPackageId) { var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path); return redirectTargetsSet.set(fileFromPackageId.path, !0), filesByName.set(path, dupFile), sourceFileToPackageName.set(path, packageId.name), files.push(dupFile), dupFile } file && (packageIdToSourceFile.set(packageIdKey, file), sourceFileToPackageName.set(path, packageId.name)) } if (filesByName.set(path, file), redirectedPath && filesByName.set(redirectedPath, file), file) { if (sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0), file.path = path, host.useCaseSensitiveFileNames()) { var pathLowerCase = path.toLowerCase(), existingFile = filesByNameIgnoreCase.get(pathLowerCase); existingFile ? reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd) : filesByNameIgnoreCase.set(pathLowerCase, file) } skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib, options.noResolve || (processReferencedFiles(file, isDefaultLib), processTypeReferenceDirectives(file)), processImportedModules(file), isDefaultLib ? files.unshift(file) : files.push(file) } return file } function getProjectReferenceRedirect(fileName) { var result, path = toPath(fileName), normalized = ts.getNormalizedAbsolutePath(fileName, path); return projectReferenceRedirects.forEach(function (v, k) { void 0 === result && 0 === normalized.indexOf(k) && (result = ts.changeExtension(fileName.replace(k, v), ".d.ts")) }), result } function processReferencedFiles(file, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); processSourceFile(referencedFileName, isDefaultLib, void 0, file, ref.pos, ref.end) }) } function processTypeReferenceDirectives(file) { var typeDirectives = ts.map(file.typeReferenceDirectives, function (ref) { return ref.fileName.toLocaleLowerCase() }); if (typeDirectives) for (var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName), i = 0; i < typeDirectives.length; i++) { var ref = file.typeReferenceDirectives[i], resolvedTypeReferenceDirective = resolutions[i], fileName = ref.fileName.toLocaleLowerCase(); ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective), processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end) } } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (!previousResolution || !previousResolution.primary) { var saveResolution = !0; if (resolvedTypeReferenceDirective) if (resolvedTypeReferenceDirective.primary) processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, !1, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd); else if (previousResolution) { if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) { var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); otherFileText !== getSourceFile(previousResolution.resolvedFileName).text && fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)) } saveResolution = !1 } else processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, !1, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd); else fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); saveResolution && resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective) } } function createDiagnostic(refFile, refPos, refEnd, message) { for (var args = [], _i = 4; _i < arguments.length; _i++)args[_i - 4] = arguments[_i]; return void 0 === refFile || void 0 === refPos || void 0 === refEnd ? ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)) : ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)) } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName) } function processImportedModules(file) { if (collectExternalModuleReferences(file), file.imports.length || file.moduleAugmentations.length) { var moduleNames = getModuleNames(file), oldProgramState = { program: oldProgram, oldSourceFile: oldProgram && oldProgram.getSourceFile(file.fileName), modifiedFilePaths: modifiedFilePaths }, resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file, oldProgramState); ts.Debug.assert(resolutions.length === moduleNames.length); for (var i = 0; i < moduleNames.length; i++) { var resolution = resolutions[i]; if (ts.setResolvedModule(file, moduleNames[i], resolution), resolution) { var isFromNodeModulesSearch = resolution.isExternalLibraryImport, isJsFile = !ts.resolutionExtensionIsTypeScriptOrJson(resolution.extension), isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile, resolvedFileName = resolution.resolvedFileName; isFromNodeModulesSearch && currentNodeModulesDepth++; var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth, shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport && !(isJsFile && !options.allowJs) && (ts.isInJavaScriptFile(file.imports[i]) || !(2097152 & file.imports[i].flags)); if (elideImport) modulesWithElidedImports.set(file.path, !0); else if (shouldAddFile) { var path = toPath(resolvedFileName), pos = ts.skipTrivia(file.text, file.imports[i].pos); findSourceFile(resolvedFileName, path, !1, file, pos, file.imports[i].end, resolution.packageId) } isFromNodeModulesSearch && currentNodeModulesDepth-- } } } else file.resolvedModules = void 0 } function computeCommonSourceDirectory(sourceFiles) { for (var fileNames = [], _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { var file_11 = sourceFiles_2[_i]; file_11.isDeclarationFile || fileNames.push(file_11.fileName) } return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = !0; if (sourceFiles) for (var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)), _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { var sourceFile = sourceFiles_3[_i]; if (!sourceFile.isDeclarationFile) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); 0 !== absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) && (programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)), allFilesBelongToPath = !1) } } return allFilesBelongToPath } function parseProjectReferenceConfigFile(ref) { var refPath = resolveProjectReferencePath(host, ref), basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory()), sourceFile = host.getSourceFile(refPath, 100); if (void 0 !== sourceFile) { var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, void 0, refPath); return { commandLine: commandLine, sourceFile: sourceFile } } } function addProjectReferenceRedirects(referencedProject, target) { var rootDir = ts.normalizePath(referencedProject.options.rootDir || ts.getDirectoryPath(referencedProject.options.configFilePath)); target.set(rootDir, getDeclarationOutputDirectory(referencedProject)) } function getDeclarationOutputDirectory(proj) { return proj.options.declarationDir || proj.options.outDir || ts.getDirectoryPath(proj.options.configFilePath) } function verifyCompilerOptions() { function verifyEmitFilePath(emitFileName, emitFilesSeen) { if (emitFileName) { var emitFilePath = toPath(emitFileName); if (filesByName.has(emitFilePath)) { var chain_2; options.configFilePath || (chain_2 = ts.chainDiagnosticMessages(void 0, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig)), chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName), blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2)) } var emitFileKey = host.useCaseSensitiveFileNames() ? emitFilePath : emitFilePath.toLocaleLowerCase(); emitFilesSeen.has(emitFileKey) ? blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName)) : emitFilesSeen.set(emitFileKey, !0) } } if (options.strictPropertyInitialization && !options.strictNullChecks && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks"), options.isolatedModules && (options.declaration && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"), options.noEmitOnError && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"), options.out && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"), options.outFile && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")), options.inlineSourceMap && (options.sourceMap && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"), options.mapRoot && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")), options.paths && void 0 === options.baseUrl && createDiagnosticForOptionName(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option, "paths"), options.composite && options.declaration === !1 && createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_declaration_emit, "declaration"), projectReferences) for (var i = 0; i < projectReferences.length; i++) { var ref = projectReferences[i], resolvedRefOpts = resolvedProjectReferences[i] && resolvedProjectReferences[i].commandLine.options; void 0 !== resolvedRefOpts ? (resolvedRefOpts.composite || createDiagnosticForReference(i, ts.Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path), ref.prepend && (resolvedRefOpts.outFile ? host.fileExists(resolvedRefOpts.outFile) || createDiagnosticForReference(i, ts.Diagnostics.Output_file_0_from_project_1_does_not_exist, resolvedRefOpts.outFile, ref.path) : createDiagnosticForReference(i, ts.Diagnostics.Cannot_prepend_project_0_because_it_does_not_have_outFile_set, ref.path))) : createDiagnosticForReference(i, ts.Diagnostics.File_0_does_not_exist, ref.path) } if (options.composite && rootNames.length < files.length) for (var normalizedRootNames = rootNames.map(function (r) { return ts.normalizePath(r).toLowerCase() }), sourceFiles = files.filter(function (f) { return !f.isDeclarationFile }).map(function (f) { return ts.normalizePath(f.path).toLowerCase() }), _loop_10 = function (file_12) { normalizedRootNames.every(function (r) { return r !== file_12 }) && programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file_12)) }, _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var file_12 = sourceFiles_4[_i]; _loop_10(file_12) } if (options.paths) for (var key in options.paths) if (ts.hasProperty(options.paths, key)) if (ts.hasZeroOrOneAsteriskCharacter(key) || createDiagnosticForOptionPaths(!0, key, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key), ts.isArray(options.paths[key])) { var len = options.paths[key].length; 0 === len && createDiagnosticForOptionPaths(!1, key, ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key); for (var i = 0; i < len; i++) { var subst = options.paths[key][i], typeOfSubst = typeof subst; "string" === typeOfSubst ? ts.hasZeroOrOneAsteriskCharacter(subst) || createDiagnosticForOptionPathKeyValue(key, i, ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key) : createDiagnosticForOptionPathKeyValue(key, i, ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst) } } else createDiagnosticForOptionPaths(!1, key, ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key); options.sourceMap || options.inlineSourceMap || (options.inlineSources && createDiagnosticForOptionName(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources"), options.sourceRoot && createDiagnosticForOptionName(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot")), options.out && options.outFile && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"), !options.mapRoot || options.sourceMap || options.declarationMap || createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "mapRoot", "sourceMap", "declarationMap"), options.declarationDir && (options.declaration || createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration"), (options.out || options.outFile) && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")), options.declarationMap && !options.declaration && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationMap", "declaration"), options.lib && options.noLib && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib"), options.noImplicitUseStrict && ts.getStrictOptionValue(options, "alwaysStrict") && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict"); var languageVersion = options.target || 0, outFile = options.outFile || options.out, firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !f.isDeclarationFile ? f : void 0 }); if (options.isolatedModules) { options.module === ts.ModuleKind.None && languageVersion < 2 && createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target"); var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) || f.isDeclarationFile ? void 0 : f }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)) } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none)) } if (outFile) if (options.module && options.module !== ts.ModuleKind.AMD && options.module !== ts.ModuleKind.System) createDiagnosticForOptionName(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module"); else if (void 0 === options.module && firstNonAmbientExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile")) } if (options.resolveJsonModule && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs && createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule"), options.outDir || options.sourceRoot || options.mapRoot) { var dir = getCommonSourceDirectory(); options.outDir && "" === dir && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1 }) && createDiagnosticForOptionName(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir") } if (!options.noEmit && options.allowJs && options.declaration && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration"), options.checkJs && !options.allowJs && programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")), options.emitDeclarationOnly && (options.declaration || createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDeclarationOnly", "declaration"), options.noEmit && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit")), options.emitDecoratorMetadata && !options.experimentalDecorators && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"), options.jsxFactory ? (options.reactNamespace && createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory"), ts.parseIsolatedEntityName(options.jsxFactory, languageVersion) || createOptionValueDiagnostic("jsxFactory", ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory)) : options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion) && createOptionValueDiagnostic("reactNamespace", ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace), !options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(), emitFilesSeen_1 = ts.createMap(); ts.forEachEmittedFile(emitHost, function (emitFileNames) { options.emitDeclarationOnly || verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1), verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1) }) } } function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) { for (var needCompilerDiagnostic = !0, pathsSyntax = getOptionPathsSyntax(), _i = 0, pathsSyntax_1 = pathsSyntax; _i < pathsSyntax_1.length; _i++) { var pathProp = pathsSyntax_1[_i]; if (ts.isObjectLiteralExpression(pathProp.initializer)) for (var _a = 0, _b = ts.getPropertyAssignment(pathProp.initializer, key); _a < _b.length; _a++) { var keyProps = _b[_a]; ts.isArrayLiteralExpression(keyProps.initializer) && keyProps.initializer.elements.length > valueIndex && (programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(options.configFile, keyProps.initializer.elements[valueIndex], message, arg0, arg1, arg2)), needCompilerDiagnostic = !1) } } needCompilerDiagnostic && programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1, arg2)) } function createDiagnosticForOptionPaths(onKey, key, message, arg0) { for (var needCompilerDiagnostic = !0, pathsSyntax = getOptionPathsSyntax(), _i = 0, pathsSyntax_2 = pathsSyntax; _i < pathsSyntax_2.length; _i++) { var pathProp = pathsSyntax_2[_i]; ts.isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(pathProp.initializer, onKey, key, void 0, message, arg0) && (needCompilerDiagnostic = !1) } needCompilerDiagnostic && programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0)) } function getOptionsSyntaxByName(name) { var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); if (compilerOptionsObjectLiteralSyntax) return ts.getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name) } function getOptionPathsSyntax() { return getOptionsSyntaxByName("paths") || ts.emptyArray } function createDiagnosticForOptionName(message, option1, option2, option3) { createDiagnosticForOption(!0, option1, option2, message, option1, option2, option3) } function createOptionValueDiagnostic(option1, message, arg0) { createDiagnosticForOption(!1, option1, void 0, message, arg0) } function createDiagnosticForReference(index, message, arg0, arg1) { var referencesSyntax = getProjectReferencesSyntax(); referencesSyntax && createOptionDiagnosticInArrayLiteralSyntax(referencesSyntax, index, message, arg0, arg1) || programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1)) } function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) { var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(), needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2); needCompilerDiagnostic && programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1, arg2)) } function getProjectReferencesSyntax() { if (void 0 === _referencesArrayLiteralSyntax && (_referencesArrayLiteralSyntax = null, options.configFile)) for (var jsonObjectLiteral = ts.getTsConfigObjectLiteralExpression(options.configFile), _i = 0, _a = ts.getPropertyAssignment(jsonObjectLiteral, "references"); _i < _a.length; _i++) { var prop = _a[_i]; if (ts.isArrayLiteralExpression(prop.initializer)) { _referencesArrayLiteralSyntax = prop.initializer; break } } return _referencesArrayLiteralSyntax } function getCompilerOptionsObjectLiteralSyntax() { if (void 0 === _compilerOptionsObjectLiteralSyntax) { _compilerOptionsObjectLiteralSyntax = null; var jsonObjectLiteral = ts.getTsConfigObjectLiteralExpression(options.configFile); if (jsonObjectLiteral) for (var _i = 0, _a = ts.getPropertyAssignment(jsonObjectLiteral, "compilerOptions"); _i < _a.length; _i++) { var prop = _a[_i]; if (ts.isObjectLiteralExpression(prop.initializer)) { _compilerOptionsObjectLiteralSyntax = prop.initializer; break } } } return _compilerOptionsObjectLiteralSyntax } function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) { for (var props = ts.getPropertyAssignment(objectLiteral, key1, key2), _i = 0, props_2 = props; _i < props_2.length; _i++) { var prop = props_2[_i]; programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2)) } return !!props.length } function createOptionDiagnosticInArrayLiteralSyntax(arrayLiteral, index, message, arg0, arg1, arg2) { return !(arrayLiteral.elements.length <= index) && void programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(options.configFile, arrayLiteral.elements[index], message, arg0, arg1, arg2)) } function blockEmittingOfFile(emitFileName, diag) { hasEmitBlockingDiagnostics.set(toPath(emitFileName), !0), programDiagnostics.add(diag) } function isEmittedFile(file) { if (options.noEmit) return !1; var filePath = toPath(file); if (getSourceFileByPath(filePath)) return !1; var out = options.outFile || options.out; if (out) return isSameFile(filePath, out) || isSameFile(filePath, ts.removeFileExtension(out) + ".d.ts"); if (options.outDir) return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames()); if (ts.fileExtensionIsOneOf(filePath, ts.supportedJavascriptExtensions) || ts.fileExtensionIs(filePath, ".d.ts")) { var filePathWithoutExtension = ts.removeFileExtension(filePath); return !!getSourceFileByPath(ts.combinePaths(filePathWithoutExtension, ".ts")) || !!getSourceFileByPath(ts.combinePaths(filePathWithoutExtension, ".tsx")) } return !1 } function isSameFile(file1, file2) { return 0 === ts.comparePaths(file1, file2, currentDirectory, !host.useCaseSensitiveFileNames()) } var program, commonSourceDirectory, diagnosticsProducingTypeChecker, noDiagnosticsTypeChecker, classifiableNames, modifiedFilePaths, createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions, rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences, host = createProgramOptions.host, oldProgram = createProgramOptions.oldProgram, files = [], cachedSemanticDiagnosticsForFile = {}, cachedDeclarationDiagnosticsForFile = {}, resolvedTypeReferenceDirectives = ts.createMap(), fileProcessingDiagnostics = ts.createDiagnosticCollection(), maxNodeModuleJsDepth = "number" == typeof options.maxNodeModuleJsDepth ? options.maxNodeModuleJsDepth : 0, currentNodeModulesDepth = 0, modulesWithElidedImports = ts.createMap(), sourceFilesFoundSearchingNodeModules = ts.createMap(); ts.performance.mark("beforeProgram"), host = host || createCompilerHost(options); var _compilerOptionsObjectLiteralSyntax, _referencesArrayLiteralSyntax, moduleResolutionCache, resolveModuleNamesWorker, configParsingHost = parseConfigHostFromCompilerHost(host), skipDefaultLib = options.noLib, getDefaultLibraryFileName = ts.memoize(function () { return host.getDefaultLibFileName(options) }), defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(getDefaultLibraryFileName()), programDiagnostics = ts.createDiagnosticCollection(), currentDirectory = host.getCurrentDirectory(), supportedExtensions = ts.getSupportedExtensions(options), hasEmitBlockingDiagnostics = ts.createMap(), hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) resolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(ts.Debug.assertEachDefined(moduleNames), containingFile, reusedNames).map(function (resolved) { if (!resolved || void 0 !== resolved.extension) return resolved; var withExtension = ts.clone(resolved); return withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName), withExtension }) }; else { moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x) }); var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, loader_1) } } var resolveTypeReferenceDirectiveNamesWorker; if (host.resolveTypeReferenceDirectives) resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(ts.Debug.assertEachDefined(typeDirectiveNames), containingFile) }; else { var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective }; resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(ts.Debug.assertEachDefined(typeReferenceDirectiveNames), containingFile, loader_2) } } var missingFilePaths, packageIdToSourceFile = ts.createMap(), sourceFileToPackageName = ts.createMap(), redirectTargetsSet = ts.createMap(), filesByName = ts.createMap(), filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createMap() : void 0, resolvedProjectReferences = projectReferences ? [] : void 0, projectReferenceRedirects = ts.createMap(); if (projectReferences) for (var _i = 0, projectReferences_1 = projectReferences; _i < projectReferences_1.length; _i++) { var ref = projectReferences_1[_i], parsedRef = parseProjectReferenceConfigFile(ref); if (resolvedProjectReferences.push(parsedRef), parsedRef) { if (parsedRef.commandLine.options.outFile) { var dtsOutfile = ts.changeExtension(parsedRef.commandLine.options.outFile, ".d.ts"); processSourceFile(dtsOutfile, !1, void 0) } addProjectReferenceRedirects(parsedRef.commandLine, projectReferenceRedirects) } } var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options), structuralIsReused = tryReuseStructureFromOldProgram(); if (2 !== structuralIsReused) { ts.forEach(rootNames, function (name) { return processRootFile(name, !1) }); var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); if (typeReferences.length) for (var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(), containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"), resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename), i = 0; i < typeReferences.length; i++)processTypeReferenceDirective(typeReferences[i], resolutions[i]); if (!skipDefaultLib) { var defaultLibraryFileName = getDefaultLibraryFileName(); !options.lib && defaultLibraryFileName ? processRootFile(defaultLibraryFileName, !0) : ts.forEach(options.lib, function (libFileName) { processRootFile(ts.combinePaths(defaultLibraryPath, libFileName), !0) }) } missingFilePaths = ts.arrayFrom(filesByName.keys(), function (p) { return p }).filter(function (p) { return !filesByName.get(p) }) } if (ts.Debug.assert(!!missingFilePaths), oldProgram && host.onReleaseOldSourceFile) for (var oldSourceFiles = oldProgram.getSourceFiles(), _a = 0, oldSourceFiles_1 = oldSourceFiles; _a < oldSourceFiles_1.length; _a++) { var oldSourceFile = oldSourceFiles_1[_a]; getSourceFile(oldSourceFile.path) && !shouldCreateNewSourceFile || host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions()) } return oldProgram = void 0, program = { getRootFileNames: function () { return rootNames }, getSourceFile: getSourceFile, getSourceFileByPath: getSourceFileByPath, getSourceFiles: function () { return files }, getMissingFilePaths: function () { return missingFilePaths }, getCompilerOptions: function () { return options }, getSyntacticDiagnostics: getSyntacticDiagnostics, getOptionsDiagnostics: getOptionsDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getClassifiableNames: getClassifiableNames, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, getCommonSourceDirectory: getCommonSourceDirectory, emit: emit, getCurrentDirectory: function () { return currentDirectory }, getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount() }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount() }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount() }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount() }, getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics }, getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives }, isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, isSourceFileDefaultLibrary: isSourceFileDefaultLibrary, dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker, getSourceFileFromReference: getSourceFileFromReference, sourceFileToPackageName: sourceFileToPackageName, redirectTargetsSet: redirectTargetsSet, isEmittedFile: isEmittedFile, getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics, getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache, getProjectReferences: getProjectReferences }, verifyCompilerOptions(), ts.performance.mark("afterProgram"), ts.performance.measure("Program", "beforeProgram", "afterProgram"), program } function parseConfigHostFromCompilerHost(host) { return { fileExists: function (f) { return host.fileExists(f) }, readDirectory: function (root, extensions, includes, depth) { return host.readDirectory ? host.readDirectory(root, extensions, includes, depth) : [] }, readFile: function (f) { return host.readFile(f) }, useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(), getCurrentDirectory: function () { return host.getCurrentDirectory() }, onUnRecoverableConfigFileDiagnostic: function () { } } } function resolveProjectReferencePath(host, ref) { return host.fileExists(ref.path) ? ref.path : ts.combinePaths(ref.path, "tsconfig.json") } function getResolutionDiagnostic(options, _a) { function needJsx() { return options.jsx ? void 0 : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set } function needAllowJs() { return options.allowJs || !ts.getStrictOptionValue(options, "noImplicitAny") ? void 0 : ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type } var extension = _a.extension; switch (extension) { case ".ts": case ".d.ts": case ".json": return; case ".tsx": return needJsx(); case ".jsx": return needJsx() || needAllowJs(); case ".js": return needAllowJs() } } function getModuleNames(_a) { for (var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations, res = imports.map(function (i) { return i.text }), _i = 0, moduleAugmentations_1 = moduleAugmentations; _i < moduleAugmentations_1.length; _i++) { var aug = moduleAugmentations_1[_i]; 9 === aug.kind && res.push(aug.text) } return res } var ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; ts.findConfigFile = findConfigFile, ts.resolveTripleslashReference = resolveTripleslashReference, ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames, ts.createCompilerHost = createCompilerHost, ts.getPreEmitDiagnostics = getPreEmitDiagnostics, ts.formatDiagnostics = formatDiagnostics, ts.formatDiagnostic = formatDiagnostic; var ForegroundColorEscapeSequences; !function (ForegroundColorEscapeSequences) { ForegroundColorEscapeSequences.Grey = "", ForegroundColorEscapeSequences.Red = "", ForegroundColorEscapeSequences.Yellow = "", ForegroundColorEscapeSequences.Blue = "", ForegroundColorEscapeSequences.Cyan = "" }(ForegroundColorEscapeSequences = ts.ForegroundColorEscapeSequences || (ts.ForegroundColorEscapeSequences = {})); var gutterStyleSequence = "", gutterSeparator = " ", resetEscapeSequence = "", ellipsis = "..."; ts.formatColorAndReset = formatColorAndReset, ts.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext, ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText, ts.isProgramUptoDate = isProgramUptoDate, ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics, ts.createProgram = createProgram, ts.parseConfigHostFromCompilerHost = parseConfigHostFromCompilerHost, ts.getResolutionDiagnostic = getResolutionDiagnostic }(ts || (ts = {})); var ts; !function (ts) { function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers) { function writeFile(fileName, text, writeByteOrderMark) { outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text }) } var outputFiles = [], emitResult = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); return { outputFiles: outputFiles, emitSkipped: emitResult.emitSkipped } } ts.getFileEmitOutput = getFileEmitOutput }(ts || (ts = {})), function (ts) { var BuilderState; !function (BuilderState) { function getReferencedFiles(program, sourceFile, getCanonicalFileName) { function addReferencedFile(referencedPath) { referencedFiles || (referencedFiles = ts.createMap()), referencedFiles.set(referencedPath, !0) } var referencedFiles; if (sourceFile.imports && sourceFile.imports.length > 0) for (var checker = program.getTypeChecker(), _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { var importName = _a[_i], symbol = checker.getSymbolAtLocation(importName); if (symbol && symbol.declarations && symbol.declarations[0]) { var declarationSourceFile = ts.getSourceFileOfNode(symbol.declarations[0]); declarationSourceFile && addReferencedFile(declarationSourceFile.path) } } var sourceFileDirectory = ts.getDirectoryPath(sourceFile.path); if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) { var referencedFile = _c[_b], referencedPath = ts.toPath(referencedFile.fileName, sourceFileDirectory, getCanonicalFileName); addReferencedFile(referencedPath) } return sourceFile.resolvedTypeReferenceDirectiveNames && sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) { if (resolvedTypeReferenceDirective) { var fileName = resolvedTypeReferenceDirective.resolvedFileName, typeFilePath = ts.toPath(fileName, sourceFileDirectory, getCanonicalFileName); addReferencedFile(typeFilePath) } }), referencedFiles } function canReuseOldState(newReferencedMap, oldState) { return oldState && !oldState.referencedMap == !newReferencedMap } function create(newProgram, getCanonicalFileName, oldState) { for (var fileInfos = ts.createMap(), referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? ts.createMap() : void 0, hasCalledUpdateShapeSignature = ts.createMap(), useOldState = canReuseOldState(referencedMap, oldState), _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i], version_1 = sourceFile.version, oldInfo = useOldState && oldState.fileInfos.get(sourceFile.path); if (referencedMap) { var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName); newReferences && referencedMap.set(sourceFile.path, newReferences) } fileInfos.set(sourceFile.path, { version: version_1, signature: oldInfo && oldInfo.signature }) } return { fileInfos: fileInfos, referencedMap: referencedMap, hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature, allFilesExcludingDefaultLibraryFile: void 0, allFileNames: void 0 } } function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature) { var signatureCache = cacheToUpdateSignature || ts.createMap(), sourceFile = programOfThisState.getSourceFileByPath(path); if (!sourceFile) return ts.emptyArray; if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash)) return [sourceFile]; var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash); return cacheToUpdateSignature || updateSignaturesFromCache(state, signatureCache), result } function updateSignaturesFromCache(state, signatureCache) { signatureCache.forEach(function (signature, path) { state.fileInfos.get(path).signature = signature, state.hasCalledUpdateShapeSignature.set(path, !0) }) } function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash) { if (ts.Debug.assert(!!sourceFile), state.hasCalledUpdateShapeSignature.has(sourceFile.path) || cacheToUpdateSignature.has(sourceFile.path)) return !1; var info = state.fileInfos.get(sourceFile.path); ts.Debug.assert(!!info); var latestSignature, prevSignature = info.signature; if (sourceFile.isDeclarationFile) latestSignature = sourceFile.version; else { var emitOutput = ts.getFileEmitOutput(programOfThisState, sourceFile, !0, cancellationToken); latestSignature = emitOutput.outputFiles && emitOutput.outputFiles.length > 0 ? computeHash(emitOutput.outputFiles[0].text) : prevSignature } return cacheToUpdateSignature.set(sourceFile.path, latestSignature), !prevSignature || latestSignature !== prevSignature } function getAllDependencies(state, programOfThisState, sourceFile) { var _a, compilerOptions = programOfThisState.getCompilerOptions(); if (compilerOptions.outFile || compilerOptions.out) return getAllFileNames(state, programOfThisState); if (!state.referencedMap || !ts.isExternalModule(sourceFile) && !containsOnlyAmbientModules(sourceFile)) return getAllFileNames(state, programOfThisState); for (var seenMap = ts.createMap(), queue = [sourceFile.path]; queue.length;) { var path = queue.pop(); if (!seenMap.has(path)) { seenMap.set(path, !0); var references = state.referencedMap.get(path); if (references) for (var iterator = references.keys(), _b = iterator.next(), value = _b.value, done = _b.done; !done; _a = iterator.next(), value = _a.value, done = _a.done, _a)queue.push(value) } } return ts.arrayFrom(ts.mapDefinedIterator(seenMap.keys(), function (path) { var file = programOfThisState.getSourceFileByPath(path); return file ? file.fileName : path })) } function getAllFileNames(state, programOfThisState) { if (!state.allFileNames) { var sourceFiles = programOfThisState.getSourceFiles(); state.allFileNames = sourceFiles === ts.emptyArray ? ts.emptyArray : sourceFiles.map(function (file) { return file.fileName }) } return state.allFileNames } function getReferencedByPaths(state, referencedFilePath) { return ts.arrayFrom(ts.mapDefinedIterator(state.referencedMap.entries(), function (_a) { var filePath = _a[0], referencesInFile = _a[1]; return referencesInFile.has(referencedFilePath) ? filePath : void 0 })) } function containsOnlyAmbientModules(sourceFile) { for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; if (!ts.isModuleWithStringLiteralName(statement)) return !1 } return !0 } function getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, firstSourceFile) { function addSourceFile(sourceFile) { programOfThisState.isSourceFileDefaultLibrary(sourceFile) || (result || (result = [])).push(sourceFile) } if (state.allFilesExcludingDefaultLibraryFile) return state.allFilesExcludingDefaultLibraryFile; var result; addSourceFile(firstSourceFile); for (var _i = 0, _a = programOfThisState.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; sourceFile !== firstSourceFile && addSourceFile(sourceFile) } return state.allFilesExcludingDefaultLibraryFile = result || ts.emptyArray, state.allFilesExcludingDefaultLibraryFile } function getFilesAffectedByUpdatedShapeWhenNonModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape) { var compilerOptions = programOfThisState.getCompilerOptions(); return compilerOptions && (compilerOptions.out || compilerOptions.outFile) ? [sourceFileWithUpdatedShape] : getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape) } function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash) { if (!ts.isExternalModule(sourceFileWithUpdatedShape) && !containsOnlyAmbientModules(sourceFileWithUpdatedShape)) return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape); var compilerOptions = programOfThisState.getCompilerOptions(); if (compilerOptions && (compilerOptions.isolatedModules || compilerOptions.out || compilerOptions.outFile)) return [sourceFileWithUpdatedShape]; var seenFileNamesMap = ts.createMap(); seenFileNamesMap.set(sourceFileWithUpdatedShape.path, sourceFileWithUpdatedShape); for (var queue = getReferencedByPaths(state, sourceFileWithUpdatedShape.path); queue.length > 0;) { var currentPath = queue.pop(); if (!seenFileNamesMap.has(currentPath)) { var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath); seenFileNamesMap.set(currentPath, currentSourceFile), currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash) && queue.push.apply(queue, getReferencedByPaths(state, currentPath)) } } return ts.arrayFrom(ts.mapDefinedIterator(seenFileNamesMap.values(), function (value) { return value })) } BuilderState.canReuseOldState = canReuseOldState, BuilderState.create = create, BuilderState.getFilesAffectedBy = getFilesAffectedBy, BuilderState.updateSignaturesFromCache = updateSignaturesFromCache, BuilderState.getAllDependencies = getAllDependencies }(BuilderState = ts.BuilderState || (ts.BuilderState = {})) }(ts || (ts = {})); var ts; !function (ts) { function hasSameKeys(map1, map2) { return map1 === map2 || map1 && map2 && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key) }) } function createBuilderProgramState(newProgram, getCanonicalFileName, oldState) { var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState); state.program = newProgram; var compilerOptions = newProgram.getCompilerOptions(); compilerOptions.outFile || compilerOptions.out || (state.semanticDiagnosticsPerFile = ts.createMap()), state.changedFilesSet = ts.createMap(); var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState), canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile; useOldState && (oldState.currentChangedFilePath || ts.Debug.assert(!(oldState.affectedFiles || oldState.currentAffectedFilesSignatures && oldState.currentAffectedFilesSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated"), canCopySemanticDiagnostics && ts.Debug.assert(!ts.forEachKey(oldState.changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path) }), "Semantic diagnostics shouldnt be available for changed files"), ts.copyEntries(oldState.changedFilesSet, state.changedFilesSet)); var referencedMap = state.referencedMap, oldReferencedMap = useOldState && oldState.referencedMap; return state.fileInfos.forEach(function (info, sourceFilePath) { var oldInfo, newReferences; if (!useOldState || !(oldInfo = oldState.fileInfos.get(sourceFilePath)) || oldInfo.version !== info.version || !hasSameKeys(newReferences = referencedMap && referencedMap.get(sourceFilePath), oldReferencedMap && oldReferencedMap.get(sourceFilePath)) || newReferences && ts.forEachKey(newReferences, function (path) { return !state.fileInfos.has(path) && oldState.fileInfos.has(path) })) state.changedFilesSet.set(sourceFilePath, !0); else if (canCopySemanticDiagnostics) { var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath); diagnostics && state.semanticDiagnosticsPerFile.set(sourceFilePath, diagnostics) } }), state } function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) { ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.path)) } function getNextAffectedFile(state, cancellationToken, computeHash) { for (; ;) { var affectedFiles = state.affectedFiles; if (affectedFiles) { for (var seenAffectedFiles = state.seenAffectedFiles, semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile, affectedFilesIndex = state.affectedFilesIndex; affectedFilesIndex < affectedFiles.length;) { var affectedFile = affectedFiles[affectedFilesIndex]; if (!seenAffectedFiles.has(affectedFile.path)) return state.affectedFilesIndex = affectedFilesIndex, semanticDiagnosticsPerFile.delete(affectedFile.path), affectedFile; seenAffectedFiles.set(affectedFile.path, !0), affectedFilesIndex++ } state.changedFilesSet.delete(state.currentChangedFilePath), state.currentChangedFilePath = void 0, ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures), state.currentAffectedFilesSignatures.clear(), state.affectedFiles = void 0 } var nextKey = state.changedFilesSet.keys().next(); if (nextKey.done) return; var compilerOptions = state.program.getCompilerOptions(); if (compilerOptions.outFile || compilerOptions.out) return ts.Debug.assert(!state.semanticDiagnosticsPerFile), state.program; state.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures || ts.createMap(), state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, state.program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures), state.currentChangedFilePath = nextKey.value, state.semanticDiagnosticsPerFile.delete(nextKey.value), state.affectedFilesIndex = 0, state.seenAffectedFiles = state.seenAffectedFiles || ts.createMap() } } function doneWithAffectedFile(state, affected) { affected === state.program ? state.changedFilesSet.clear() : (state.seenAffectedFiles.set(affected.path, !0), state.affectedFilesIndex++) } function toAffectedFileResult(state, result, affected) { return doneWithAffectedFile(state, affected), { result: result, affected: affected } } function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) { var path = sourceFile.path, cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path); if (cachedDiagnostics) return cachedDiagnostics; var diagnostics = state.program.getSemanticDiagnostics(sourceFile, cancellationToken); return state.semanticDiagnosticsPerFile.set(path, diagnostics), diagnostics } function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { var host, newProgram, oldProgram; return void 0 === newProgramOrRootNames ? (ts.Debug.assert(void 0 === hostOrOptions), host = oldProgramOrHost, oldProgram = configFileParsingDiagnosticsOrOldProgram, ts.Debug.assert(!!oldProgram), newProgram = oldProgram.getProgram()) : ts.isArray(newProgramOrRootNames) ? (oldProgram = configFileParsingDiagnosticsOrOldProgram, newProgram = ts.createProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, oldProgram && oldProgram.getProgram(), configFileParsingDiagnostics), host = oldProgramOrHost) : (newProgram = newProgramOrRootNames, host = hostOrOptions, oldProgram = oldProgramOrHost, configFileParsingDiagnostics = configFileParsingDiagnosticsOrOldProgram), { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray } } function createBuilderProgram(kind, _a) { function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { var affected = getNextAffectedFile(state, cancellationToken, computeHash); if (affected) return toAffectedFileResult(state, state.program.emit(affected === state.program ? void 0 : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected) } function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram && (assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile), !targetSourceFile)) { for (var sourceMaps = [], emitSkipped = void 0, diagnostics = void 0, emittedFiles = [], affectedEmitResult = void 0; affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);)emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped, diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics), emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles), sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps); return { emitSkipped: emitSkipped, diagnostics: diagnostics || ts.emptyArray, emittedFiles: emittedFiles, sourceMaps: sourceMaps } } return state.program.emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) } function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) { for (; ;) { var affected = getNextAffectedFile(state, cancellationToken, computeHash); if (!affected) return; if (affected === state.program) return toAffectedFileResult(state, state.program.getSemanticDiagnostics(void 0, cancellationToken), affected); { if (!ignoreSourceFile || !ignoreSourceFile(affected)) return toAffectedFileResult(state, getSemanticDiagnosticsOfFile(state, affected, cancellationToken), affected); doneWithAffectedFile(state, affected) } } } function getSemanticDiagnostics(sourceFile, cancellationToken) { assertSourceFileOkWithoutNextAffectedCall(state, sourceFile); var compilerOptions = state.program.getCompilerOptions(); if (compilerOptions.outFile || compilerOptions.out) return ts.Debug.assert(!state.semanticDiagnosticsPerFile), state.program.getSemanticDiagnostics(sourceFile, cancellationToken); if (sourceFile) return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken); if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) for (var affected = void 0; affected = getNextAffectedFile(state, cancellationToken, computeHash);)doneWithAffectedFile(state, affected); for (var diagnostics, _i = 0, _a = state.program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile_2 = _a[_i]; diagnostics = ts.addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile_2, cancellationToken)) } return diagnostics || ts.emptyArray } var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics, oldState = oldProgram && oldProgram.getState(); if (oldState && newProgram === oldState.program && configFileParsingDiagnostics === newProgram.getConfigFileParsingDiagnostics()) return newProgram = void 0, oldState = void 0, oldProgram; var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()), computeHash = host.createHash || ts.identity, state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState); newProgram = void 0, oldProgram = void 0, oldState = void 0; var result = { getState: function () { return state }, getProgram: function () { return state.program }, getCompilerOptions: function () { return state.program.getCompilerOptions() }, getSourceFile: function (fileName) { return state.program.getSourceFile(fileName) }, getSourceFiles: function () { return state.program.getSourceFiles() }, getOptionsDiagnostics: function (cancellationToken) { return state.program.getOptionsDiagnostics(cancellationToken) }, getGlobalDiagnostics: function (cancellationToken) { return state.program.getGlobalDiagnostics(cancellationToken) }, getConfigFileParsingDiagnostics: function () { return configFileParsingDiagnostics || state.program.getConfigFileParsingDiagnostics() }, getSyntacticDiagnostics: function (sourceFile, cancellationToken) { return state.program.getSyntacticDiagnostics(sourceFile, cancellationToken) }, getSemanticDiagnostics: getSemanticDiagnostics, emit: emit, getAllDependencies: function (sourceFile) { return ts.BuilderState.getAllDependencies(state, state.program, sourceFile) }, getCurrentDirectory: function () { return state.program.getCurrentDirectory() } }; return kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram ? result.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile : kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram ? result.emitNextAffectedFile = emitNextAffectedFile : ts.notImplemented(), result } var BuilderProgramKind; !function (BuilderProgramKind) { BuilderProgramKind[BuilderProgramKind.SemanticDiagnosticsBuilderProgram = 0] = "SemanticDiagnosticsBuilderProgram", BuilderProgramKind[BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram = 1] = "EmitAndSemanticDiagnosticsBuilderProgram" }(BuilderProgramKind = ts.BuilderProgramKind || (ts.BuilderProgramKind = {})), ts.getBuilderCreationParameters = getBuilderCreationParameters, ts.createBuilderProgram = createBuilderProgram }(ts || (ts = {})), function (ts) { function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)) } function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics)) } function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics) { var program = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics).newProgram; return { getProgram: function () { return program }, getState: ts.notImplemented, getCompilerOptions: ts.notImplemented, getSourceFile: ts.notImplemented, getSourceFiles: ts.notImplemented, getOptionsDiagnostics: ts.notImplemented, getGlobalDiagnostics: ts.notImplemented, getConfigFileParsingDiagnostics: ts.notImplemented, getSyntacticDiagnostics: ts.notImplemented, getSemanticDiagnostics: ts.notImplemented, emit: ts.notImplemented, getAllDependencies: ts.notImplemented, getCurrentDirectory: ts.notImplemented } } ts.createSemanticDiagnosticsBuilderProgram = createSemanticDiagnosticsBuilderProgram, ts.createEmitAndSemanticDiagnosticsBuilderProgram = createEmitAndSemanticDiagnosticsBuilderProgram, ts.createAbstractBuilder = createAbstractBuilder }(ts || (ts = {})); var ts; !function (ts) { function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) { function getResolvedModule(resolution) { return resolution.resolvedModule } function getResolvedTypeReferenceDirective(resolution) { return resolution.resolvedTypeReferenceDirective } function isInDirectoryPath(dir, file) { return !(void 0 === dir || file.length <= dir.length) && (ts.startsWith(file, dir) && file[dir.length] === ts.directorySeparator) } function clear() { ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf), customFailedLookupPaths.clear(), closeTypeRootsWatch(), resolvedModuleNames.clear(), resolvedTypeReferenceDirectives.clear(), allFilesHaveInvalidatedResolution = !1, clearPerDirectoryResolutions() } function startRecordingFilesWithChangedResolutions() { filesWithChangedSetOfUnresolvedImports = [] } function finishRecordingFilesWithChangedResolutions() { var collected = filesWithChangedSetOfUnresolvedImports; return filesWithChangedSetOfUnresolvedImports = void 0, collected } function isFileWithInvalidatedNonRelativeUnresolvedImports(path) { if (!filesWithInvalidatedNonRelativeUnresolvedImports) return !1; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return value && !!value.length } function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { if (allFilesHaveInvalidatedResolution || forceAllFilesAsInvalidated) return filesWithInvalidatedResolutions = void 0, ts.returnTrue; var collected = filesWithInvalidatedResolutions; return filesWithInvalidatedResolutions = void 0, function (path) { return collected && collected.has(path) || isFileWithInvalidatedNonRelativeUnresolvedImports(path) } } function clearPerDirectoryResolutions() { perDirectoryResolvedModuleNames.clear(), nonRelaticeModuleNameCache.clear(), perDirectoryResolvedTypeReferenceDirectives.clear() } function finishCachingPerDirectoryResolution() { allFilesHaveInvalidatedResolution = !1, filesWithInvalidatedNonRelativeUnresolvedImports = void 0, directoryWatchesOfFailedLookups.forEach(function (watcher, path) { 0 === watcher.refCount && (directoryWatchesOfFailedLookups.delete(path), watcher.watcher.close()) }), clearPerDirectoryResolutions() } function resolveModuleName(moduleName, containingFile, compilerOptions, host) { var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache); if (!resolutionHost.getGlobalCache) return primaryResult; var globalCache = resolutionHost.getGlobalCache(); if (!(void 0 === globalCache || ts.isExternalModuleNameRelative(moduleName) || primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension))) { var _a = ts.loadModuleFromGlobalCache(moduleName, resolutionHost.projectName, compilerOptions, host, globalCache), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; if (resolvedModule) return { resolvedModule: resolvedModule, failedLookupLocations: ts.addRange(primaryResult.failedLookupLocations, failedLookupLocations) } } return primaryResult } function resolveNamesWithLocalCache(names, containingFile, cache, perDirectoryCache, loader, getResolutionWithResolvedFileName, reusedNames, logChanges) { function resolutionIsEqualTo(oldResolution, newResolution) { if (oldResolution === newResolution) return !0; if (!oldResolution || !newResolution) return !1; var oldResult = getResolutionWithResolvedFileName(oldResolution), newResult = getResolutionWithResolvedFileName(newResolution); return oldResult === newResult || !(!oldResult || !newResult) && oldResult.resolvedFileName === newResult.resolvedFileName } var path = resolutionHost.toPath(containingFile), resolutionsInFile = cache.get(path) || cache.set(path, ts.createMap()).get(path), dirPath = ts.getDirectoryPath(path), perDirectoryResolution = perDirectoryCache.get(dirPath); perDirectoryResolution || (perDirectoryResolution = ts.createMap(), perDirectoryCache.set(dirPath, perDirectoryResolution)); for (var resolvedModules = [], compilerOptions = resolutionHost.getCompilationSettings(), hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path), seenNamesInFile = ts.createMap(), _i = 0, names_2 = names; _i < names_2.length; _i++) { var name = names_2[_i], resolution = resolutionsInFile.get(name); if (!seenNamesInFile.has(name) && allFilesHaveInvalidatedResolution || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && !getResolutionWithResolvedFileName(resolution)) { var existingResolution = resolution, resolutionInDirectory = perDirectoryResolution.get(name); resolutionInDirectory ? resolution = resolutionInDirectory : (resolution = loader(name, containingFile, compilerOptions, resolutionHost), perDirectoryResolution.set(name, resolution)), resolutionsInFile.set(name, resolution), watchFailedLookupLocationOfResolution(resolution), existingResolution && stopWatchFailedLookupLocationOfResolution(existingResolution), logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution) && (filesWithChangedSetOfUnresolvedImports.push(path), logChanges = !1) } ts.Debug.assert(void 0 !== resolution && !resolution.isInvalidated), seenNamesInFile.set(name, !0), resolvedModules.push(getResolutionWithResolvedFileName(resolution)) } return resolutionsInFile.forEach(function (resolution, name) { seenNamesInFile.has(name) || ts.contains(reusedNames, name) || (stopWatchFailedLookupLocationOfResolution(resolution), resolutionsInFile.delete(name)) }), resolvedModules } function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile) { return resolveNamesWithLocalCache(typeDirectiveNames, containingFile, resolvedTypeReferenceDirectives, perDirectoryResolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, getResolvedTypeReferenceDirective, void 0, !1) } function resolveModuleNames(moduleNames, containingFile, reusedNames) { return resolveNamesWithLocalCache(moduleNames, containingFile, resolvedModuleNames, perDirectoryResolvedModuleNames, resolveModuleName, getResolvedModule, reusedNames, logChangesWhenResolvingModule) } function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) { var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile)); return cache && cache.get(moduleName) } function isNodeModulesDirectory(dirPath) { return ts.endsWith(dirPath, "/node_modules") } function isNodeModulesAtTypesDirectory(dirPath) { return ts.endsWith(dirPath, "/node_modules/@types") } function canWatchDirectory(dirPath) { var rootLength = ts.getRootLength(dirPath); if (dirPath.length === rootLength) return !1; var nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, rootLength); if (nextDirectorySeparator === -1) return !1; if (47 !== dirPath.charCodeAt(0) && dirPath.substr(rootLength, nextDirectorySeparator).search(/users/i) === -1) return !0; for (var searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--)if (searchIndex = dirPath.indexOf(ts.directorySeparator, searchIndex) + 1, 0 === searchIndex) return !1; return !0 } function filterFSRootDirectoriesToWatch(watchPath, dirPath) { return canWatchDirectory(dirPath) || (watchPath.ignore = !0), watchPath } function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) { return isInDirectoryPath(rootPath, failedLookupLocationPath) ? { dir: rootDir, dirPath: rootPath } : getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath)) } function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) { for (; ts.stringContains(dirPath, "/node_modules/");)dir = ts.getDirectoryPath(dir), dirPath = ts.getDirectoryPath(dirPath); if (isNodeModulesDirectory(dirPath)) return filterFSRootDirectoriesToWatch({ dir: dir, dirPath: dirPath }, ts.getDirectoryPath(dirPath)); var subDirectory; if (void 0 !== rootPath) for (; !isInDirectoryPath(dirPath, rootPath);) { var parentPath = ts.getDirectoryPath(dirPath); if (parentPath === dirPath) break; subDirectory = dirPath.slice(parentPath.length + ts.directorySeparator.length), dirPath = parentPath, dir = ts.getDirectoryPath(dir) } return filterFSRootDirectoriesToWatch({ dir: dir, dirPath: dirPath, subDirectory: subDirectory }, dirPath) } function isPathWithDefaultFailedLookupExtension(path) { return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions) } function watchFailedLookupLocationOfResolution(resolution) { if (resolution.failedLookupLocations && resolution.failedLookupLocations.length) { if (void 0 !== resolution.refCount) return void resolution.refCount++; resolution.refCount = 1; for (var failedLookupLocations = resolution.failedLookupLocations, setAtRoot = !1, _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) { var failedLookupLocation = failedLookupLocations_1[_i], failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation), _a = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath), dir = _a.dir, dirPath = _a.dirPath, ignore = _a.ignore, subDirectory = _a.subDirectory; if (!ignore) { if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) { var refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0; customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1) } dirPath === rootPath ? setAtRoot = !0 : setDirectoryWatcher(dir, dirPath, subDirectory) } } setAtRoot && setDirectoryWatcher(rootDir, rootPath) } } function setDirectoryWatcher(dir, dirPath, subDirectory) { var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath); if (dirWatcher ? dirWatcher.refCount++ : (dirWatcher = { watcher: createDirectoryWatcher(dir, dirPath), refCount: 1 }, directoryWatchesOfFailedLookups.set(dirPath, dirWatcher)), subDirectory) { var subDirectoryMap = dirWatcher.subDirectoryMap || (dirWatcher.subDirectoryMap = ts.createMap()), existing = subDirectoryMap.get(subDirectory) || 0; subDirectoryMap.set(subDirectory, existing + 1) } } function stopWatchFailedLookupLocationOfResolution(resolution) { if (resolution.failedLookupLocations && resolution.failedLookupLocations.length && (resolution.refCount-- , !resolution.refCount)) { for (var failedLookupLocations = resolution.failedLookupLocations, removeAtRoot = !1, _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) { var failedLookupLocation = failedLookupLocations_2[_i], failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation), _a = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath), dirPath = _a.dirPath, ignore = _a.ignore, subDirectory = _a.subDirectory; if (!ignore) { var refCount = customFailedLookupPaths.get(failedLookupLocationPath); refCount && (1 === refCount ? customFailedLookupPaths.delete(failedLookupLocationPath) : (ts.Debug.assert(refCount > 1), customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1))), dirPath === rootPath ? removeAtRoot = !0 : removeDirectoryWatcher(dirPath, subDirectory) } } removeAtRoot && removeDirectoryWatcher(rootPath) } } function removeDirectoryWatcher(dirPath, subDirectory) { var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath); if (subDirectory) { var existing = dirWatcher.subDirectoryMap.get(subDirectory); 1 === existing ? dirWatcher.subDirectoryMap.delete(subDirectory) : dirWatcher.subDirectoryMap.set(subDirectory, existing - 1) } dirWatcher.refCount-- } function inWatchedSubdirectory(dirPath, fileOrDirectoryPath) { var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath); return !(!dirWatcher || !dirWatcher.subDirectoryMap) && ts.forEachKey(dirWatcher.subDirectoryMap, function (subDirectory) { var fullSubDirectory = dirPath + "/" + subDirectory; return fullSubDirectory === fileOrDirectoryPath || isInDirectoryPath(fullSubDirectory, fileOrDirectoryPath) }) } function createDirectoryWatcher(directory, dirPath) { return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) { var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory); cachedDirectoryStructureHost && cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath), allFilesHaveInvalidatedResolution || dirPath !== rootPath && !isNodeModulesDirectory(dirPath) && ts.getDirectoryPath(fileOrDirectoryPath) !== dirPath && !inWatchedSubdirectory(dirPath, fileOrDirectoryPath) || invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath) && resolutionHost.onInvalidatedResolution() }, 1) } function removeResolutionsOfFileFromCache(cache, filePath) { var resolutions = cache.get(filePath); resolutions && (resolutions.forEach(stopWatchFailedLookupLocationOfResolution), cache.delete(filePath)) } function removeResolutionsOfFile(filePath) { removeResolutionsOfFileFromCache(resolvedModuleNames, filePath), removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath) } function invalidateResolutionCache(cache, isInvalidatedResolution, getResolutionWithResolvedFileName) { var seen = ts.createMap(); cache.forEach(function (resolutions, containingFilePath) { var dirPath = ts.getDirectoryPath(containingFilePath), seenInDir = seen.get(dirPath); seenInDir || (seenInDir = ts.createMap(), seen.set(dirPath, seenInDir)), resolutions.forEach(function (resolution, name) { seenInDir.has(name) || (seenInDir.set(name, !0), !resolution.isInvalidated && isInvalidatedResolution(resolution, getResolutionWithResolvedFileName) && (resolution.isInvalidated = !0, (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = ts.createMap())).set(containingFilePath, !0))) }) }) } function hasReachedResolutionIterationLimit() { var maxSize = resolutionHost.maxNumberOfFilesToIterateForInvalidation || ts.maxNumberOfFilesToIterateForInvalidation; return resolvedModuleNames.size > maxSize || resolvedTypeReferenceDirectives.size > maxSize } function invalidateResolutions(isInvalidatedResolution) { return hasReachedResolutionIterationLimit() ? void (allFilesHaveInvalidatedResolution = !0) : (invalidateResolutionCache(resolvedModuleNames, isInvalidatedResolution, getResolvedModule), void invalidateResolutionCache(resolvedTypeReferenceDirectives, isInvalidatedResolution, getResolvedTypeReferenceDirective)) } function invalidateResolutionOfFile(filePath) { removeResolutionsOfFile(filePath), invalidateResolutions(function (resolution, getResolutionWithResolvedFileName) { var result = getResolutionWithResolvedFileName(resolution); return result && resolutionHost.toPath(result.resolvedFileName) === filePath }) } function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) { ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || void 0 === filesWithInvalidatedNonRelativeUnresolvedImports), filesWithInvalidatedNonRelativeUnresolvedImports = filesMap } function invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) { var isChangedFailedLookupLocation; if (isCreatingWatchedDirectory) isChangedFailedLookupLocation = function (location) { return isInDirectoryPath(fileOrDirectoryPath, resolutionHost.toPath(location)) }; else { var dirOfFileOrDirectory = ts.getDirectoryPath(fileOrDirectoryPath); if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || isNodeModulesDirectory(fileOrDirectoryPath) || isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || isNodeModulesDirectory(dirOfFileOrDirectory)) isChangedFailedLookupLocation = function (location) { var locationPath = resolutionHost.toPath(location); return locationPath === fileOrDirectoryPath || ts.startsWith(resolutionHost.toPath(location), fileOrDirectoryPath) }; else { if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) return !1; if (ts.isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) return !1; isChangedFailedLookupLocation = function (location) { return resolutionHost.toPath(location) === fileOrDirectoryPath } } } var hasChangedFailedLookupLocation = function (resolution) { return ts.some(resolution.failedLookupLocations, isChangedFailedLookupLocation) }, invalidatedFilesCount = filesWithInvalidatedResolutions && filesWithInvalidatedResolutions.size; return invalidateResolutions(hasChangedFailedLookupLocation), allFilesHaveInvalidatedResolution || filesWithInvalidatedResolutions && filesWithInvalidatedResolutions.size !== invalidatedFilesCount } function closeTypeRootsWatch() { ts.clearMap(typeRootsWatches, ts.closeFileWatcher) } function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) { if (!allFilesHaveInvalidatedResolution) { if (isInDirectoryPath(rootPath, typeRootPath)) return rootPath; var _a = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath), dirPath = _a.dirPath, ignore = _a.ignore; return !ignore && directoryWatchesOfFailedLookups.has(dirPath) && dirPath } } function createTypeRootsWatch(typeRootPath, typeRoot) { return resolutionHost.watchTypeRootsDirectory(typeRoot, function (fileOrDirectory) { var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory); cachedDirectoryStructureHost && cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath), resolutionHost.onChangedAutomaticTypeDirectiveNames(); var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath); dirPath && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath) && resolutionHost.onInvalidatedResolution() }, 1) } function updateTypeRootsWatch() { var options = resolutionHost.getCompilationSettings(); if (options.types) return void closeTypeRootsWatch(); var typeRoots = ts.getEffectiveTypeRoots(options, { directoryExists: directoryExistsForTypeRootWatch, getCurrentDirectory: getCurrentDirectory }); typeRoots ? ts.mutateMap(typeRootsWatches, ts.arrayToMap(typeRoots, function (tr) { return resolutionHost.toPath(tr) }), { createNewValue: createTypeRootsWatch, onDeleteValue: ts.closeFileWatcher }) : closeTypeRootsWatch() } function directoryExistsForTypeRootWatch(nodeTypesDirectory) { var dir = ts.getDirectoryPath(ts.getDirectoryPath(nodeTypesDirectory)), dirPath = resolutionHost.toPath(dir); return dirPath === rootPath || canWatchDirectory(dirPath) } var filesWithChangedSetOfUnresolvedImports, filesWithInvalidatedResolutions, filesWithInvalidatedNonRelativeUnresolvedImports, allFilesHaveInvalidatedResolution = !1, getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory() }), cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost(), resolvedModuleNames = ts.createMap(), perDirectoryResolvedModuleNames = ts.createMap(), nonRelaticeModuleNameCache = ts.createMap(), moduleResolutionCache = ts.createModuleResolutionCacheWithMaps(perDirectoryResolvedModuleNames, nonRelaticeModuleNameCache, getCurrentDirectory(), resolutionHost.getCanonicalFileName), resolvedTypeReferenceDirectives = ts.createMap(), perDirectoryResolvedTypeReferenceDirectives = ts.createMap(), failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"], customFailedLookupPaths = ts.createMap(), directoryWatchesOfFailedLookups = ts.createMap(), rootDir = rootDirForResolution && ts.removeTrailingDirectorySeparator(ts.getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory())), rootPath = rootDir && resolutionHost.toPath(rootDir), typeRootsWatches = ts.createMap(); return { startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions, finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions, startCachingPerDirectoryResolution: clearPerDirectoryResolutions, finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution, resolveModuleNames: resolveModuleNames, getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache, resolveTypeReferenceDirectives: resolveTypeReferenceDirectives, removeResolutionsOfFile: removeResolutionsOfFile, invalidateResolutionOfFile: invalidateResolutionOfFile, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, createHasInvalidatedResolution: createHasInvalidatedResolution, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, clear: clear } } ts.maxNumberOfFilesToIterateForInvalidation = 256, ts.createResolutionCache = createResolutionCache }(ts || (ts = {})); var ts; !function (ts) { var moduleSpecifiers; !function (moduleSpecifiers) { function getModuleSpecifier(compilerOptions, fromSourceFile, fromSourceFileName, toFileName, host, preferences) { void 0 === preferences && (preferences = {}); var info = getInfo(compilerOptions, fromSourceFile, fromSourceFileName, host); return getGlobalModuleSpecifier(toFileName, info, host, compilerOptions) || ts.first(getLocalModuleSpecifiers(toFileName, info, compilerOptions, preferences)) } function getModuleSpecifiers(moduleSymbol, compilerOptions, importingSourceFile, host, files, preferences) { var ambient = tryGetModuleNameFromAmbientModule(moduleSymbol); if (ambient) return [[ambient]]; var info = getInfo(compilerOptions, importingSourceFile, importingSourceFile.path, host); if (!files) return ts.Debug.fail("Files list must be present to resolve symlinks in specifier resolution"); var modulePaths = getAllModulePaths(files, ts.getSourceFileOfNode(moduleSymbol.valueDeclaration), info.getCanonicalFileName, host), global = ts.mapDefined(modulePaths, function (moduleFileName) { return getGlobalModuleSpecifier(moduleFileName, info, host, compilerOptions) }); return global.length ? global.map(function (g) { return [g] }) : modulePaths.map(function (moduleFileName) { return getLocalModuleSpecifiers(moduleFileName, info, compilerOptions, preferences) }) } function getInfo(compilerOptions, importingSourceFile, importingSourceFileName, host) { var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions), addJsExtension = usesJsExtensionOnImports(importingSourceFile), getCanonicalFileName = ts.createGetCanonicalFileName(!host.useCaseSensitiveFileNames || host.useCaseSensitiveFileNames()), sourceDirectory = ts.getDirectoryPath(importingSourceFileName); return { moduleResolutionKind: moduleResolutionKind, addJsExtension: addJsExtension, getCanonicalFileName: getCanonicalFileName, sourceDirectory: sourceDirectory } } function getGlobalModuleSpecifier(moduleFileName, _a, host, compilerOptions) { var addJsExtension = _a.addJsExtension, getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory; return tryGetModuleNameFromTypeRoots(compilerOptions, host, getCanonicalFileName, moduleFileName, addJsExtension) || tryGetModuleNameAsNodeModule(compilerOptions, moduleFileName, host, getCanonicalFileName, sourceDirectory) || compilerOptions.rootDirs && tryGetModuleNameFromRootDirs(compilerOptions.rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) } function getLocalModuleSpecifiers(moduleFileName, _a, compilerOptions, preferences) { var moduleResolutionKind = _a.moduleResolutionKind, addJsExtension = _a.addJsExtension, getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory, baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, relativePath = removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), moduleResolutionKind, addJsExtension); if (!baseUrl || "relative" === preferences.importModuleSpecifierPreference) return [relativePath]; var relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseUrl, getCanonicalFileName); if (!relativeToBaseUrl) return [relativePath]; var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, moduleResolutionKind, addJsExtension); if (paths) { var fromPaths = tryGetModuleNameFromPaths(ts.removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths); if (fromPaths) return [fromPaths] } if ("non-relative" === preferences.importModuleSpecifierPreference) return [importRelativeToBaseUrl]; if (void 0 !== preferences.importModuleSpecifierPreference && ts.Debug.assertNever(preferences.importModuleSpecifierPreference), isPathRelativeToParent(relativeToBaseUrl)) return [relativePath]; var pathFromSourceToBaseUrl = ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, baseUrl, getCanonicalFileName)), relativeFirst = getRelativePathNParents(relativePath) < getRelativePathNParents(pathFromSourceToBaseUrl); return relativeFirst ? [relativePath, importRelativeToBaseUrl] : [importRelativeToBaseUrl, relativePath] } function usesJsExtensionOnImports(_a) { var imports = _a.imports; return ts.firstDefined(imports, function (_a) { var text = _a.text; return ts.pathIsRelative(text) ? ts.fileExtensionIs(text, ".js") : void 0 }) || !1 } function discoverProbableSymlinks(files) { var symlinks = ts.mapDefined(files, function (sf) { return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) { return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : void 0 }) }), result = ts.createMap(); if (symlinks) for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) { for (var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1], resolvedParts = ts.getPathComponents(resolvedPath), originalParts = ts.getPathComponents(originalPath); resolvedParts[resolvedParts.length - 1] === originalParts[originalParts.length - 1];)resolvedParts.pop(), originalParts.pop(); result.set(ts.getPathFromPathComponents(originalParts), ts.getPathFromPathComponents(resolvedParts)) } return result } function getAllModulePathsUsingIndirectSymlinks(files, target, getCanonicalFileName, host) { for (var options, links = discoverProbableSymlinks(files), paths = ts.arrayFrom(links.keys()), _i = 0, paths_2 = paths; _i < paths_2.length; _i++) { var path = paths_2[_i], resolved = links.get(path); if (ts.startsWith(target, resolved + "/")) { var relative = ts.getRelativePathFromDirectory(resolved, target, getCanonicalFileName), option = ts.resolvePath(path, relative); host.fileExists && !host.fileExists(option) || (options || (options = []), options.push(option)) } } var resolvedtarget = host.getCurrentDirectory ? ts.resolvePath(host.getCurrentDirectory(), target) : target; return options ? (options.push(resolvedtarget), options) : [resolvedtarget] } function getAllModulePaths(files, _a, getCanonicalFileName, host) { var fileName = _a.fileName, symlinks = ts.mapDefined(files, function (sf) { return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) { return res && res.resolvedFileName === fileName ? res.originalPath : void 0 }) }); return 0 === symlinks.length ? getAllModulePathsUsingIndirectSymlinks(files, fileName, getCanonicalFileName, host) : symlinks } function getRelativePathNParents(relativePath) { var components = ts.getPathComponents(relativePath); if (components[0] || 1 === components.length) return 0; for (var i = 1; i < components.length; i++)if (".." !== components[i]) return i - 1; return components.length - 1 } function tryGetModuleNameFromAmbientModule(moduleSymbol) { var decl = moduleSymbol.valueDeclaration; if (ts.isModuleDeclaration(decl) && ts.isStringLiteral(decl.name)) return decl.name.text } function tryGetModuleNameFromPaths(relativeToBaseUrlWithIndex, relativeToBaseUrl, paths) { for (var key in paths) for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { var patternText_1 = _a[_i], pattern = ts.removeFileExtension(ts.normalizePath(patternText_1)), indexOfStar = pattern.indexOf("*"); if (0 !== indexOfStar || 1 !== pattern.length) if (indexOfStar !== -1) { var prefix = pattern.substr(0, indexOfStar), suffix = pattern.substr(indexOfStar + 1); if (relativeToBaseUrl.length >= prefix.length + suffix.length && ts.startsWith(relativeToBaseUrl, prefix) && ts.endsWith(relativeToBaseUrl, suffix)) { var matchedStar = relativeToBaseUrl.substr(prefix.length, relativeToBaseUrl.length - suffix.length); return key.replace("*", matchedStar) } } else if (pattern === relativeToBaseUrl || pattern === relativeToBaseUrlWithIndex) return key } } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) { var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); if (void 0 !== normalizedTargetPath) { var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName), relativePath = void 0 !== normalizedSourcePath ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.removeFileExtension(relativePath) } } function tryGetModuleNameFromTypeRoots(options, host, getCanonicalFileName, moduleFileName, addJsExtension) { var roots = ts.getEffectiveTypeRoots(options, host); return ts.firstDefined(roots, function (unNormalizedTypeRoot) { var typeRoot = ts.toPath(unNormalizedTypeRoot, void 0, getCanonicalFileName); if (ts.startsWith(moduleFileName, typeRoot)) return removeExtensionAndIndexPostFix(moduleFileName.substring(typeRoot.length + 1), ts.ModuleResolutionKind.NodeJs, addJsExtension) }) } function tryGetModuleNameAsNodeModule(options, moduleFileName, host, getCanonicalFileName, sourceDirectory) { function getDirectoryOrExtensionlessFileName(path) { var packageRootPath = path.substring(0, parts.packageRootIndex), packageJsonPath = ts.combinePaths(packageRootPath, "package.json"); if (host.fileExists(packageJsonPath)) { var packageJsonContent = JSON.parse(host.readFile(packageJsonPath)); if (packageJsonContent) { var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main; if (mainFileRelative) { var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName); if (mainExportFile === getCanonicalFileName(path)) return packageRootPath } } } var fullModulePathWithoutExtension = ts.removeFileExtension(path); return "/index" !== getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) || tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex)) ? fullModulePathWithoutExtension : fullModulePathWithoutExtension.substring(0, parts.fileNameIndex) } function getNodeResolvablePath(path) { var basePath = path.substring(0, parts.topLevelNodeModulesIndex); return 0 === sourceDirectory.indexOf(basePath) ? path.substring(parts.topLevelPackageNameIndex + 1) : ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, path, getCanonicalFileName)) } if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs) { var parts = getNodeModulePathParts(moduleFileName); if (parts) { var moduleSpecifier = getDirectoryOrExtensionlessFileName(moduleFileName); return moduleSpecifier = getNodeResolvablePath(moduleSpecifier), ts.getPackageNameFromAtTypesDirectory(moduleSpecifier) } } } function tryGetAnyFileFromPath(host, path) { for (var extensions = ts.getSupportedExtensions({ allowJs: !0 }, [{ extension: "node", isMixedContent: !1 }, { extension: "json", isMixedContent: !1, scriptKind: 6 }]), _i = 0, extensions_3 = extensions; _i < extensions_3.length; _i++) { var e = extensions_3[_i], fullPath = path + e; if (host.fileExists(fullPath)) return fullPath } } function getNodeModulePathParts(fullPath) { var States, topLevelNodeModulesIndex = 0, topLevelPackageNameIndex = 0, packageRootIndex = 0, fileNameIndex = 0; !function (States) { States[States.BeforeNodeModules = 0] = "BeforeNodeModules", States[States.NodeModules = 1] = "NodeModules", States[States.Scope = 2] = "Scope", States[States.PackageContent = 3] = "PackageContent" }(States || (States = {})); for (var partStart = 0, partEnd = 0, state = 0; partEnd >= 0;)switch (partStart = partEnd, partEnd = fullPath.indexOf("/", partStart + 1), state) { case 0: fullPath.indexOf("/node_modules/", partStart) === partStart && (topLevelNodeModulesIndex = partStart, topLevelPackageNameIndex = partEnd, state = 1); break; case 1: case 2: 1 === state && "@" === fullPath.charAt(partStart + 1) ? state = 2 : (packageRootIndex = partEnd, state = 3); break; case 3: state = fullPath.indexOf("/node_modules/", partStart) === partStart ? 1 : 3 }return fileNameIndex = partStart, state > 1 ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : void 0 } function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { return ts.firstDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return isPathRelativeToParent(relativePath) ? void 0 : relativePath }) } function removeExtensionAndIndexPostFix(fileName, moduleResolutionKind, addJsExtension) { var noExtension = ts.removeFileExtension(fileName); return addJsExtension ? noExtension + ".js" : moduleResolutionKind === ts.ModuleResolutionKind.NodeJs ? ts.removeSuffix(noExtension, "/index") : noExtension } function getRelativePathIfInDirectory(path, directoryPath, getCanonicalFileName) { var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, !1); return ts.isRootedDiskPath(relativePath) ? void 0 : relativePath } function isPathRelativeToParent(path) { return ts.startsWith(path, "..") } moduleSpecifiers.getModuleSpecifier = getModuleSpecifier, moduleSpecifiers.getModuleSpecifiers = getModuleSpecifiers }(moduleSpecifiers = ts.moduleSpecifiers || (ts.moduleSpecifiers = {})) }(ts || (ts = {})); var ts; !function (ts) { function createDiagnosticReporter(system, pretty) { var host = system === ts.sys ? sysFormatDiagnosticsHost : { getCurrentDirectory: function () { return system.getCurrentDirectory() }, getNewLine: function () { return system.newLine }, getCanonicalFileName: ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames) }; if (!pretty) return function (diagnostic) { return system.write(ts.formatDiagnostic(diagnostic, host)) }; var diagnostics = new Array(1); return function (diagnostic) { diagnostics[0] = diagnostic, system.write(ts.formatDiagnosticsWithColorAndContext(diagnostics, host) + host.getNewLine()), diagnostics[0] = void 0 } } function clearScreenIfNotWatchingForFileChanges(system, diagnostic, options) { return !(!system.clearScreen || options.preserveWatchOutput || options.extendedDiagnostics || options.diagnostics || ts.contains(ts.nonClearingMessageCodes, diagnostic.code)) && (system.clearScreen(), !0) } function getPlainDiagnosticFollowingNewLines(diagnostic, newLine) { return ts.contains(ts.screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine } function createWatchStatusReporter(system, pretty) { return pretty ? function (diagnostic, newLine, options) { clearScreenIfNotWatchingForFileChanges(system, diagnostic, options); var output = "[" + ts.formatColorAndReset((new Date).toLocaleTimeString(), ts.ForegroundColorEscapeSequences.Grey) + "] "; output += "" + ts.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine) + (newLine + newLine), system.write(output) } : function (diagnostic, newLine, options) { var output = ""; clearScreenIfNotWatchingForFileChanges(system, diagnostic, options) || (output += newLine), output += (new Date).toLocaleTimeString() + " - ", output += "" + ts.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine) + getPlainDiagnosticFollowingNewLines(diagnostic, newLine), system.write(output) } } function parseConfigFileWithSystem(configFileName, optionsToExtend, system, reportDiagnostic) { var host = system; host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(ts.sys, reportDiagnostic, diagnostic) }; var result = ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host); return host.onUnRecoverableConfigFileDiagnostic = void 0, result } function emitFilesAndReportErrors(program, reportDiagnostic, writeFileName, reportSummary) { var diagnostics = program.getConfigFileParsingDiagnostics().slice(), configFileParsingDiagnosticsLength = diagnostics.length; ts.addRange(diagnostics, program.getSyntacticDiagnostics()); var reportSemanticDiagnostics = !1; diagnostics.length === configFileParsingDiagnosticsLength && (ts.addRange(diagnostics, program.getOptionsDiagnostics()), ts.addRange(diagnostics, program.getGlobalDiagnostics()), diagnostics.length === configFileParsingDiagnosticsLength && (reportSemanticDiagnostics = !0)); var _a = program.emit(), emittedFiles = _a.emittedFiles, emitSkipped = _a.emitSkipped, emitDiagnostics = _a.diagnostics; if (ts.addRange(diagnostics, emitDiagnostics), reportSemanticDiagnostics && ts.addRange(diagnostics, program.getSemanticDiagnostics()), ts.sortAndDeduplicateDiagnostics(diagnostics).forEach(reportDiagnostic), writeFileName) { var currentDir_1 = program.getCurrentDirectory(); ts.forEach(emittedFiles, function (file) { var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1); writeFileName("TSFILE: " + filepath) }), program.getCompilerOptions().listFiles && ts.forEach(program.getSourceFiles(), function (file) { writeFileName(file.fileName) }) } return reportSummary && reportSummary(diagnostics.filter(function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error }).length), emitSkipped && diagnostics.length > 0 ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : diagnostics.length > 0 ? ts.ExitStatus.DiagnosticsPresent_OutputsGenerated : ts.ExitStatus.Success } function createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus) { function getDefaultLibLocation() { return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath())) } function emitFilesAndReportErrorUsingBuilder(builderProgram) { var compilerOptions = builderProgram.getCompilerOptions(), newLine = ts.getNewLineCharacter(compilerOptions, function () { return system.newLine }), reportSummary = function (errorCount) { 1 === errorCount ? onWatchStatusChange(ts.createCompilerDiagnostic(ts.Diagnostics.Found_1_error_Watching_for_file_changes, errorCount), newLine, compilerOptions) : onWatchStatusChange(ts.createCompilerDiagnostic(ts.Diagnostics.Found_0_errors_Watching_for_file_changes, errorCount, errorCount), newLine, compilerOptions) }; emitFilesAndReportErrors(builderProgram, reportDiagnostic, writeFileName, reportSummary) } void 0 === system && (system = ts.sys), createProgram || (createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram); var host = system, useCaseSensitiveFileNames = function () { return system.useCaseSensitiveFileNames }, writeFileName = function (s) { return system.write(s + system.newLine) }, onWatchStatusChange = reportWatchStatus || createWatchStatusReporter(system); return { useCaseSensitiveFileNames: useCaseSensitiveFileNames, getNewLine: function () { return system.newLine }, getCurrentDirectory: function () { return system.getCurrentDirectory() }, getDefaultLibLocation: getDefaultLibLocation, getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)) }, fileExists: function (path) { return system.fileExists(path) }, readFile: function (path, encoding) { return system.readFile(path, encoding) }, directoryExists: function (path) { return system.directoryExists(path) }, getDirectories: function (path) { return system.getDirectories(path) }, readDirectory: function (path, extensions, exclude, include, depth) { return system.readDirectory(path, extensions, exclude, include, depth) }, realpath: system.realpath && function (path) { return system.realpath(path) }, getEnvironmentVariable: system.getEnvironmentVariable && function (name) { return system.getEnvironmentVariable(name) }, watchFile: system.watchFile ? function (path, callback, pollingInterval) { return system.watchFile(path, callback, pollingInterval) } : function () { return noopFileWatcher }, watchDirectory: system.watchDirectory ? function (path, callback, recursive) { return system.watchDirectory(path, callback, recursive) } : function () { return noopFileWatcher }, setTimeout: system.setTimeout ? function (callback, ms) { for (var args = [], _i = 2; _i < arguments.length; _i++)args[_i - 2] = arguments[_i]; var _a; return (_a = system.setTimeout).call.apply(_a, [system, callback, ms].concat(args)) } : ts.noop, clearTimeout: system.clearTimeout ? function (timeoutId) { return system.clearTimeout(timeoutId) } : ts.noop, trace: function (s) { return system.write(s) }, onWatchStatusChange: onWatchStatusChange, createDirectory: function (path) { return system.createDirectory(path) }, writeFile: function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark) }, onCachedDirectoryStructureHostCreate: function (cacheHost) { return host = cacheHost || system }, createHash: system.createHash && function (s) { return system.createHash(s) }, createProgram: createProgram, afterProgramCreate: emitFilesAndReportErrorUsingBuilder } } function reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic) { reportDiagnostic(diagnostic), system.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped) } function createWatchCompilerHostOfConfigFile(configFileName, optionsToExtend, system, createProgram, reportDiagnostic, reportWatchStatus) { reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system); var host = createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus); return host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic) }, host.configFileName = configFileName, host.optionsToExtend = optionsToExtend, host } function createWatchCompilerHostOfFilesAndCompilerOptions(rootFiles, options, system, createProgram, reportDiagnostic, reportWatchStatus) { var host = createWatchCompilerHost(system, createProgram, reportDiagnostic || createDiagnosticReporter(system), reportWatchStatus); return host.rootFiles = rootFiles, host.options = options, host } var sysFormatDiagnosticsHost = ts.sys ? { getCurrentDirectory: function () { return ts.sys.getCurrentDirectory() }, getNewLine: function () { return ts.sys.newLine }, getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames) } : void 0; ts.createDiagnosticReporter = createDiagnosticReporter, ts.nonClearingMessageCodes = [ts.Diagnostics.Found_1_error_Watching_for_file_changes.code, ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code], ts.screenStartingMessageCodes = [ts.Diagnostics.Starting_compilation_in_watch_mode.code, ts.Diagnostics.File_change_detected_Starting_incremental_compilation.code], ts.createWatchStatusReporter = createWatchStatusReporter, ts.parseConfigFileWithSystem = parseConfigFileWithSystem, ts.emitFilesAndReportErrors = emitFilesAndReportErrors; var noopFileWatcher = { close: ts.noop }; ts.createWatchCompilerHostOfConfigFile = createWatchCompilerHostOfConfigFile, ts.createWatchCompilerHostOfFilesAndCompilerOptions = createWatchCompilerHostOfFilesAndCompilerOptions }(ts || (ts = {})), function (ts) { function createWatchCompilerHost(rootFilesOrConfigFileName, options, system, createProgram, reportDiagnostic, reportWatchStatus) { return ts.isArray(rootFilesOrConfigFileName) ? ts.createWatchCompilerHostOfFilesAndCompilerOptions(rootFilesOrConfigFileName, options, system, createProgram, reportDiagnostic, reportWatchStatus) : ts.createWatchCompilerHostOfConfigFile(rootFilesOrConfigFileName, options, system, createProgram, reportDiagnostic, reportWatchStatus) } function createWatchProgram(host) { function getCurrentBuilderProgram() { return builderProgram } function getCurrentProgram() { return builderProgram && builderProgram.getProgram() } function synchronizeProgram() { writeLog("Synchronizing program"); var program = getCurrentProgram(); hasChangedCompilerOptions && (newLine = updateNewLine(), program && ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions) && resolutionCache.clear()); var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); return ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames) ? hasChangedConfigFileParsingErrors && (builderProgram = createProgram(void 0, void 0, compilerHost, builderProgram, configFileParsingDiagnostics), hasChangedConfigFileParsingErrors = !1) : createNewProgram(program, hasInvalidatedResolution), host.afterProgramCreate && host.afterProgramCreate(builderProgram), builderProgram } function createNewProgram(program, hasInvalidatedResolution) { watchLogLevel !== ts.WatchLogLevel.None && (writeLog("CreatingProgramWith::"), writeLog(" roots: " + JSON.stringify(rootFileNames)), writeLog(" options: " + JSON.stringify(compilerOptions))); var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !program; if (hasChangedCompilerOptions = !1, hasChangedConfigFileParsingErrors = !1, resolutionCache.startCachingPerDirectoryResolution(), compilerHost.hasInvalidatedResolution = hasInvalidatedResolution, compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames, builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics), resolutionCache.finishCachingPerDirectoryResolution(), ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = ts.createMap()), watchMissingFilePath), needsUpdateInTypeRootWatch && resolutionCache.updateTypeRootsWatch(), missingFilePathsRequestedForRelease) { for (var _i = 0, missingFilePathsRequestedForRelease_1 = missingFilePathsRequestedForRelease; _i < missingFilePathsRequestedForRelease_1.length; _i++) { var missingFilePath = missingFilePathsRequestedForRelease_1[_i]; missingFilesMap.has(missingFilePath) || sourceFilesCache.delete(missingFilePath) } missingFilePathsRequestedForRelease = void 0 } } function updateRootFileNames(files) { ts.Debug.assert(!configFileName, "Cannot update root file names with config file watch mode"), rootFileNames = files, scheduleProgramUpdate() } function updateNewLine() { return ts.getNewLineCharacter(compilerOptions || optionsToExtendForConfigFile, function () { return host.getNewLine() }) } function toPath(fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName) } function isFileMissingOnHost(hostSourceFile) { return "number" == typeof hostSourceFile } function isFilePresentOnHost(hostSourceFile) { return !!hostSourceFile.sourceFile } function fileExists(fileName) { var path = toPath(fileName); return !!isFileMissingOnHost(sourceFilesCache.get(path)) || directoryStructureHost.fileExists(fileName) } function getVersionedSourceFileByPath(fileName, path, languageVersion, onError, shouldCreateNewSourceFile) { function getNewSourceFile() { var text; try { ts.performance.mark("beforeIORead"), text = host.readFile(fileName, compilerOptions.charset), ts.performance.mark("afterIORead"), ts.performance.measure("I/O Read", "beforeIORead", "afterIORead") } catch (e) { onError && onError(e.message) } return void 0 !== text ? ts.createSourceFile(fileName, text, languageVersion) : void 0 } var hostSourceFile = sourceFilesCache.get(path); if (!isFileMissingOnHost(hostSourceFile)) { if (!hostSourceFile || shouldCreateNewSourceFile || !isFilePresentOnHost(hostSourceFile) || hostSourceFile.version.toString() !== hostSourceFile.sourceFile.version) { var sourceFile = getNewSourceFile(); if (hostSourceFile) shouldCreateNewSourceFile && hostSourceFile.version++ , sourceFile ? (hostSourceFile.sourceFile = sourceFile, sourceFile.version = hostSourceFile.version.toString(), hostSourceFile.fileWatcher || (hostSourceFile.fileWatcher = watchFilePath(host, fileName, onSourceFileChange, ts.PollingInterval.Low, path, "Source file"))) : (isFilePresentOnHost(hostSourceFile) && hostSourceFile.fileWatcher.close(), sourceFilesCache.set(path, hostSourceFile.version)); else if (sourceFile) { sourceFile.version = initialVersion.toString(); var fileWatcher = watchFilePath(host, fileName, onSourceFileChange, ts.PollingInterval.Low, path, "Source file"); sourceFilesCache.set(path, { sourceFile: sourceFile, version: initialVersion, fileWatcher: fileWatcher }) } else sourceFilesCache.set(path, initialVersion); return sourceFile } return hostSourceFile.sourceFile } } function nextSourceFileVersion(path) { var hostSourceFile = sourceFilesCache.get(path); void 0 !== hostSourceFile && (isFileMissingOnHost(hostSourceFile) ? sourceFilesCache.set(path, { version: Number(hostSourceFile) + 1 }) : hostSourceFile.version++) } function getSourceVersion(path) { var hostSourceFile = sourceFilesCache.get(path); return !hostSourceFile || isFileMissingOnHost(hostSourceFile) ? void 0 : hostSourceFile.version.toString() } function onReleaseOldSourceFile(oldSourceFile, _oldOptions) { var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.path); hostSourceFileInfo && (isFileMissingOnHost(hostSourceFileInfo) ? (missingFilePathsRequestedForRelease || (missingFilePathsRequestedForRelease = [])).push(oldSourceFile.path) : hostSourceFileInfo.sourceFile === oldSourceFile && (hostSourceFileInfo.fileWatcher && hostSourceFileInfo.fileWatcher.close(), sourceFilesCache.delete(oldSourceFile.path), resolutionCache.removeResolutionsOfFile(oldSourceFile.path))) } function reportWatchDiagnostic(message) { host.onWatchStatusChange && host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile) } function scheduleProgramUpdate() { host.setTimeout && host.clearTimeout && (timerToUpdateProgram && host.clearTimeout(timerToUpdateProgram), writeLog("Scheduling update"), timerToUpdateProgram = host.setTimeout(updateProgram, 250)) } function scheduleProgramReload() { ts.Debug.assert(!!configFileName), reloadLevel = ts.ConfigFileProgramReloadLevel.Full, scheduleProgramUpdate() } function updateProgram() { switch (timerToUpdateProgram = void 0, reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation), reloadLevel) { case ts.ConfigFileProgramReloadLevel.Partial: return reloadFileNamesFromConfigFile(); case ts.ConfigFileProgramReloadLevel.Full: return reloadConfigFile(); default: return void synchronizeProgram() } } function reloadFileNamesFromConfigFile() { writeLog("Reloading new file names and options"); var result = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), compilerOptions, parseConfigFileHost); result.fileNames.length ? (configFileParsingDiagnostics = ts.filter(configFileParsingDiagnostics, function (error) { return !ts.isErrorNoInputFiles(error) }), hasChangedConfigFileParsingErrors = !0) : configFileSpecs.filesSpecs || ts.some(configFileParsingDiagnostics, ts.isErrorNoInputFiles) || (configFileParsingDiagnostics = configFileParsingDiagnostics.concat(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)), hasChangedConfigFileParsingErrors = !0), rootFileNames = result.fileNames, synchronizeProgram() } function reloadConfigFile() { writeLog("Reloading config file: " + configFileName), reloadLevel = ts.ConfigFileProgramReloadLevel.None, cachedDirectoryStructureHost && cachedDirectoryStructureHost.clearCache(), parseConfigFile(), hasChangedCompilerOptions = !0, synchronizeProgram(), watchConfigFileWildCardDirectories() } function parseConfigFile() { setConfigFileParsingResult(ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost)) } function setConfigFileParsingResult(configFileParseResult) { rootFileNames = configFileParseResult.fileNames, compilerOptions = configFileParseResult.options, configFileSpecs = configFileParseResult.configFileSpecs, configFileParsingDiagnostics = ts.getConfigFileParsingDiagnostics(configFileParseResult), hasChangedConfigFileParsingErrors = !0 } function onSourceFileChange(fileName, eventKind, path) { updateCachedSystemWithFile(fileName, path, eventKind), eventKind === ts.FileWatcherEventKind.Deleted && sourceFilesCache.get(path) && resolutionCache.invalidateResolutionOfFile(path), nextSourceFileVersion(path), scheduleProgramUpdate() } function updateCachedSystemWithFile(fileName, path, eventKind) { cachedDirectoryStructureHost && cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind) } function watchMissingFilePath(missingFilePath) { return watchFilePath(host, missingFilePath, onMissingFileChange, ts.PollingInterval.Medium, missingFilePath, "Missing file") } function onMissingFileChange(fileName, eventKind, missingFilePath) { updateCachedSystemWithFile(fileName, missingFilePath, eventKind), eventKind === ts.FileWatcherEventKind.Created && missingFilesMap.has(missingFilePath) && (missingFilesMap.get(missingFilePath).close(), missingFilesMap.delete(missingFilePath), nextSourceFileVersion(missingFilePath), scheduleProgramUpdate()) } function watchConfigFileWildCardDirectories() { configFileSpecs ? ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = ts.createMap()), ts.createMapFromTemplate(configFileSpecs.wildcardDirectories), watchWildcardDirectory) : watchedWildcardDirectories && ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcherOf) } function watchWildcardDirectory(directory, flags) { return watchDirectory(host, directory, function (fileOrDirectory) { ts.Debug.assert(!!configFileName); var fileOrDirectoryPath = toPath(fileOrDirectory); return cachedDirectoryStructureHost && cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath), nextSourceFileVersion(fileOrDirectoryPath), fileOrDirectoryPath !== directory && ts.hasExtension(fileOrDirectoryPath) && !ts.isSupportedSourceFileName(fileOrDirectory, compilerOptions) ? void writeLog("Project: " + configFileName + " Detected file add/remove of non supported extension: " + fileOrDirectory) : void (reloadLevel !== ts.ConfigFileProgramReloadLevel.Full && (reloadLevel = ts.ConfigFileProgramReloadLevel.Partial, scheduleProgramUpdate())) }, flags, "Wild card directories") } function ensureDirectoriesExist(directoryPath) { if (directoryPath.length > ts.getRootLength(directoryPath) && !host.directoryExists(directoryPath)) { var parentDirectory = ts.getDirectoryPath(directoryPath); ensureDirectoriesExist(parentDirectory), host.createDirectory(directoryPath) } } function writeFile(fileName, text, writeByteOrderMark, onError) { try { ts.performance.mark("beforeIOWrite"), ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))), host.writeFile(fileName, text, writeByteOrderMark), ts.performance.mark("afterIOWrite"), ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite") } catch (e) { onError && onError(e.message) } } var builderProgram, reloadLevel, missingFilesMap, watchedWildcardDirectories, timerToUpdateProgram, missingFilePathsRequestedForRelease, configFileSpecs, configFileParsingDiagnostics, sourceFilesCache = ts.createMap(), hasChangedCompilerOptions = !1, hasChangedAutomaticTypeDirectiveNames = !1, useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(), currentDirectory = host.getCurrentDirectory(), getCurrentDirectory = function () { return currentDirectory }, readFile = function (path, encoding) { return host.readFile(path, encoding) }, configFileName = host.configFileName, _a = host.optionsToExtend, optionsToExtendForConfigFile = void 0 === _a ? {} : _a, createProgram = host.createProgram, rootFileNames = host.rootFiles, compilerOptions = host.options, hasChangedConfigFileParsingErrors = !1, cachedDirectoryStructureHost = configFileName && ts.createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames); cachedDirectoryStructureHost && host.onCachedDirectoryStructureHostCreate && host.onCachedDirectoryStructureHostCreate(cachedDirectoryStructureHost); var directoryStructureHost = cachedDirectoryStructureHost || host, parseConfigFileHost = { useCaseSensitiveFileNames: useCaseSensitiveFileNames, readDirectory: function (path, extensions, exclude, include, depth) { return directoryStructureHost.readDirectory(path, extensions, exclude, include, depth) }, fileExists: function (path) { return host.fileExists(path) }, readFile: readFile, getCurrentDirectory: getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic }, newLine = updateNewLine(); reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode), configFileName && (newLine = ts.getNewLineCharacter(optionsToExtendForConfigFile, function () { return host.getNewLine() }), host.configFileParsingResult ? setConfigFileParsingResult(host.configFileParsingResult) : (ts.Debug.assert(!rootFileNames), parseConfigFile()), newLine = updateNewLine()); var trace = host.trace && function (s) { host.trace(s + newLine) }, watchLogLevel = trace ? compilerOptions.extendedDiagnostics ? ts.WatchLogLevel.Verbose : compilerOptions.diagnostis ? ts.WatchLogLevel.TriggerOnly : ts.WatchLogLevel.None : ts.WatchLogLevel.None, writeLog = watchLogLevel !== ts.WatchLogLevel.None ? trace : ts.noop, _b = ts.getWatchFactory(watchLogLevel, writeLog), watchFile = _b.watchFile, watchFilePath = _b.watchFilePath, watchDirectory = _b.watchDirectory, getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); writeLog("Current directory: " + currentDirectory + " CaseSensitiveFileNames: " + useCaseSensitiveFileNames), configFileName && watchFile(host, configFileName, scheduleProgramReload, ts.PollingInterval.High, "Config file"); var compilerHost = { getSourceFile: function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { return getVersionedSourceFileByPath(fileName, toPath(fileName), languageVersion, onError, shouldCreateNewSourceFile) }, getSourceFileByPath: getVersionedSourceFileByPath, getDefaultLibLocation: host.getDefaultLibLocation && function () { return host.getDefaultLibLocation() }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options) }, writeFile: writeFile, getCurrentDirectory: getCurrentDirectory, useCaseSensitiveFileNames: function () { return useCaseSensitiveFileNames }, getCanonicalFileName: getCanonicalFileName, getNewLine: function () { return newLine }, fileExists: fileExists, readFile: readFile, trace: trace, directoryExists: directoryStructureHost.directoryExists && function (path) { return directoryStructureHost.directoryExists(path) }, getDirectories: directoryStructureHost.getDirectories && function (path) { return directoryStructureHost.getDirectories(path) }, realpath: host.realpath && function (s) { return host.realpath(s) }, getEnvironmentVariable: host.getEnvironmentVariable ? function (name) { return host.getEnvironmentVariable(name) } : function () { return "" }, onReleaseOldSourceFile: onReleaseOldSourceFile, createHash: host.createHash && function (data) { return host.createHash(data) }, toPath: toPath, getCompilationSettings: function () { return compilerOptions }, watchDirectoryOfFailedLookupLocation: function (dir, cb, flags) { return watchDirectory(host, dir, cb, flags, "Failed Lookup Locations") }, watchTypeRootsDirectory: function (dir, cb, flags) { return watchDirectory(host, dir, cb, flags, "Type roots") }, getCachedDirectoryStructureHost: function () { return cachedDirectoryStructureHost }, onInvalidatedResolution: scheduleProgramUpdate, onChangedAutomaticTypeDirectiveNames: function () { hasChangedAutomaticTypeDirectiveNames = !0, scheduleProgramUpdate() }, maxNumberOfFilesToIterateForInvalidation: host.maxNumberOfFilesToIterateForInvalidation, getCurrentProgram: getCurrentProgram, writeLog: writeLog }, resolutionCache = ts.createResolutionCache(compilerHost, configFileName ? ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory, !1); compilerHost.resolveModuleNames = host.resolveModuleNames ? function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames) } : function (moduleNames, containingFile, reusedNames) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames) }, compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ? function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile) } : function (typeDirectiveNames, containingFile) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile) }; var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; return synchronizeProgram(), watchConfigFileWildCardDirectories(), configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: synchronizeProgram } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: synchronizeProgram, updateRootFileNames: updateRootFileNames } } ts.createWatchCompilerHost = createWatchCompilerHost; var initialVersion = 1; ts.createWatchProgram = createWatchProgram }(ts || (ts = {})); var ts; !function (ts) { function convertEnableAutoDiscoveryToEnable(typeAcquisition) { return typeAcquisition && void 0 !== typeAcquisition.enableAutoDiscovery && void 0 === typeAcquisition.enable ? { enable: typeAcquisition.enableAutoDiscovery, include: typeAcquisition.include || [], exclude: typeAcquisition.exclude || [] } : typeAcquisition } function getOptionNameMap() { if (optionNameMapCache) return optionNameMapCache; var optionNameMap = ts.createMap(), shortOptionNames = ts.createMap(); return ts.forEach(ts.optionDeclarations, function (option) { optionNameMap.set(option.name.toLowerCase(), option), option.shortName && shortOptionNames.set(option.shortName, option.name) }), optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames } } function createCompilerDiagnosticForInvalidCustomType(opt) { return createDiagnosticForInvalidCustomType(opt, ts.createCompilerDiagnostic) } function createDiagnosticForInvalidCustomType(opt, createDiagnostic) { var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'" }).join(", "); return createDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType) } function parseCustomTypeOption(opt, value, errors) { return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors) } function parseListTypeOption(opt, value, errors) { if (void 0 === value && (value = ""), value = trimString(value), !ts.startsWith(value, "-")) { if ("" === value) return []; var values = value.split(","); switch (opt.element.type) { case "number": return ts.map(values, parseInt); case "string": return ts.map(values, function (v) { return v || "" }); default: return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors) }), function (v) { return !!v }) } } } function parseCommandLine(commandLine, readFile) { function parseStrings(args) { for (var i = 0; i < args.length;) { var s = args[i]; if (i++ , 64 === s.charCodeAt(0)) parseResponseFile(s.slice(1)); else if (45 === s.charCodeAt(0)) { var opt = getOptionFromName(s.slice(45 === s.charCodeAt(1) ? 2 : 1), !0); if (opt) if (opt.isTSConfigOnly) errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); else switch (args[i] || "boolean" === opt.type || errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)), opt.type) { case "number": options[opt.name] = parseInt(args[i]), i++; break; case "boolean": var optValue = args[i]; options[opt.name] = "false" !== optValue, "false" !== optValue && "true" !== optValue || i++; break; case "string": options[opt.name] = args[i] || "", i++; break; case "list": var result = parseListTypeOption(opt, args[i], errors); options[opt.name] = result || [], result && i++; break; default: options[opt.name] = parseCustomTypeOption(opt, args[i], errors), i++ } else errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)) } else fileNames.push(s) } } function parseResponseFile(fileName) { var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); if (!text) return void errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); for (var args = [], pos = 0; ;) { for (; pos < text.length && text.charCodeAt(pos) <= 32;)pos++; if (pos >= text.length) break; var start = pos; if (34 === text.charCodeAt(start)) { for (pos++; pos < text.length && 34 !== text.charCodeAt(pos);)pos++; pos < text.length ? (args.push(text.substring(start + 1, pos)), pos++) : errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)) } else { for (; text.charCodeAt(pos) > 32;)pos++; args.push(text.substring(start, pos)) } } parseStrings(args) } var options = {}, fileNames = [], projectReferences = void 0, errors = []; return parseStrings(commandLine), { options: options, fileNames: fileNames, projectReferences: projectReferences, errors: errors } } function getOptionFromName(optionName, allowShort) { void 0 === allowShort && (allowShort = !1), optionName = optionName.toLowerCase(); var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames; if (allowShort) { var short = shortOptionNames.get(optionName); void 0 !== short && (optionName = short) } return optionNameMap.get(optionName) } function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) { var configFileText; try { configFileText = host.readFile(configFileName) } catch (e) { var error = ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, configFileName, e.message); return void host.onUnRecoverableConfigFileDiagnostic(error) } if (!configFileText) { var error = ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, configFileName); return void host.onUnRecoverableConfigFileDiagnostic(error) } var result = ts.parseJsonText(configFileName, configFileText), cwd = host.getCurrentDirectory(); return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)) } function readConfigFile(fileName, readFile) { var textOrDiagnostic = tryReadFile(fileName, readFile); return ts.isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic } } function parseConfigFileTextToJson(fileName, jsonText) { var jsonSourceFile = ts.parseJsonText(fileName, jsonText); return { config: convertToObject(jsonSourceFile, jsonSourceFile.parseDiagnostics), error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0 } } function readJsonConfigFile(fileName, readFile) { var textOrDiagnostic = tryReadFile(fileName, readFile); return ts.isString(textOrDiagnostic) ? ts.parseJsonText(fileName, textOrDiagnostic) : { parseDiagnostics: [textOrDiagnostic] } } function tryReadFile(fileName, readFile) { var text; try { text = readFile(fileName) } catch (e) { return ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) } return void 0 === text ? ts.createCompilerDiagnostic(ts.Diagnostics.The_specified_path_does_not_exist_Colon_0, fileName) : text } function commandLineOptionsToMap(options) { return ts.arrayToMap(options, function (option) { return option.name }) } function getTsconfigRootOptionsMap() { return void 0 === _tsconfigRootOptions && (_tsconfigRootOptions = { name: void 0, type: "object", elementOptions: commandLineOptionsToMap([{ name: "compilerOptions", type: "object", elementOptions: commandLineOptionsToMap(ts.optionDeclarations), extraKeyDiagnosticMessage: ts.Diagnostics.Unknown_compiler_option_0 }, { name: "typingOptions", type: "object", elementOptions: commandLineOptionsToMap(ts.typeAcquisitionDeclarations), extraKeyDiagnosticMessage: ts.Diagnostics.Unknown_type_acquisition_option_0 }, { name: "typeAcquisition", type: "object", elementOptions: commandLineOptionsToMap(ts.typeAcquisitionDeclarations), extraKeyDiagnosticMessage: ts.Diagnostics.Unknown_type_acquisition_option_0 }, { name: "extends", type: "string" }, { name: "references", type: "list", element: { name: "references", type: "object" } }, { name: "files", type: "list", element: { name: "files", type: "string" } }, { name: "include", type: "list", element: { name: "include", type: "string" } }, { name: "exclude", type: "list", element: { name: "exclude", type: "string" } }, ts.compileOnSaveCommandLineOption]) }), _tsconfigRootOptions } function convertToObject(sourceFile, errors) { return convertToObjectWorker(sourceFile, errors, !0, void 0, void 0) } function convertToObjectWorker(sourceFile, errors, returnValue, knownRootOptions, jsonConversionNotifier) { function isRootOptionMap(knownOptions) { return knownRootOptions && knownRootOptions.elementOptions === knownOptions } function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnosticMessage, parentOption) { for (var result = returnValue ? {} : void 0, _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; if (269 === element.kind) { element.questionToken && errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")), isDoubleQuotedString(element.name) || errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.name, ts.Diagnostics.String_literal_with_double_quotes_expected)); var keyText = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(element.name)), option = knownOptions ? knownOptions.get(keyText) : void 0; extraKeyDiagnosticMessage && !option && errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnosticMessage, keyText)); var value = convertPropertyValueToJson(element.initializer, option); if ("undefined" != typeof keyText && (returnValue && (result[keyText] = value), jsonConversionNotifier && (parentOption || isRootOptionMap(knownOptions)))) { var isValidOptionValue = isCompilerOptionsValue(option, value); parentOption ? isValidOptionValue && jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value) : isRootOptionMap(knownOptions) && (isValidOptionValue ? jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer) : option || jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer)) } } else errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)) } return result } function convertArrayLiteralExpressionToJson(elements, elementOption) { return (returnValue ? elements.map : elements.forEach).call(elements, function (element) { return convertPropertyValueToJson(element, elementOption) }) } function convertPropertyValueToJson(valueExpression, option) { function reportInvalidOptionValue(isError) { isError && errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option))) } switch (valueExpression.kind) { case 101: return reportInvalidOptionValue(option && "boolean" !== option.type), !0; case 86: return reportInvalidOptionValue(option && "boolean" !== option.type), !1; case 95: return reportInvalidOptionValue(option && "extends" === option.name), null; case 9: isDoubleQuotedString(valueExpression) || errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.String_literal_with_double_quotes_expected)), reportInvalidOptionValue(option && ts.isString(option.type) && "string" !== option.type); var text = valueExpression.text; if (option && !ts.isString(option.type)) { var customOption = option; customOption.type.has(text.toLowerCase()) || errors.push(createDiagnosticForInvalidCustomType(customOption, function (message, arg0, arg1) { return ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1) })) } return text; case 8: return reportInvalidOptionValue(option && "number" !== option.type), Number(valueExpression.text); case 197: if (38 !== valueExpression.operator || 8 !== valueExpression.operand.kind) break; return reportInvalidOptionValue(option && "number" !== option.type), -Number(valueExpression.operand.text); case 183: reportInvalidOptionValue(option && "object" !== option.type); var objectLiteralExpression = valueExpression; if (option) { var _a = option, elementOptions = _a.elementOptions, extraKeyDiagnosticMessage = _a.extraKeyDiagnosticMessage, optionName = _a.name; return convertObjectLiteralExpressionToJson(objectLiteralExpression, elementOptions, extraKeyDiagnosticMessage, optionName) } return convertObjectLiteralExpressionToJson(objectLiteralExpression, void 0, void 0, void 0); case 182: return reportInvalidOptionValue(option && "list" !== option.type), convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element) }option ? reportInvalidOptionValue(!0) : errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal)) } function isDoubleQuotedString(node) { return ts.isStringLiteral(node) && ts.isStringDoubleQuoted(node, sourceFile) } return sourceFile.statements.length ? convertPropertyValueToJson(sourceFile.statements[0].expression, knownRootOptions) : returnValue ? {} : void 0 } function getCompilerOptionValueTypeString(option) { return "list" === option.type ? "Array" : ts.isString(option.type) ? option.type : "string" } function isCompilerOptionsValue(option, value) { if (option) { if (isNullOrUndefined(value)) return !0; if ("list" === option.type) return ts.isArray(value); var expectedType = ts.isString(option.type) ? option.type : "string"; return typeof value === expectedType } } function generateTSConfig(options, fileNames, newLine) { function getCustomTypeMapOfCommandLineOption(optionDefinition) { return "string" === optionDefinition.type || "number" === optionDefinition.type || "boolean" === optionDefinition.type ? void 0 : "list" === optionDefinition.type ? getCustomTypeMapOfCommandLineOption(optionDefinition.element) : optionDefinition.type } function getNameOfCompilerOptionValue(value, customTypeMap) { return ts.forEachEntry(customTypeMap, function (mapValue, key) { if (mapValue === value) return key }) } function serializeCompilerOptions(options) { var result = ts.createMap(), optionsNameMap = getOptionNameMap().optionNameMap, _loop_11 = function (name) { if (ts.hasProperty(options, name)) { if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) return "continue"; var value = options[name], optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { var customTypeMap_1 = getCustomTypeMapOfCommandLineOption(optionDefinition); customTypeMap_1 ? "list" === optionDefinition.type ? result.set(name, value.map(function (element) { return getNameOfCompilerOptionValue(element, customTypeMap_1) })) : result.set(name, getNameOfCompilerOptionValue(value, customTypeMap_1)) : result.set(name, value) } } }; for (var name in options) _loop_11(name); return result } function getDefaultValueForOption(option) { switch (option.type) { case "number": return 1; case "boolean": return !0; case "string": return option.isFilePath ? "./" : ""; case "list": return []; case "object": return {}; default: return option.type.keys().next().value } } function makePadding(paddingLength) { return Array(paddingLength + 1).join(" ") } function isAllowedOption(_a) { var category = _a.category, name = _a.name; return void 0 !== category && category !== ts.Diagnostics.Command_line_Options && (category !== ts.Diagnostics.Advanced_Options || compilerOptionsMap.has(name)) } function writeConfigurations() { for (var categorizedOptions = ts.createMultiMap(), _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i], category = option.category; isAllowedOption(option) && categorizedOptions.add(ts.getLocaleSpecificMessage(category), option) } var marginLength = 0, seenKnownKeys = 0, nameColumn = [], descriptionColumn = []; categorizedOptions.forEach(function (options, category) { 0 !== nameColumn.length && (nameColumn.push(""), descriptionColumn.push("")), nameColumn.push("/* " + category + " */"), descriptionColumn.push(""); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i], optionName = void 0; optionName = compilerOptionsMap.has(option.name) ? '"' + option.name + '": ' + JSON.stringify(compilerOptionsMap.get(option.name)) + ((seenKnownKeys += 1) === compilerOptionsMap.size ? "" : ",") : '// "' + option.name + '": ' + JSON.stringify(getDefaultValueForOption(option)) + ",", nameColumn.push(optionName), descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"), marginLength = Math.max(optionName.length, marginLength) } }); var tab = makePadding(2), result = []; result.push("{"), result.push(tab + '"compilerOptions": {'); for (var i = 0; i < nameColumn.length; i++) { var optionName = nameColumn[i], description = descriptionColumn[i]; result.push(optionName && "" + tab + tab + optionName + (description && makePadding(marginLength - optionName.length + 2) + description)) } if (fileNames.length) { result.push(tab + "},"), result.push(tab + '"files": ['); for (var i = 0; i < fileNames.length; i++)result.push("" + tab + tab + JSON.stringify(fileNames[i]) + (i === fileNames.length - 1 ? "" : ",")); result.push(tab + "]") } else result.push(tab + "}"); return result.push("}"), result.join(newLine) } var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions), compilerOptionsMap = serializeCompilerOptions(compilerOptions); return writeConfigurations() } function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { return parseJsonConfigFileContentWorker(json, void 0, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) } function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { return parseJsonConfigFileContentWorker(void 0, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) } function setConfigFileInOptions(options, configFile) { configFile && Object.defineProperty(options, "configFile", { enumerable: !1, writable: !1, value: configFile }) } function isNullOrUndefined(x) { return void 0 === x || null === x } function directoryOfCombinedPath(fileName, basePath) { return ts.getDirectoryPath(ts.getNormalizedAbsolutePath(fileName, basePath)) } function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { function getFileNames() { var filesSpecs; ts.hasProperty(raw, "files") && !isNullOrUndefined(raw.files) && (ts.isArray(raw.files) ? (filesSpecs = raw.files, 0 === filesSpecs.length && createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json")) : createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); var includeSpecs; ts.hasProperty(raw, "include") && !isNullOrUndefined(raw.include) && (ts.isArray(raw.include) ? includeSpecs = raw.include : createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array")); var excludeSpecs; if (ts.hasProperty(raw, "exclude") && !isNullOrUndefined(raw.exclude)) ts.isArray(raw.exclude) ? excludeSpecs = raw.exclude : createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array"); else if (raw.compilerOptions) { var outDir = raw.compilerOptions.outDir, declarationDir = raw.compilerOptions.declarationDir; (outDir || declarationDir) && (excludeSpecs = [outDir, declarationDir].filter(function (d) { return !!d })) } void 0 === filesSpecs && void 0 === includeSpecs && (includeSpecs = ["**/*"]); var result = matchFileNames(filesSpecs, includeSpecs, excludeSpecs, configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath, options, host, errors, extraFileExtensions, sourceFile); if (0 !== result.fileNames.length || ts.hasProperty(raw, "files") || 0 !== resolutionStack.length || ts.hasProperty(raw, "references") || errors.push(getErrorForNoInputFiles(result.spec, configFileName)), ts.hasProperty(raw, "references") && !isNullOrUndefined(raw.references)) if (ts.isArray(raw.references)) { for (var references = [], _i = 0, _a = raw.references; _i < _a.length; _i++) { var ref = _a[_i]; "string" != typeof ref.path ? createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string") : references.push({ path: ts.getNormalizedAbsolutePath(ref.path, basePath), originalPath: ref.path, prepend: ref.prepend, circular: ref.circular }) } result.projectReferences = references } else createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "references", "Array"); return result } function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) { sourceFile || errors.push(ts.createCompilerDiagnostic(message, arg0, arg1)) } void 0 === existingOptions && (existingOptions = {}), void 0 === resolutionStack && (resolutionStack = []), void 0 === extraFileExtensions && (extraFileExtensions = []), ts.Debug.assert(void 0 === json && void 0 !== sourceFile || void 0 !== json && void 0 === sourceFile); var errors = [], parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors), raw = parsedConfig.raw, options = ts.extend(existingOptions, parsedConfig.options || {}); options.configFilePath = configFileName && ts.normalizeSlashes(configFileName), setConfigFileInOptions(options, sourceFile); var _a = getFileNames(), fileNames = _a.fileNames, wildcardDirectories = _a.wildcardDirectories, spec = _a.spec, projectReferences = _a.projectReferences; return { options: options, fileNames: fileNames, projectReferences: projectReferences, typeAcquisition: parsedConfig.typeAcquisition || getDefaultTypeAcquisition(), raw: raw, errors: errors, wildcardDirectories: wildcardDirectories, compileOnSave: !!raw.compileOnSave, configFileSpecs: spec } } function isErrorNoInputFiles(error) { return error.code === ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code } function getErrorForNoInputFiles(_a, configFileName) { var includeSpecs = _a.includeSpecs, excludeSpecs = _a.excludeSpecs; return ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])) } function isSuccessfulParsedTsconfig(value) { return !!value.options } function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) { basePath = ts.normalizeSlashes(basePath); var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath); if (resolutionStack.indexOf(resolvedPath) >= 0) return errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))), { raw: json || convertToObject(sourceFile, errors) }; var ownConfig = json ? parseOwnConfigOfJson(json, host, basePath, configFileName, errors) : parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors); if (ownConfig.extendedConfigPath) { resolutionStack = resolutionStack.concat([resolvedPath]); var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors); if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) { var baseRaw_1 = extendedConfig.raw, raw_1 = ownConfig.raw, setPropertyInRawIfNotUndefined = function (propertyName) { var value = raw_1[propertyName] || baseRaw_1[propertyName]; value && (raw_1[propertyName] = value) }; setPropertyInRawIfNotUndefined("include"), setPropertyInRawIfNotUndefined("exclude"), setPropertyInRawIfNotUndefined("files"), void 0 === raw_1.compileOnSave && (raw_1.compileOnSave = baseRaw_1.compileOnSave), ownConfig.options = ts.assign({}, extendedConfig.options, ownConfig.options) } } return ownConfig } function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) { ts.hasProperty(json, "excludes") && errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); var options = convertCompilerOptionsFromJsonWorker(json.compilerOptions, basePath, errors, configFileName), typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition || json.typingOptions, basePath, errors, configFileName); json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); var extendedConfigPath; if (json.extends) if (ts.isString(json.extends)) { var newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath; extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, ts.createCompilerDiagnostic) } else errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); return { raw: json, options: options, typeAcquisition: typeAcquisition, extendedConfigPath: extendedConfigPath } } function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) { var typeAcquisition, typingOptionstypeAcquisition, extendedConfigPath, options = getDefaultCompilerOptions(configFileName), optionsIterator = { onSetValidOptionKeyValueInParent: function (parentOption, option, value) { ts.Debug.assert("compilerOptions" === parentOption || "typeAcquisition" === parentOption || "typingOptions" === parentOption); var currentOption = "compilerOptions" === parentOption ? options : "typeAcquisition" === parentOption ? typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName)) : typingOptionstypeAcquisition || (typingOptionstypeAcquisition = getDefaultTypeAcquisition(configFileName)); currentOption[option.name] = normalizeOptionValue(option, basePath, value) }, onSetValidOptionKeyValueInRoot: function (key, _keyNode, value, valueNode) { switch (key) { case "extends": var newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath; return void (extendedConfigPath = getExtendsConfigPath(value, host, newBase, errors, function (message, arg0) { return ts.createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0) })); case "files": return void (0 === value.length && errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueNode, ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json"))) } }, onSetUnknownOptionKeyValueInRoot: function (key, keyNode, _value, _valueNode) { "excludes" === key && errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, keyNode, ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)) } }, json = convertToObjectWorker(sourceFile, errors, !0, getTsconfigRootOptionsMap(), optionsIterator); return typeAcquisition || (typeAcquisition = typingOptionstypeAcquisition ? void 0 !== typingOptionstypeAcquisition.enableAutoDiscovery ? { enable: typingOptionstypeAcquisition.enableAutoDiscovery, include: typingOptionstypeAcquisition.include, exclude: typingOptionstypeAcquisition.exclude } : typingOptionstypeAcquisition : getDefaultTypeAcquisition(configFileName)), { raw: json, options: options, typeAcquisition: typeAcquisition, extendedConfigPath: extendedConfigPath } } function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) { if (extendedConfig = ts.normalizeSlashes(extendedConfig), !(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(extendedConfig, "./") || ts.startsWith(extendedConfig, "../"))) return void errors.push(createDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); var extendedConfigPath = ts.getNormalizedAbsolutePath(extendedConfig, basePath); return host.fileExists(extendedConfigPath) || ts.endsWith(extendedConfigPath, ".json") || (extendedConfigPath += ".json", host.fileExists(extendedConfigPath)) ? extendedConfigPath : void errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig)) } function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) { var _a, extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path) }); if (sourceFile && (sourceFile.extendedSourceFiles || (sourceFile.extendedSourceFiles = [])).push(extendedResult.fileName), extendedResult.parseDiagnostics.length) return void errors.push.apply(errors, extendedResult.parseDiagnostics); var extendedDirname = ts.getDirectoryPath(extendedConfigPath), extendedConfig = parseConfig(void 0, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors); if (sourceFile && (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles), isSuccessfulParsedTsconfig(extendedConfig)) { var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity), updatePath_1 = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference_1, path) }, mapPropertiesInRawIfNotUndefined = function (propertyName) { raw_2[propertyName] && (raw_2[propertyName] = ts.map(raw_2[propertyName], updatePath_1)) }, raw_2 = extendedConfig.raw; mapPropertiesInRawIfNotUndefined("include"), mapPropertiesInRawIfNotUndefined("exclude"), mapPropertiesInRawIfNotUndefined("files") } return extendedConfig } function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) { if (ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) { var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption.compileOnSave, basePath, errors); return !("boolean" != typeof result || !result) && result } } function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { var errors = [], options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors } } function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { var errors = [], options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors } } function getDefaultCompilerOptions(configFileName) { var options = configFileName && "jsconfig.json" === ts.getBaseFileName(configFileName) ? { allowJs: !0, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: !0, skipLibCheck: !0, noEmit: !0 } : {}; return options } function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = getDefaultCompilerOptions(configFileName); return convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors), configFileName && (options.configFilePath = ts.normalizeSlashes(configFileName)), options } function getDefaultTypeAcquisition(configFileName) { return { enable: configFileName && "jsconfig.json" === ts.getBaseFileName(configFileName), include: [], exclude: [] } } function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { var options = getDefaultTypeAcquisition(configFileName), typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); return convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors), options } function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { if (jsonOptions) { var optionNameMap = commandLineOptionsToMap(optionDeclarations); for (var id in jsonOptions) { var opt = optionNameMap.get(id); opt ? defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors) : errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)) } } } function convertJsonOption(opt, value, basePath, errors) { if (isCompilerOptionsValue(opt, value)) { var optType = opt.type; return "list" === optType && ts.isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : ts.isString(optType) ? normalizeNonListOptionValue(opt, basePath, value) : convertJsonOptionOfCustomType(opt, value, errors) } errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt))) } function normalizeOptionValue(option, basePath, value) { if (!isNullOrUndefined(value)) { if ("list" === option.type) { var listOption_1 = option; return listOption_1.element.isFilePath || !ts.isString(listOption_1.element.type) ? ts.filter(ts.map(value, function (v) { return normalizeOptionValue(listOption_1.element, basePath, v) }), function (v) { return !!v }) : value } return ts.isString(option.type) ? normalizeNonListOptionValue(option, basePath, value) : option.type.get(ts.isString(value) ? value.toLowerCase() : value) } } function normalizeNonListOptionValue(option, basePath, value) { return option.isFilePath && (value = ts.normalizePath(ts.combinePaths(basePath, value)), "" === value && (value = ".")), value } function convertJsonOptionOfCustomType(opt, value, errors) { if (!isNullOrUndefined(value)) { var key = value.toLowerCase(), val = opt.type.get(key); return void 0 !== val ? val : void errors.push(createCompilerDiagnosticForInvalidCustomType(opt)) } } function convertJsonOptionOfListType(option, values, basePath, errors) { return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors) }), function (v) { return !!v }) } function trimString(s) { return "function" == typeof s.trim ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, "") } function matchFileNames(filesSpecs, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions, jsonSourceFile) { basePath = ts.normalizePath(basePath); var validatedIncludeSpecs, validatedExcludeSpecs; includeSpecs && (validatedIncludeSpecs = validateSpecs(includeSpecs, errors, !1, jsonSourceFile, "include")), excludeSpecs && (validatedExcludeSpecs = validateSpecs(excludeSpecs, errors, !0, jsonSourceFile, "exclude")); var wildcardDirectories = getWildcardDirectories(validatedIncludeSpecs, validatedExcludeSpecs, basePath, host.useCaseSensitiveFileNames), spec = { filesSpecs: filesSpecs, referencesSpecs: void 0, includeSpecs: includeSpecs, excludeSpecs: excludeSpecs, validatedIncludeSpecs: validatedIncludeSpecs, validatedExcludeSpecs: validatedExcludeSpecs, wildcardDirectories: wildcardDirectories }; return getFileNamesFromConfigSpecs(spec, basePath, options, host, extraFileExtensions) } function getFileNamesFromConfigSpecs(spec, basePath, options, host, extraFileExtensions) { void 0 === extraFileExtensions && (extraFileExtensions = []), basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? ts.identity : ts.toLowerCase, literalFileMap = ts.createMap(), wildcardFileMap = ts.createMap(), filesSpecs = spec.filesSpecs, validatedIncludeSpecs = spec.validatedIncludeSpecs, validatedExcludeSpecs = spec.validatedExcludeSpecs, wildcardDirectories = spec.wildcardDirectories, supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (filesSpecs) for (var _i = 0, filesSpecs_1 = filesSpecs; _i < filesSpecs_1.length; _i++) { var fileName = filesSpecs_1[_i], file_13 = ts.getNormalizedAbsolutePath(fileName, basePath); literalFileMap.set(keyMapper(file_13), file_13) } if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, validatedExcludeSpecs, validatedIncludeSpecs, void 0); _a < _b.length; _a++) { var file_14 = _b[_a]; if (!hasFileWithHigherPriorityExtension(file_14, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) { removeWildcardFilesWithLowerPriorityExtension(file_14, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file_14); literalFileMap.has(key) || wildcardFileMap.has(key) || wildcardFileMap.set(key, file_14) } } var literalFiles = ts.arrayFrom(literalFileMap.values()), wildcardFiles = ts.arrayFrom(wildcardFileMap.values()), projectReferences = spec.referencesSpecs && spec.referencesSpecs.map(function (r) { return __assign({}, r, { path: ts.getNormalizedAbsolutePath(r.path, basePath) }) }); return { fileNames: literalFiles.concat(wildcardFiles), projectReferences: projectReferences, wildcardDirectories: wildcardDirectories, spec: spec } } function validateSpecs(specs, errors, allowTrailingRecursion, jsonSourceFile, specKey) { function createDiagnostic(message, spec) { var element = ts.getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec); return element ? ts.createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec) : ts.createCompilerDiagnostic(message, spec) } return specs.filter(function (spec) { var diag = specToDiagnostic(spec, allowTrailingRecursion); return void 0 !== diag && errors.push(createDiagnostic(diag, spec)), void 0 === diag }) } function specToDiagnostic(spec, allowTrailingRecursion) { return !allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec) ? ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 : invalidDotDotAfterRecursiveWildcardPattern.test(spec) ? ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 : void 0 } function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"), excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"), wildcardDirectories = {}; if (void 0 !== include) { for (var recursiveKeys = [], _i = 0, include_1 = include; _i < include_1.length; _i++) { var file_15 = include_1[_i], spec = ts.normalizePath(ts.combinePaths(path, file_15)); if (!excludeRegex || !excludeRegex.test(spec)) { var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); if (match) { var key = match.key, flags = match.flags, existingFlags = wildcardDirectories[key]; (void 0 === existingFlags || existingFlags < flags) && (wildcardDirectories[key] = flags, 1 === flags && recursiveKeys.push(key)) } } } for (var key in wildcardDirectories) if (ts.hasProperty(wildcardDirectories, key)) for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { var recursiveKey = recursiveKeys_1[_a]; key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames) && delete wildcardDirectories[key] } } return wildcardDirectories } function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { var match = wildcardDirectoryPattern.exec(spec); return match ? { key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(), flags: watchRecursivePattern.test(spec) ? 1 : 0 } : ts.isImplicitGlob(spec) ? { key: spec, flags: 1 } : void 0 } function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { for (var extensionPriority = ts.getExtensionPriority(file, extensions), adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions), i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i], higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) return !0 } return !1 } function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { for (var extensionPriority = ts.getExtensionPriority(file, extensions), nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions), i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i], lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); wildcardFiles.delete(lowerPriorityPath) } } function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) if (opts.hasOwnProperty(key)) { var type = getOptionFromName(key); void 0 !== type && (out[key] = getOptionValueWithEmptyStrings(opts[key], type)) } return out } function getOptionValueWithEmptyStrings(value, option) { switch (option.type) { case "object": return ""; case "string": return ""; case "number": return "number" == typeof value ? value : ""; case "boolean": return "boolean" == typeof value ? value : ""; case "list": var elementType_1 = option.element; return ts.isArray(value) ? value.map(function (v) { return getOptionValueWithEmptyStrings(v, elementType_1) }) : ""; default: return ts.forEachEntry(option.type, function (optionEnumValue, optionStringValue) { if (optionEnumValue === value) return optionStringValue }) } } ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }, ts.optionDeclarations = [{ name: "help", shortName: "h", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message }, { name: "help", shortName: "?", type: "boolean" }, { name: "all", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Show_all_compiler_options }, { name: "version", shortName: "v", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_the_compiler_s_version }, { name: "init", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file }, { name: "project", shortName: "p", type: "string", isFilePath: !0, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Command_line_Options, paramType: ts.Diagnostics.FILE_OR_DIRECTORY, description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json }, { name: "pretty", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental }, { name: "preserveWatchOutput", type: "boolean", showInSimplifiedHelpView: !1, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen }, { name: "watch", shortName: "w", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Watch_input_files }, { name: "target", shortName: "t", type: ts.createMapFromTemplate({ es3: 0, es5: 1, es6: 2, es2015: 2, es2016: 3, es2017: 4, es2018: 5, esnext: 6 }), paramType: ts.Diagnostics.VERSION, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_or_ESNEXT }, { name: "module", shortName: "m", type: ts.createMapFromTemplate({ none: ts.ModuleKind.None, commonjs: ts.ModuleKind.CommonJS, amd: ts.ModuleKind.AMD, system: ts.ModuleKind.System, umd: ts.ModuleKind.UMD, es6: ts.ModuleKind.ES2015, es2015: ts.ModuleKind.ES2015, esnext: ts.ModuleKind.ESNext }), paramType: ts.Diagnostics.KIND, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext }, { name: "lib", type: "list", element: { name: "lib", type: ts.createMapFromTemplate({ es5: "lib.es5.d.ts", es6: "lib.es2015.d.ts", es2015: "lib.es2015.d.ts", es7: "lib.es2016.d.ts", es2016: "lib.es2016.d.ts", es2017: "lib.es2017.d.ts", es2018: "lib.es2018.d.ts", esnext: "lib.esnext.d.ts", dom: "lib.dom.d.ts", "dom.iterable": "lib.dom.iterable.d.ts", webworker: "lib.webworker.d.ts", scripthost: "lib.scripthost.d.ts", "es2015.core": "lib.es2015.core.d.ts", "es2015.collection": "lib.es2015.collection.d.ts", "es2015.generator": "lib.es2015.generator.d.ts", "es2015.iterable": "lib.es2015.iterable.d.ts", "es2015.promise": "lib.es2015.promise.d.ts", "es2015.proxy": "lib.es2015.proxy.d.ts", "es2015.reflect": "lib.es2015.reflect.d.ts", "es2015.symbol": "lib.es2015.symbol.d.ts", "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", "es2016.array.include": "lib.es2016.array.include.d.ts", "es2017.object": "lib.es2017.object.d.ts", "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", "es2017.string": "lib.es2017.string.d.ts", "es2017.intl": "lib.es2017.intl.d.ts", "es2017.typedarrays": "lib.es2017.typedarrays.d.ts", "es2018.intl": "lib.es2018.intl.d.ts", "es2018.promise": "lib.es2018.promise.d.ts", "es2018.regexp": "lib.es2018.regexp.d.ts", "esnext.array": "lib.esnext.array.d.ts", "esnext.asynciterable": "lib.esnext.asynciterable.d.ts" }) }, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation }, { name: "allowJs", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Allow_javascript_files_to_be_compiled }, { name: "checkJs", type: "boolean", category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Report_errors_in_js_files }, { name: "jsx", type: ts.createMapFromTemplate({ preserve: 1, "react-native": 3, react: 2 }), paramType: ts.Diagnostics.KIND, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react }, { name: "declaration", shortName: "d", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Generates_corresponding_d_ts_file }, { name: "declarationMap", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file }, { name: "emitDeclarationOnly", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Only_emit_d_ts_declaration_files }, { name: "sourceMap", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Generates_corresponding_map_file }, { name: "outFile", type: "string", isFilePath: !0, paramType: ts.Diagnostics.FILE, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file }, { name: "outDir", type: "string", isFilePath: !0, paramType: ts.Diagnostics.DIRECTORY, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Redirect_output_structure_to_the_directory }, { name: "rootDir", type: "string", isFilePath: !0, paramType: ts.Diagnostics.LOCATION, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "composite", type: "boolean", isTSConfigOnly: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Enable_project_compilation }, { name: "removeComments", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Do_not_emit_comments_to_output }, { name: "noEmit", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Do_not_emit_outputs }, { name: "importHelpers", type: "boolean", category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Import_emit_helpers_from_tslib }, { name: "downlevelIteration", type: "boolean", category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 }, { name: "isolatedModules", type: "boolean", category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule }, { name: "strict", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Enable_all_strict_type_checking_options }, { name: "noImplicitAny", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type }, { name: "strictNullChecks", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Enable_strict_null_checks }, { name: "strictFunctionTypes", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Enable_strict_checking_of_function_types }, { name: "strictPropertyInitialization", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Enable_strict_checking_of_property_initialization_in_classes }, { name: "noImplicitThis", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type }, { name: "alwaysStrict", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file }, { name: "noUnusedLocals", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_errors_on_unused_locals }, { name: "noUnusedParameters", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_errors_on_unused_parameters }, { name: "noImplicitReturns", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value }, { name: "noFallthroughCasesInSwitch", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement }, { name: "moduleResolution", type: ts.createMapFromTemplate({ node: ts.ModuleResolutionKind.NodeJs, classic: ts.ModuleResolutionKind.Classic }), paramType: ts.Diagnostics.STRATEGY, category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "baseUrl", type: "string", isFilePath: !0, category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names }, { name: "paths", type: "object", isTSConfigOnly: !0, category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl }, { name: "rootDirs", type: "list", isTSConfigOnly: !0, element: { name: "rootDirs", type: "string", isFilePath: !0 }, category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime }, { name: "typeRoots", type: "list", element: { name: "typeRoots", type: "string", isFilePath: !0 }, category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from }, { name: "types", type: "list", element: { name: "types", type: "string" }, showInSimplifiedHelpView: !0, category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation }, { name: "allowSyntheticDefaultImports", type: "boolean", category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking }, { name: "esModuleInterop", type: "boolean", showInSimplifiedHelpView: !0, category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports }, { name: "preserveSymlinks", type: "boolean", category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks }, { name: "sourceRoot", type: "string", isFilePath: !0, paramType: ts.Diagnostics.LOCATION, category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations }, { name: "mapRoot", type: "string", isFilePath: !0, paramType: ts.Diagnostics.LOCATION, category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations }, { name: "inlineSourceMap", type: "boolean", category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file }, { name: "inlineSources", type: "boolean", category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set }, { name: "experimentalDecorators", type: "boolean", category: ts.Diagnostics.Experimental_Options, description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators }, { name: "emitDecoratorMetadata", type: "boolean", category: ts.Diagnostics.Experimental_Options, description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators }, { name: "jsxFactory", type: "string", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h }, { name: "diagnostics", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Show_diagnostic_information }, { name: "extendedDiagnostics", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Show_verbose_diagnostic_information }, { name: "traceResolution", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process }, { name: "resolveJsonModule", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Include_modules_imported_with_json_extension }, { name: "listFiles", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation }, { name: "listEmittedFiles", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation }, { name: "out", type: "string", isFilePath: !1, category: ts.Diagnostics.Advanced_Options, paramType: ts.Diagnostics.FILE, description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file }, { name: "reactNamespace", type: "string", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit }, { name: "skipDefaultLibCheck", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files }, { name: "charset", type: "string", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.The_character_set_of_the_input_files }, { name: "emitBOM", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files }, { name: "locale", type: "string", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us }, { name: "newLine", type: ts.createMapFromTemplate({ crlf: 0, lf: 1 }), paramType: ts.Diagnostics.NEWLINE, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix }, { name: "noErrorTruncation", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_truncate_error_messages }, { name: "noLib", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts }, { name: "noResolve", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files }, { name: "stripInternal", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation }, { name: "disableSizeLimit", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects }, { name: "noImplicitUseStrict", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output }, { name: "noEmitHelpers", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output }, { name: "noEmitOnError", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "preserveConstEnums", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, { name: "declarationDir", type: "string", isFilePath: !0, paramType: ts.Diagnostics.DIRECTORY, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Output_directory_for_generated_declaration_files }, { name: "skipLibCheck", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Skip_type_checking_of_declaration_files }, { name: "allowUnusedLabels", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_report_errors_on_unused_labels }, { name: "allowUnreachableCode", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code }, { name: "suppressExcessPropertyErrors", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals }, { name: "suppressImplicitAnyIndexErrors", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures }, { name: "forceConsistentCasingInFileNames", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file }, { name: "maxNodeModuleJsDepth", type: "number", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files }, { name: "noStrictGenericChecks", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types }, { name: "keyofStringsOnly", type: "boolean", category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols }, { name: "plugins", type: "list", isTSConfigOnly: !0, element: { name: "plugin", type: "object" }, description: ts.Diagnostics.List_of_language_service_plugins }], ts.typeAcquisitionDeclarations = [{ name: "enableAutoDiscovery", type: "boolean" }, { name: "enable", type: "boolean" }, { name: "include", type: "list", element: { name: "include", type: "string" } }, { name: "exclude", type: "list", element: { name: "exclude", type: "string" } }], ts.defaultInitCompilerOptions = { module: ts.ModuleKind.CommonJS, target: 1, strict: !0, esModuleInterop: !0 }; var optionNameMapCache; ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable, ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType, ts.parseCustomTypeOption = parseCustomTypeOption, ts.parseListTypeOption = parseListTypeOption, ts.parseCommandLine = parseCommandLine, ts.getOptionFromName = getOptionFromName, ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile, ts.readConfigFile = readConfigFile, ts.parseConfigFileTextToJson = parseConfigFileTextToJson, ts.readJsonConfigFile = readJsonConfigFile; var _tsconfigRootOptions; ts.convertToObject = convertToObject, ts.convertToObjectWorker = convertToObjectWorker, ts.generateTSConfig = generateTSConfig, ts.parseJsonConfigFileContent = parseJsonConfigFileContent, ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent, ts.setConfigFileInOptions = setConfigFileInOptions, ts.isErrorNoInputFiles = isErrorNoInputFiles, ts.getErrorForNoInputFiles = getErrorForNoInputFiles, ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson, ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/, invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/, watchRecursivePattern = /\/[^\/]*?[*?][^\/]*\//, wildcardDirectoryPattern = /^[^*?]*(?=\/[^\/]*[*?])/; ts.getFileNamesFromConfigSpecs = getFileNamesFromConfigSpecs, ts.convertCompilerOptionsForTelemetry = convertCompilerOptionsForTelemetry }(ts || (ts = {})); var ts; !function (ts) { var ScriptSnapshot; !function (ScriptSnapshot) { function fromString(text) { return new StringScriptSnapshot(text) } var StringScriptSnapshot = function () { function StringScriptSnapshot(text) { this.text = text } return StringScriptSnapshot.prototype.getText = function (start, end) { return 0 === start && end === this.text.length ? this.text : this.text.substring(start, end) }, StringScriptSnapshot.prototype.getLength = function () { return this.text.length }, StringScriptSnapshot.prototype.getChangeRange = function () { }, StringScriptSnapshot }(); ScriptSnapshot.fromString = fromString }(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})), ts.defaultPreferences = {}; var TextChange = function () { function TextChange() { } return TextChange }(); ts.TextChange = TextChange; var HighlightSpanKind; !function (HighlightSpanKind) { HighlightSpanKind.none = "none", HighlightSpanKind.definition = "definition", HighlightSpanKind.reference = "reference", HighlightSpanKind.writtenReference = "writtenReference" }(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); var IndentStyle; !function (IndentStyle) { IndentStyle[IndentStyle.None = 0] = "None", IndentStyle[IndentStyle.Block = 1] = "Block", IndentStyle[IndentStyle.Smart = 2] = "Smart" }(IndentStyle = ts.IndentStyle || (ts.IndentStyle = {})); var SymbolDisplayPartKind; !function (SymbolDisplayPartKind) { SymbolDisplayPartKind[SymbolDisplayPartKind.aliasName = 0] = "aliasName", SymbolDisplayPartKind[SymbolDisplayPartKind.className = 1] = "className", SymbolDisplayPartKind[SymbolDisplayPartKind.enumName = 2] = "enumName", SymbolDisplayPartKind[SymbolDisplayPartKind.fieldName = 3] = "fieldName", SymbolDisplayPartKind[SymbolDisplayPartKind.interfaceName = 4] = "interfaceName", SymbolDisplayPartKind[SymbolDisplayPartKind.keyword = 5] = "keyword", SymbolDisplayPartKind[SymbolDisplayPartKind.lineBreak = 6] = "lineBreak", SymbolDisplayPartKind[SymbolDisplayPartKind.numericLiteral = 7] = "numericLiteral", SymbolDisplayPartKind[SymbolDisplayPartKind.stringLiteral = 8] = "stringLiteral", SymbolDisplayPartKind[SymbolDisplayPartKind.localName = 9] = "localName", SymbolDisplayPartKind[SymbolDisplayPartKind.methodName = 10] = "methodName", SymbolDisplayPartKind[SymbolDisplayPartKind.moduleName = 11] = "moduleName", SymbolDisplayPartKind[SymbolDisplayPartKind.operator = 12] = "operator", SymbolDisplayPartKind[SymbolDisplayPartKind.parameterName = 13] = "parameterName", SymbolDisplayPartKind[SymbolDisplayPartKind.propertyName = 14] = "propertyName", SymbolDisplayPartKind[SymbolDisplayPartKind.punctuation = 15] = "punctuation", SymbolDisplayPartKind[SymbolDisplayPartKind.space = 16] = "space", SymbolDisplayPartKind[SymbolDisplayPartKind.text = 17] = "text", SymbolDisplayPartKind[SymbolDisplayPartKind.typeParameterName = 18] = "typeParameterName", SymbolDisplayPartKind[SymbolDisplayPartKind.enumMemberName = 19] = "enumMemberName", SymbolDisplayPartKind[SymbolDisplayPartKind.functionName = 20] = "functionName", SymbolDisplayPartKind[SymbolDisplayPartKind.regularExpressionLiteral = 21] = "regularExpressionLiteral" }(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); var OutliningSpanKind; !function (OutliningSpanKind) { OutliningSpanKind.Comment = "comment", OutliningSpanKind.Region = "region", OutliningSpanKind.Code = "code", OutliningSpanKind.Imports = "imports" }(OutliningSpanKind = ts.OutliningSpanKind || (ts.OutliningSpanKind = {})); var OutputFileType; !function (OutputFileType) { OutputFileType[OutputFileType.JavaScript = 0] = "JavaScript", OutputFileType[OutputFileType.SourceMap = 1] = "SourceMap", OutputFileType[OutputFileType.Declaration = 2] = "Declaration" }(OutputFileType = ts.OutputFileType || (ts.OutputFileType = {})); var EndOfLineState; !function (EndOfLineState) { EndOfLineState[EndOfLineState.None = 0] = "None", EndOfLineState[EndOfLineState.InMultiLineCommentTrivia = 1] = "InMultiLineCommentTrivia", EndOfLineState[EndOfLineState.InSingleQuoteStringLiteral = 2] = "InSingleQuoteStringLiteral", EndOfLineState[EndOfLineState.InDoubleQuoteStringLiteral = 3] = "InDoubleQuoteStringLiteral", EndOfLineState[EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate = 4] = "InTemplateHeadOrNoSubstitutionTemplate", EndOfLineState[EndOfLineState.InTemplateMiddleOrTail = 5] = "InTemplateMiddleOrTail", EndOfLineState[EndOfLineState.InTemplateSubstitutionPosition = 6] = "InTemplateSubstitutionPosition" }(EndOfLineState = ts.EndOfLineState || (ts.EndOfLineState = {})); var TokenClass; !function (TokenClass) { TokenClass[TokenClass.Punctuation = 0] = "Punctuation", TokenClass[TokenClass.Keyword = 1] = "Keyword", TokenClass[TokenClass.Operator = 2] = "Operator", TokenClass[TokenClass.Comment = 3] = "Comment", TokenClass[TokenClass.Whitespace = 4] = "Whitespace", TokenClass[TokenClass.Identifier = 5] = "Identifier", TokenClass[TokenClass.NumberLiteral = 6] = "NumberLiteral", TokenClass[TokenClass.StringLiteral = 7] = "StringLiteral", TokenClass[TokenClass.RegExpLiteral = 8] = "RegExpLiteral" }(TokenClass = ts.TokenClass || (ts.TokenClass = {})); var ScriptElementKind; !function (ScriptElementKind) { ScriptElementKind.unknown = "", ScriptElementKind.warning = "warning", ScriptElementKind.keyword = "keyword", ScriptElementKind.scriptElement = "script", ScriptElementKind.moduleElement = "module", ScriptElementKind.classElement = "class", ScriptElementKind.localClassElement = "local class", ScriptElementKind.interfaceElement = "interface", ScriptElementKind.typeElement = "type", ScriptElementKind.enumElement = "enum", ScriptElementKind.enumMemberElement = "enum member", ScriptElementKind.variableElement = "var", ScriptElementKind.localVariableElement = "local var", ScriptElementKind.functionElement = "function", ScriptElementKind.localFunctionElement = "local function", ScriptElementKind.memberFunctionElement = "method", ScriptElementKind.memberGetAccessorElement = "getter", ScriptElementKind.memberSetAccessorElement = "setter", ScriptElementKind.memberVariableElement = "property", ScriptElementKind.constructorImplementationElement = "constructor", ScriptElementKind.callSignatureElement = "call", ScriptElementKind.indexSignatureElement = "index", ScriptElementKind.constructSignatureElement = "construct", ScriptElementKind.parameterElement = "parameter", ScriptElementKind.typeParameterElement = "type parameter", ScriptElementKind.primitiveType = "primitive type", ScriptElementKind.label = "label", ScriptElementKind.alias = "alias", ScriptElementKind.constElement = "const", ScriptElementKind.letElement = "let", ScriptElementKind.directory = "directory", ScriptElementKind.externalModuleName = "external module name", ScriptElementKind.jsxAttribute = "JSX attribute", ScriptElementKind.string = "string" }(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); var ScriptElementKindModifier; !function (ScriptElementKindModifier) { ScriptElementKindModifier.none = "", ScriptElementKindModifier.publicMemberModifier = "public", ScriptElementKindModifier.privateMemberModifier = "private", ScriptElementKindModifier.protectedMemberModifier = "protected", ScriptElementKindModifier.exportedModifier = "export", ScriptElementKindModifier.ambientModifier = "declare", ScriptElementKindModifier.staticModifier = "static", ScriptElementKindModifier.abstractModifier = "abstract", ScriptElementKindModifier.optionalModifier = "optional" }(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {})); var ClassificationTypeNames; !function (ClassificationTypeNames) { ClassificationTypeNames.comment = "comment", ClassificationTypeNames.identifier = "identifier", ClassificationTypeNames.keyword = "keyword", ClassificationTypeNames.numericLiteral = "number", ClassificationTypeNames.operator = "operator", ClassificationTypeNames.stringLiteral = "string", ClassificationTypeNames.whiteSpace = "whitespace", ClassificationTypeNames.text = "text", ClassificationTypeNames.punctuation = "punctuation", ClassificationTypeNames.className = "class name", ClassificationTypeNames.enumName = "enum name", ClassificationTypeNames.interfaceName = "interface name", ClassificationTypeNames.moduleName = "module name", ClassificationTypeNames.typeParameterName = "type parameter name", ClassificationTypeNames.typeAliasName = "type alias name", ClassificationTypeNames.parameterName = "parameter name", ClassificationTypeNames.docCommentTagName = "doc comment tag name", ClassificationTypeNames.jsxOpenTagName = "jsx open tag name", ClassificationTypeNames.jsxCloseTagName = "jsx close tag name", ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name", ClassificationTypeNames.jsxAttribute = "jsx attribute", ClassificationTypeNames.jsxText = "jsx text", ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value" }(ClassificationTypeNames = ts.ClassificationTypeNames || (ts.ClassificationTypeNames = {})); var ClassificationType; !function (ClassificationType) { ClassificationType[ClassificationType.comment = 1] = "comment", ClassificationType[ClassificationType.identifier = 2] = "identifier", ClassificationType[ClassificationType.keyword = 3] = "keyword", ClassificationType[ClassificationType.numericLiteral = 4] = "numericLiteral", ClassificationType[ClassificationType.operator = 5] = "operator", ClassificationType[ClassificationType.stringLiteral = 6] = "stringLiteral", ClassificationType[ClassificationType.regularExpressionLiteral = 7] = "regularExpressionLiteral", ClassificationType[ClassificationType.whiteSpace = 8] = "whiteSpace", ClassificationType[ClassificationType.text = 9] = "text", ClassificationType[ClassificationType.punctuation = 10] = "punctuation", ClassificationType[ClassificationType.className = 11] = "className", ClassificationType[ClassificationType.enumName = 12] = "enumName", ClassificationType[ClassificationType.interfaceName = 13] = "interfaceName", ClassificationType[ClassificationType.moduleName = 14] = "moduleName", ClassificationType[ClassificationType.typeParameterName = 15] = "typeParameterName", ClassificationType[ClassificationType.typeAliasName = 16] = "typeAliasName", ClassificationType[ClassificationType.parameterName = 17] = "parameterName", ClassificationType[ClassificationType.docCommentTagName = 18] = "docCommentTagName", ClassificationType[ClassificationType.jsxOpenTagName = 19] = "jsxOpenTagName", ClassificationType[ClassificationType.jsxCloseTagName = 20] = "jsxCloseTagName", ClassificationType[ClassificationType.jsxSelfClosingTagName = 21] = "jsxSelfClosingTagName", ClassificationType[ClassificationType.jsxAttribute = 22] = "jsxAttribute", ClassificationType[ClassificationType.jsxText = 23] = "jsxText", ClassificationType[ClassificationType.jsxAttributeStringLiteralValue = 24] = "jsxAttributeStringLiteralValue" }(ClassificationType = ts.ClassificationType || (ts.ClassificationType = {})) }(ts || (ts = {})); var ts; !function (ts) { function getMeaningFromDeclaration(node) { switch (node.kind) { case 148: case 231: case 181: case 151: case 150: case 269: case 270: case 153: case 152: case 154: case 155: case 156: case 233: case 191: case 192: case 268: case 261: return 1; case 147: case 235: case 236: case 165: return 2; case 296: return void 0 === node.name ? 3 : 2; case 272: case 234: return 3; case 238: return ts.isAmbientModule(node) ? 5 : 1 === ts.getModuleInstanceState(node) ? 5 : 4; case 237: case 246: case 247: case 242: case 243: case 248: case 249: return 7; case 273: return 5 }return 7 } function getMeaningFromLocation(node) { return 273 === node.kind ? 1 : 248 === node.parent.kind ? 7 : isInRightSideOfInternalImportEqualsDeclaration(node) ? getMeaningFromRightHandSideOfImportEquals(node) : ts.isDeclarationName(node) ? getMeaningFromDeclaration(node.parent) : isTypeReference(node) ? 2 : isNamespaceReference(node) ? 4 : ts.isTypeParameterDeclaration(node.parent) ? (ts.Debug.assert(ts.isJSDocTemplateTag(node.parent.parent)), 2) : ts.isLiteralTypeNode(node.parent) ? 3 : 1 } function getMeaningFromRightHandSideOfImportEquals(node) { var name = 145 === node.kind ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : void 0; return name && 242 === name.parent.kind ? 7 : 4 } function isInRightSideOfInternalImportEqualsDeclaration(node) { for (; 145 === node.parent.kind;)node = node.parent; return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node) } function isQualifiedNameNamespaceReference(node) { var root = node, isLastClause = !0; if (145 === root.parent.kind) { for (; root.parent && 145 === root.parent.kind;)root = root.parent; isLastClause = root.right === node } return 161 === root.parent.kind && !isLastClause } function isPropertyAccessNamespaceReference(node) { var root = node, isLastClause = !0; if (184 === root.parent.kind) { for (; root.parent && 184 === root.parent.kind;)root = root.parent; isLastClause = root.name === node } if (!isLastClause && 206 === root.parent.kind && 267 === root.parent.parent.kind) { var decl = root.parent.parent.parent; return 234 === decl.kind && 108 === root.parent.parent.token || 235 === decl.kind && 85 === root.parent.parent.token } return !1 } function isTypeReference(node) { switch (ts.isRightSideOfQualifiedNameOrPropertyAccess(node) && (node = node.parent), node.kind) { case 99: return !ts.isExpressionNode(node); case 173: return !0 }switch (node.parent.kind) { case 161: return !0; case 178: return !node.parent.isTypeOf; case 206: return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent) }return !1 } function isCallExpressionTarget(node) { return isCallOrNewExpressionTarget(node, 186) } function isNewExpressionTarget(node) { return isCallOrNewExpressionTarget(node, 187) } function isCallOrNewExpressionTarget(node, kind) { var target = climbPastPropertyAccess(node); return target && target.parent && target.parent.kind === kind && target.parent.expression === target } function climbPastPropertyAccess(node) { return isRightSideOfPropertyAccess(node) ? node.parent : node } function getTargetLabel(referenceNode, labelName) { for (; referenceNode;) { if (227 === referenceNode.kind && referenceNode.label.escapedText === labelName) return referenceNode.label; referenceNode = referenceNode.parent } } function isJumpStatementTarget(node) { return 71 === node.kind && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node } function isLabelOfLabeledStatement(node) { return 71 === node.kind && ts.isLabeledStatement(node.parent) && node.parent.label === node } function isLabelName(node) { return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node) } function isRightSideOfQualifiedName(node) { return 145 === node.parent.kind && node.parent.right === node } function isRightSideOfPropertyAccess(node) { return node && node.parent && 184 === node.parent.kind && node.parent.name === node } function isNameOfModuleDeclaration(node) { return 238 === node.parent.kind && node.parent.name === node } function isNameOfFunctionDeclaration(node) { return 71 === node.kind && ts.isFunctionLike(node.parent) && node.parent.name === node } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { case 151: case 150: case 269: case 272: case 153: case 152: case 155: case 156: case 238: return ts.getNameOfDeclaration(node.parent) === node; case 185: return node.parent.argumentExpression === node; case 146: return !0; case 177: return 175 === node.parent.parent.kind } } function isExpressionOfExternalModuleImportEqualsDeclaration(node) { return ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node } function getContainerNode(node) { for (ts.isJSDocTypeAlias(node) && (node = node.parent.parent); ;) { if (node = node.parent, !node) return; switch (node.kind) { case 273: case 153: case 152: case 233: case 191: case 155: case 156: case 234: case 235: case 237: case 238: return node } } } function getNodeKind(node) { function getKindOfVariableDeclaration(v) { return ts.isConst(v) ? "const" : ts.isLet(v) ? "let" : "var" } switch (node.kind) { case 273: return ts.isExternalModule(node) ? "module" : "script"; case 238: return "module"; case 234: case 204: return "class"; case 235: return "interface"; case 236: case 291: case 296: return "type"; case 237: return "enum"; case 231: return getKindOfVariableDeclaration(node); case 181: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); case 192: case 233: case 191: return "function"; case 155: return "getter"; case 156: return "setter"; case 153: case 152: return "method"; case 151: case 150: return "property"; case 159: return "index"; case 158: return "construct"; case 157: return "call"; case 154: return "constructor"; case 147: return "type parameter"; case 272: return "enum member"; case 148: return ts.hasModifier(node, 92) ? "property" : "parameter"; case 242: case 247: case 244: case 251: case 245: return "alias"; case 199: var kind = ts.getSpecialPropertyAssignmentKind(node), right = node.right; switch (kind) { case 0: return ""; case 1: case 2: var rightKind = getNodeKind(right); return "" === rightKind ? "const" : rightKind; case 3: return ts.isFunctionExpression(right) ? "method" : "property"; case 4: return "property"; case 5: return ts.isFunctionExpression(right) ? "method" : "property"; case 6: return "local class"; default: return ts.assertTypeIsNever(kind), "" }default: return "" } } function isThis(node) { switch (node.kind) { case 99: return !0; case 71: return ts.identifierIsThisKeyword(node) && 148 === node.parent.kind; default: return !1 } } function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = ts.getLineStarts(sourceFile), line = sourceFile.getLineAndCharacterOfPosition(position).line; return lineStarts[line] } function rangeContainsRange(r1, r2) { return startEndContainsRange(r1.pos, r1.end, r2) } function rangeContainsPosition(r, pos) { return r.pos <= pos && pos <= r.end } function startEndContainsRange(start, end, range) { return start <= range.pos && end >= range.end } function rangeContainsStartEnd(range, start, end) { return range.pos <= start && range.end >= end } function rangeOverlapsWithStartEnd(r1, start, end) { return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end) } function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { var start = Math.max(start1, start2), end = Math.min(end1, end2); return start < end } function positionBelongsToNode(candidate, position, sourceFile) { return ts.Debug.assert(candidate.pos <= position), position < candidate.end || !isCompletedNode(candidate, sourceFile) } function isCompletedNode(n, sourceFile) { if (ts.nodeIsMissing(n)) return !1; switch (n.kind) { case 234: case 235: case 237: case 183: case 179: case 165: case 212: case 239: case 240: case 246: case 250: return nodeEndsWith(n, 18, sourceFile); case 268: return isCompletedNode(n.block, sourceFile); case 187: if (!n.arguments) return !0; case 186: case 190: case 172: return nodeEndsWith(n, 20, sourceFile); case 162: case 163: return isCompletedNode(n.type, sourceFile); case 154: case 155: case 156: case 233: case 191: case 153: case 152: case 158: case 157: case 192: return n.body ? isCompletedNode(n.body, sourceFile) : n.type ? isCompletedNode(n.type, sourceFile) : hasChildOfKind(n, 20, sourceFile); case 238: return n.body && isCompletedNode(n.body, sourceFile); case 216: return n.elseStatement ? isCompletedNode(n.elseStatement, sourceFile) : isCompletedNode(n.thenStatement, sourceFile); case 215: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 25, sourceFile); case 182: case 180: case 185: case 146: case 167: return nodeEndsWith(n, 22, sourceFile); case 159: return n.type ? isCompletedNode(n.type, sourceFile) : hasChildOfKind(n, 22, sourceFile); case 265: case 266: return !1; case 219: case 220: case 221: case 218: return isCompletedNode(n.statement, sourceFile); case 217: return hasChildOfKind(n, 106, sourceFile) ? nodeEndsWith(n, 20, sourceFile) : isCompletedNode(n.statement, sourceFile); case 164: return isCompletedNode(n.exprName, sourceFile); case 194: case 193: case 195: case 202: case 203: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); case 188: return isCompletedNode(n.template, sourceFile); case 201: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); case 210: return ts.nodeIsPresent(n.literal); case 249: case 243: return ts.nodeIsPresent(n.moduleSpecifier); case 197: return isCompletedNode(n.operand, sourceFile); case 199: return isCompletedNode(n.right, sourceFile); case 200: return isCompletedNode(n.whenFalse, sourceFile); default: return !0 } } function nodeEndsWith(n, expectedLastToken, sourceFile) { var children = n.getChildren(sourceFile); if (children.length) { var last_2 = ts.lastOrUndefined(children); if (last_2.kind === expectedLastToken) return !0; if (25 === last_2.kind && 1 !== children.length) return children[children.length - 2].kind === expectedLastToken } return !1 } function findListItemInfo(node) { var list = findContainingList(node); if (list) { var children = list.getChildren(), listItemIndex = ts.indexOfNode(children, node); return { listItemIndex: listItemIndex, list: list } } } function hasChildOfKind(n, kind, sourceFile) { return !!findChildOfKind(n, kind, sourceFile) } function findChildOfKind(n, kind, sourceFile) { return ts.find(n.getChildren(sourceFile), function (c) { return c.kind === kind }) } function findContainingList(node) { var syntaxList = ts.find(node.parent.getChildren(), function (c) { return ts.isSyntaxList(c) && rangeContainsRange(c, node) }); return ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node)), syntaxList } function getTouchingPropertyName(sourceFile, position, includeJsDocComment) { return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return ts.isPropertyNameLiteral(n) || ts.isKeyword(n.kind) }) } function getTouchingToken(sourceFile, position, includeJsDocComment, includePrecedingTokenAtEndPosition) { return getTokenAtPositionWorker(sourceFile, position, !1, includePrecedingTokenAtEndPosition, !1, includeJsDocComment) } function getTokenAtPosition(sourceFile, position, includeJsDocComment, includeEndPosition) { return getTokenAtPositionWorker(sourceFile, position, !0, void 0, includeEndPosition, includeJsDocComment) } function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includePrecedingTokenAtEndPosition, includeEndPosition, includeJsDocComment) { var current = sourceFile; outer: for (; ;) { if (ts.isToken(current)) return current; for (var _i = 0, _a = current.getChildren(); _i < _a.length; _i++) { var child = _a[_i]; if (includeJsDocComment || !ts.isJSDocNode(child)) { var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment); if (start > position) break; var end = child.getEnd(); if (position < end || position === end && (1 === child.kind || includeEndPosition)) { current = child; continue outer } if (includePrecedingTokenAtEndPosition && end === position) { var previousToken = findPrecedingToken(position, sourceFile, child); if (previousToken && includePrecedingTokenAtEndPosition(previousToken)) return previousToken } } } return current } } function findTokenOnLeftOfPosition(file, position) { var tokenAtPosition = getTokenAtPosition(file, position, !1); return ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd() ? tokenAtPosition : findPrecedingToken(position, file) } function findNextToken(previousToken, parent, sourceFile) { function find(n) { if (ts.isToken(n) && n.pos === previousToken.end) return n; for (var children = n.getChildren(), _i = 0, children_3 = children; _i < children_3.length; _i++) { var child = children_3[_i], shouldDiveInChildNode = child.pos <= previousToken.pos && child.end > previousToken.end || child.pos === previousToken.end; if (shouldDiveInChildNode && nodeHasTokens(child, sourceFile)) return find(child) } } return find(parent) } function findPrecedingToken(position, sourceFile, startNode, includeJsDoc) { function find(n) { if (isNonWhitespaceToken(n)) return n; for (var children = n.getChildren(sourceFile), i = 0; i < children.length; i++) { var child = children[i]; if (position < child.end) { var start = child.getStart(sourceFile, includeJsDoc), lookInPreviousChild = start >= position || !nodeHasTokens(child, sourceFile) || isWhiteSpaceOnlyJsxText(child); if (lookInPreviousChild) { var candidate = findRightmostChildNodeWithTokens(children, i, sourceFile); return candidate && findRightmostToken(candidate, sourceFile) } return find(child) } } if (ts.Debug.assert(void 0 !== startNode || 273 === n.kind || ts.isJSDocCommentContainingNode(n)), children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length, sourceFile); return candidate && findRightmostToken(candidate, sourceFile) } } var result = find(startNode || sourceFile); return ts.Debug.assert(!(result && isWhiteSpaceOnlyJsxText(result))), result } function isNonWhitespaceToken(n) { return ts.isToken(n) && !isWhiteSpaceOnlyJsxText(n) } function findRightmostToken(n, sourceFile) { if (isNonWhitespaceToken(n)) return n; var children = n.getChildren(sourceFile), candidate = findRightmostChildNodeWithTokens(children, children.length, sourceFile); return candidate && findRightmostToken(candidate, sourceFile) } function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile) { for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) ts.Debug.assert(i > 0, "`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); else if (nodeHasTokens(children[i], sourceFile)) return children[i] } } function isInString(sourceFile, position, previousToken) { if (void 0 === previousToken && (previousToken = findPrecedingToken(position, sourceFile)), previousToken && ts.isStringTextContainingNode(previousToken)) { var start = previousToken.getStart(), end = previousToken.getEnd(); if (start < position && position < end) return !0; if (position === end) return !!previousToken.isUnterminated } return !1 } function isInsideJsxElementOrAttribute(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position, !1); return !!token && (10 === token.kind || (27 === token.kind && 10 === token.parent.kind || (27 === token.kind && 264 === token.parent.kind || (!(!token || 18 !== token.kind || 264 !== token.parent.kind) || 27 === token.kind && 257 === token.parent.kind)))) } function isWhiteSpaceOnlyJsxText(node) { return ts.isJsxText(node) && node.containsOnlyWhiteSpaces } function isInTemplateString(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position, !1); return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile) } function findPrecedingMatchingToken(token, matchingTokenKind, sourceFile) { for (var tokenKind = token.kind, remainingMatchingTokens = 0; ;) { if (token = findPrecedingToken(token.getFullStart(), sourceFile), !token) return; if (token.kind === matchingTokenKind) { if (0 === remainingMatchingTokens) return token; remainingMatchingTokens-- } else token.kind === tokenKind && remainingMatchingTokens++ } } function isPossiblyTypeArgumentPosition(token, sourceFile) { for (var remainingLessThanTokens = 0; token;) { switch (token.kind) { case 27: token = findPrecedingToken(token.getFullStart(), sourceFile); var tokenIsIdentifier = token && ts.isIdentifier(token); if (!remainingLessThanTokens || !tokenIsIdentifier) return tokenIsIdentifier; remainingLessThanTokens--; break; case 47: remainingLessThanTokens = 3; break; case 46: remainingLessThanTokens = 2; break; case 29: remainingLessThanTokens++; break; case 18: if (token = findPrecedingMatchingToken(token, 17, sourceFile), !token) return !1; break; case 20: if (token = findPrecedingMatchingToken(token, 19, sourceFile), !token) return !1; break; case 22: if (token = findPrecedingMatchingToken(token, 21, sourceFile), !token) return !1; break; case 26: case 36: case 71: case 9: case 8: case 101: case 86: case 103: case 85: case 128: case 23: case 49: case 55: case 56: break; default: if (ts.isTypeNode(token)) break; return !1 }token = findPrecedingToken(token.getFullStart(), sourceFile) } return !1 } function isInComment(sourceFile, position, tokenAtPosition, predicate) { return !!ts.formatting.getRangeOfEnclosingComment(sourceFile, position, !1, void 0, tokenAtPosition, predicate) } function hasDocComment(sourceFile, position) { function jsDocPrefix(c) { var text = sourceFile.text; return text.length >= c.pos + 3 && "/" === text[c.pos] && "*" === text[c.pos + 1] && "*" === text[c.pos + 2] } var token = getTokenAtPosition(sourceFile, position, !1), commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); return ts.forEach(commentRanges, jsDocPrefix) } function nodeHasTokens(n, sourceFile) { return 0 !== n.getWidth(sourceFile) } function getNodeModifiers(node) { var flags = ts.getCombinedModifierFlags(node), result = []; return 8 & flags && result.push("private"), 16 & flags && result.push("protected"), 4 & flags && result.push("public"), 32 & flags && result.push("static"), 128 & flags && result.push("abstract"), 1 & flags && result.push("export"), 4194304 & node.flags && result.push("declare"), result.length > 0 ? result.join(",") : "" } function getTypeArgumentOrTypeParameterList(node) { return 161 === node.kind || 186 === node.kind ? node.typeArguments : ts.isFunctionLike(node) || 234 === node.kind || 235 === node.kind ? node.typeParameters : void 0 } function isComment(kind) { return 2 === kind || 3 === kind } function isStringOrRegularExpressionOrTemplateLiteral(kind) { return !(9 !== kind && 12 !== kind && !ts.isTemplateLiteralKind(kind)) } function isPunctuation(kind) { return 17 <= kind && kind <= 70 } function isInsideTemplateLiteral(node, position) { return ts.isTemplateLiteralKind(node.kind) && node.getStart() < position && position < node.getEnd() || !!node.isUnterminated && position === node.getEnd() } function isAccessibilityModifier(kind) { switch (kind) { case 114: case 112: case 113: return !0 }return !1 } function cloneCompilerOptions(options) { var result = ts.clone(options); return ts.setConfigFileInOptions(result, options && options.configFile), result } function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { if (182 === node.kind || 183 === node.kind) { if (199 === node.parent.kind && node.parent.left === node && 58 === node.parent.operatorToken.kind) return !0; if (221 === node.parent.kind && node.parent.initializer === node) return !0; if (isArrayLiteralOrObjectLiteralDestructuringPattern(269 === node.parent.kind ? node.parent.parent : node.parent)) return !0 } return !1 } function isInReferenceComment(sourceFile, position) { return isInComment(sourceFile, position, void 0, function (c) { var commentText = sourceFile.text.substring(c.pos, c.end); return tripleSlashDirectivePrefixRegex.test(commentText) }) } function isInNonReferenceComment(sourceFile, position) { return isInComment(sourceFile, position, void 0, function (c) { var commentText = sourceFile.text.substring(c.pos, c.end); return !tripleSlashDirectivePrefixRegex.test(commentText) }) } function createTextSpanFromNode(node, sourceFile) { return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()) } function createTextSpanFromRange(range) { return ts.createTextSpanFromBounds(range.pos, range.end) } function createTextRangeFromSpan(span) { return ts.createTextRange(span.start, span.start + span.length) } function createTextChangeFromStartLength(start, length, newText) { return createTextChange(ts.createTextSpan(start, length), newText) } function createTextChange(span, newText) { return { span: span, newText: newText } } function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind) } function isExternalModuleSymbol(moduleSymbol) { return ts.Debug.assert(!!(1536 & moduleSymbol.flags)), 34 === moduleSymbol.name.charCodeAt(0) } function nodeSeenTracker() { var seen = []; return function (node) { var id = ts.getNodeId(node); return !seen[id] && (seen[id] = !0) } } function getSnapshotText(snap) { return snap.getText(0, snap.getLength()) } function repeatString(str, count) { for (var result = "", i = 0; i < count; i++)result += str; return result } function skipConstraint(type) { return type.isTypeParameter() ? type.getConstraint() : type } function getNameFromPropertyName(name) { return 146 === name.kind ? ts.isStringOrNumericLiteral(name.expression) ? name.expression.text : void 0 : ts.getTextOfIdentifierOrLiteral(name) } function programContainsEs6Modules(program) { return program.getSourceFiles().some(function (s) { return !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator }) } function compilerOptionsIndicateEs6Modules(compilerOptions) { return !!compilerOptions.module || compilerOptions.target >= 2 || !!compilerOptions.noEmit } function hostUsesCaseSensitiveFileNames(host) { return !!host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames() } function hostGetCanonicalFileName(host) { return ts.createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host)) } function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) { return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0 } function makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) { return ts.createImportDeclaration(void 0, void 0, defaultImport || namedImports ? ts.createImportClause(defaultImport, namedImports && namedImports.length ? ts.createNamedImports(namedImports) : void 0) : void 0, "string" == typeof moduleSpecifier ? makeStringLiteral(moduleSpecifier, quotePreference) : moduleSpecifier) } function makeStringLiteral(text, quotePreference) { return ts.createLiteral(text, 0 === quotePreference) } function getQuotePreference(sourceFile, preferences) { if (preferences.quotePreference) return "single" === preferences.quotePreference ? 0 : 1; var firstModuleSpecifier = ts.firstOrUndefined(sourceFile.imports); return firstModuleSpecifier && !ts.isStringDoubleQuoted(firstModuleSpecifier, sourceFile) ? 0 : 1 } function symbolNameNoDefault(symbol) { var escaped = symbolEscapedNameNoDefault(symbol); return void 0 === escaped ? void 0 : ts.unescapeLeadingUnderscores(escaped) } function symbolEscapedNameNoDefault(symbol) { return "default" !== symbol.escapedName ? symbol.escapedName : ts.firstDefined(symbol.declarations, function (decl) { var name = ts.getNameOfDeclaration(decl); return name && 71 === name.kind ? name.escapedText : void 0 }) } function getPropertySymbolFromBindingElement(checker, bindingElement) { var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent), propSymbol = typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); return propSymbol && 98304 & propSymbol.flags ? (ts.Debug.assert(!!(33554432 & propSymbol.flags)), propSymbol.target) : propSymbol } ts.scanner = ts.createScanner(6, !0); var SemanticMeaning; !function (SemanticMeaning) { SemanticMeaning[SemanticMeaning.None = 0] = "None", SemanticMeaning[SemanticMeaning.Value = 1] = "Value", SemanticMeaning[SemanticMeaning.Type = 2] = "Type", SemanticMeaning[SemanticMeaning.Namespace = 4] = "Namespace", SemanticMeaning[SemanticMeaning.All = 7] = "All" }(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})), ts.getMeaningFromDeclaration = getMeaningFromDeclaration, ts.getMeaningFromLocation = getMeaningFromLocation, ts.isInRightSideOfInternalImportEqualsDeclaration = isInRightSideOfInternalImportEqualsDeclaration, ts.isCallExpressionTarget = isCallExpressionTarget, ts.isNewExpressionTarget = isNewExpressionTarget, ts.climbPastPropertyAccess = climbPastPropertyAccess, ts.getTargetLabel = getTargetLabel, ts.isJumpStatementTarget = isJumpStatementTarget, ts.isLabelOfLabeledStatement = isLabelOfLabeledStatement, ts.isLabelName = isLabelName, ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName, ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess, ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration, ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration, ts.isLiteralNameOfPropertyDeclarationOrIndexAccess = isLiteralNameOfPropertyDeclarationOrIndexAccess, ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration, ts.getContainerNode = getContainerNode, ts.getNodeKind = getNodeKind, ts.isThis = isThis; var tripleSlashDirectivePrefixRegex = /^\/\/\/\s* 0 && 148 === symbol.declarations[0].kind } function getDisplayPartWriter() { function writeIndent() { if (lineStart) { var indentString = ts.getIndentString(indent); indentString && displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space)), lineStart = !1 } } function writeKind(text, kind) { writeIndent(), displayParts.push(displayPart(text, kind)) } function writeSymbol(text, symbol) { writeIndent(), displayParts.push(symbolPart(text, symbol)) } function writeLine() { displayParts.push(lineBreakPart()), lineStart = !0 } function resetWriter() { displayParts = [], lineStart = !0, indent = 0 } var displayParts, lineStart, indent; resetWriter(); var unknownWrite = function (text) { return writeKind(text, ts.SymbolDisplayPartKind.text) }; return { displayParts: function () { return displayParts }, writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword) }, writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator) }, writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation) }, writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space) }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral) }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName) }, writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName) }, writeLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral) }, writeSymbol: writeSymbol, writeLine: writeLine, write: unknownWrite, writeTextOfNode: unknownWrite, getText: function () { return "" }, getTextPos: function () { return 0 }, getColumn: function () { return 0 }, getLine: function () { return 0 }, isAtStartOfLine: function () { return !1 }, rawWrite: ts.notImplemented, getIndent: function () { return indent }, increaseIndent: function () { indent++ }, decreaseIndent: function () { indent-- }, clear: resetWriter, trackSymbol: ts.noop, reportInaccessibleThisError: ts.noop, reportInaccessibleUniqueSymbolError: ts.noop, reportPrivateInBaseOfClassExpression: ts.noop } } function symbolPart(text, symbol) { function displayPartKind(symbol) { var flags = symbol.flags; return 3 & flags ? isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName : 4 & flags ? ts.SymbolDisplayPartKind.propertyName : 32768 & flags ? ts.SymbolDisplayPartKind.propertyName : 65536 & flags ? ts.SymbolDisplayPartKind.propertyName : 8 & flags ? ts.SymbolDisplayPartKind.enumMemberName : 16 & flags ? ts.SymbolDisplayPartKind.functionName : 32 & flags ? ts.SymbolDisplayPartKind.className : 64 & flags ? ts.SymbolDisplayPartKind.interfaceName : 384 & flags ? ts.SymbolDisplayPartKind.enumName : 1536 & flags ? ts.SymbolDisplayPartKind.moduleName : 8192 & flags ? ts.SymbolDisplayPartKind.methodName : 262144 & flags ? ts.SymbolDisplayPartKind.typeParameterName : 524288 & flags ? ts.SymbolDisplayPartKind.aliasName : 2097152 & flags ? ts.SymbolDisplayPartKind.aliasName : ts.SymbolDisplayPartKind.text } return displayPart(text, displayPartKind(symbol)) } function displayPart(text, kind) { return { text: text, kind: ts.SymbolDisplayPartKind[kind] } } function spacePart() { return displayPart(" ", ts.SymbolDisplayPartKind.space) } function keywordPart(kind) { return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword) } function punctuationPart(kind) { return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation) } function operatorPart(kind) { return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator) } function textOrKeywordPart(text) { var kind = ts.stringToToken(text); return void 0 === kind ? textPart(text) : keywordPart(kind) } function textPart(text) { return displayPart(text, ts.SymbolDisplayPartKind.text) } function getNewLineOrDefaultFromHost(host, formatSettings) { return formatSettings && formatSettings.newLineCharacter || host.getNewLine && host.getNewLine() || carriageReturnLineFeed } function lineBreakPart() { return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak) } function mapToDisplayParts(writeDisplayParts) { try { return writeDisplayParts(displayPartWriter), displayPartWriter.displayParts() } finally { displayPartWriter.clear() } } function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { return mapToDisplayParts(function (writer) { typechecker.writeType(type, enclosingDeclaration, 1024 | flags | 16384, writer) }) } function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { return mapToDisplayParts(function (writer) { typeChecker.writeSymbol(symbol, enclosingDeclaration, meaning, 8 | flags, writer) }) } function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { return flags |= 25632, mapToDisplayParts(function (writer) { typechecker.writeSignature(signature, enclosingDeclaration, flags, void 0, writer) }) } function isImportOrExportSpecifierName(location) { return location.parent && (247 === location.parent.kind || 251 === location.parent.kind) && location.parent.propertyName === location } function stripQuotes(name) { var length = name.length; return length >= 2 && name.charCodeAt(0) === name.charCodeAt(length - 1) && startsWithQuote(name) ? name.substring(1, length - 1) : name } function startsWithQuote(name) { return ts.isSingleOrDoubleQuote(name.charCodeAt(0)) } function scriptKindIs(fileName, host) { for (var scriptKinds = [], _i = 2; _i < arguments.length; _i++)scriptKinds[_i - 2] = arguments[_i]; var scriptKind = getScriptKind(fileName, host); return ts.forEach(scriptKinds, function (k) { return k === scriptKind }) } function getScriptKind(fileName, host) { return ts.ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName)) } function getUniqueSymbolId(symbol, checker) { return ts.getSymbolId(ts.skipAlias(symbol, checker)) } function getFirstNonSpaceCharacterPosition(text, position) { for (; ts.isWhiteSpaceLike(text.charCodeAt(position));)position += 1; return position } function getSynthesizedDeepClone(node, includeTrivia) { void 0 === includeTrivia && (includeTrivia = !0); var clone = node && getSynthesizedDeepCloneWorker(node); return clone && !includeTrivia && suppressLeadingAndTrailingTrivia(clone), clone } function getSynthesizedDeepCloneWorker(node) { var visited = ts.visitEachChild(node, getSynthesizedDeepClone, ts.nullTransformationContext); if (visited === node) { var clone_7 = ts.getSynthesizedClone(node); return ts.isStringLiteral(clone_7) ? clone_7.textSourceNode = node : ts.isNumericLiteral(clone_7) && (clone_7.numericLiteralFlags = node.numericLiteralFlags), ts.setTextRange(clone_7, node) } return visited.parent = void 0, visited } function getSynthesizedDeepClones(nodes, includeTrivia) { return void 0 === includeTrivia && (includeTrivia = !0), nodes && ts.createNodeArray(nodes.map(function (n) { return getSynthesizedDeepClone(n, includeTrivia) }), nodes.hasTrailingComma) } function suppressLeadingAndTrailingTrivia(node) { suppressLeadingTrivia(node), suppressTrailingTrivia(node) } function suppressLeadingTrivia(node) { addEmitFlagsRecursively(node, 512, getFirstChild) } function suppressTrailingTrivia(node) { addEmitFlagsRecursively(node, 1024, ts.getLastChild) } function addEmitFlagsRecursively(node, flag, getChild) { ts.addEmitFlags(node, flag); var child = getChild(node); child && addEmitFlagsRecursively(child, flag, getChild) } function getFirstChild(node) { return node.forEachChild(function (child) { return child }) } function getUniqueName(baseName, sourceFile) { for (var nameText = baseName, i = 1; !ts.isFileLevelUniqueName(sourceFile, nameText); i++)nameText = baseName + "_" + i; return nameText } function getRenameLocation(edits, renameFilename, name, preferLastLocation) { for (var delta = 0, lastPos = -1, _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { var _a = edits_1[_i], fileName = _a.fileName, textChanges_2 = _a.textChanges; ts.Debug.assert(fileName === renameFilename); for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) { var change = textChanges_1[_b], span = change.span, newText = change.newText, index = indexInTextChange(newText, name); if (index !== -1 && (lastPos = span.start + delta + index, !preferLastLocation)) return lastPos; delta += newText.length - span.length } } return ts.Debug.assert(preferLastLocation), ts.Debug.assert(lastPos >= 0), lastPos } function indexInTextChange(change, name) { if (ts.startsWith(change, name)) return 0; var idx = change.indexOf(" " + name); return idx === -1 && (idx = change.indexOf("." + name)), idx === -1 && (idx = change.indexOf('"' + name)), idx === -1 ? -1 : idx + 1 } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); ts.symbolPart = symbolPart, ts.displayPart = displayPart, ts.spacePart = spacePart, ts.keywordPart = keywordPart, ts.punctuationPart = punctuationPart, ts.operatorPart = operatorPart, ts.textOrKeywordPart = textOrKeywordPart, ts.textPart = textPart; var carriageReturnLineFeed = "\r\n"; ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost, ts.lineBreakPart = lineBreakPart, ts.mapToDisplayParts = mapToDisplayParts, ts.typeToDisplayParts = typeToDisplayParts, ts.symbolToDisplayParts = symbolToDisplayParts, ts.signatureToDisplayParts = signatureToDisplayParts, ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName, ts.stripQuotes = stripQuotes, ts.startsWithQuote = startsWithQuote, ts.scriptKindIs = scriptKindIs, ts.getScriptKind = getScriptKind, ts.getUniqueSymbolId = getUniqueSymbolId, ts.getFirstNonSpaceCharacterPosition = getFirstNonSpaceCharacterPosition, ts.getSynthesizedDeepClone = getSynthesizedDeepClone, ts.getSynthesizedDeepClones = getSynthesizedDeepClones, ts.suppressLeadingAndTrailingTrivia = suppressLeadingAndTrailingTrivia, ts.suppressLeadingTrivia = suppressLeadingTrivia, ts.suppressTrailingTrivia = suppressTrailingTrivia, ts.getUniqueName = getUniqueName, ts.getRenameLocation = getRenameLocation }(ts || (ts = {})); var ts; !function (ts) { function createClassifier() { function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text) } function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { function handleToken() { switch (token) { case 41: case 63: noRegexTable[lastNonTriviaToken] || 12 !== scanner.reScanSlashToken() || (token = 12); break; case 27: 71 === lastNonTriviaToken && angleBracketStack++; break; case 29: angleBracketStack > 0 && angleBracketStack--; break; case 119: case 137: case 134: case 122: case 138: angleBracketStack > 0 && !syntacticClassifierAbsent && (token = 71); break; case 14: templateStack.push(token); break; case 17: templateStack.length > 0 && templateStack.push(token); break; case 18: if (templateStack.length > 0) { var lastTemplateStackToken = ts.lastOrUndefined(templateStack); 14 === lastTemplateStackToken ? (token = scanner.reScanTemplateToken(), 16 === token ? templateStack.pop() : ts.Debug.assertEqual(token, 15, "Should have been a template middle.")) : (ts.Debug.assertEqual(lastTemplateStackToken, 17, "Should have been an open brace"), templateStack.pop()) } break; default: if (!ts.isKeyword(token)) break; 23 === lastNonTriviaToken ? token = 71 : ts.isKeyword(lastNonTriviaToken) && ts.isKeyword(token) && !canFollow(lastNonTriviaToken, token) && (token = 71) } } var token = 0, lastNonTriviaToken = 0, templateStack = [], _a = getPrefixFromLexState(lexState), prefix = _a.prefix, pushTemplate = _a.pushTemplate; text = prefix + text; var offset = prefix.length; pushTemplate && templateStack.push(14), scanner.setText(text); var endOfLineState = 0, spans = [], angleBracketStack = 0; do { token = scanner.scan(), ts.isTrivia(token) || (handleToken(), lastNonTriviaToken = token); var end = scanner.getTextPos(); if (pushEncodedClassification(scanner.getTokenPos(), end, offset, classFromKind(token), spans), end >= text.length) { var end_1 = getNewEndOfLineState(scanner, token, ts.lastOrUndefined(templateStack)); void 0 !== end_1 && (endOfLineState = end_1) } } while (1 !== token); return { endOfLineState: endOfLineState, spans: spans } } var scanner = ts.createScanner(6, !1); return { getClassificationsForLine: getClassificationsForLine, getEncodedLexicalClassifications: getEncodedLexicalClassifications } } function getNewEndOfLineState(scanner, token, lastOnTemplateStack) { switch (token) { case 9: if (!scanner.isUnterminated()) return; for (var tokenText = scanner.getTokenText(), lastCharIndex = tokenText.length - 1, numBackslashes = 0; 92 === tokenText.charCodeAt(lastCharIndex - numBackslashes);)numBackslashes++; if (0 === (1 & numBackslashes)) return; return 34 === tokenText.charCodeAt(0) ? 3 : 2; case 3: return scanner.isUnterminated() ? 1 : void 0; default: if (ts.isTemplateLiteralKind(token)) { if (!scanner.isUnterminated()) return; switch (token) { case 16: return 5; case 13: return 4; default: return ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token) } } return 14 === lastOnTemplateStack ? 6 : void 0 } } function pushEncodedClassification(start, end, offset, classification, result) { if (8 !== classification) { 0 === start && offset > 0 && (start += offset); var length = end - start; length > 0 && result.push(start - offset, length, classification) } } function convertClassificationsToResult(classifications, text) { for (var entries = [], dense = classifications.spans, lastEnd = 0, i = 0; i < dense.length; i += 3) { var start = dense[i], length_5 = dense[i + 1], type = dense[i + 2]; if (lastEnd >= 0) { var whitespaceLength_1 = start - lastEnd; whitespaceLength_1 > 0 && entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace }) } entries.push({ length: length_5, classification: convertClassification(type) }), lastEnd = start + length_5 } var whitespaceLength = text.length - lastEnd; return whitespaceLength > 0 && entries.push({ length: whitespaceLength, classification: ts.TokenClass.Whitespace }), { entries: entries, finalLexState: classifications.endOfLineState } } function convertClassification(type) { switch (type) { case 1: return ts.TokenClass.Comment; case 3: return ts.TokenClass.Keyword; case 4: return ts.TokenClass.NumberLiteral; case 5: return ts.TokenClass.Operator; case 6: return ts.TokenClass.StringLiteral; case 8: return ts.TokenClass.Whitespace; case 10: return ts.TokenClass.Punctuation; case 2: case 11: case 12: case 13: case 14: case 15: case 16: case 9: case 17: return ts.TokenClass.Identifier } } function canFollow(keyword1, keyword2) { if (!ts.isAccessibilityModifier(keyword1)) return !0; switch (keyword2) { case 125: case 136: case 123: case 115: return !0; default: return !1 } } function getPrefixFromLexState(lexState) { switch (lexState) { case 3: return { prefix: '"\\\n' }; case 2: return { prefix: "'\\\n" }; case 1: return { prefix: "/*\n" }; case 4: return { prefix: "`\n" }; case 5: return { prefix: "}\n", pushTemplate: !0 }; case 6: return { prefix: "", pushTemplate: !0 }; case 0: return { prefix: "" }; default: return ts.Debug.assertNever(lexState) } } function isBinaryExpressionOperatorToken(token) { switch (token) { case 39: case 41: case 42: case 37: case 38: case 45: case 46: case 47: case 27: case 29: case 30: case 31: case 93: case 92: case 118: case 32: case 33: case 34: case 35: case 48: case 50: case 49: case 53: case 54: case 69: case 68: case 70: case 65: case 66: case 67: case 59: case 60: case 61: case 63: case 64: case 58: case 26: return !0; default: return !1 } } function isPrefixUnaryExpressionOperatorToken(token) { switch (token) { case 37: case 38: case 52: case 51: case 43: case 44: return !0; default: return !1 } } function classFromKind(token) { if (ts.isKeyword(token)) return 3; if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) return 5; if (token >= 17 && token <= 70) return 10; switch (token) { case 8: return 4; case 9: return 6; case 12: return 7; case 7: case 3: case 2: return 1; case 5: case 4: return 8; case 71: default: return ts.isTemplateLiteralKind(token) ? 6 : 2 } } function getSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) { return convertClassificationsToSpans(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span)) } function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { case 238: case 234: case 235: case 233: cancellationToken.throwIfCancellationRequested() } } function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) { function pushClassification(start, end, type) { spans.push(start), spans.push(end - start), spans.push(type) } var spans = []; return sourceFile.forEachChild(function cb(node) { if (node && ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { if (checkForClassificationCancellation(cancellationToken, node.kind), ts.isIdentifier(node) && !ts.nodeIsMissing(node) && classifiableNames.has(node.escapedText)) { var symbol = typeChecker.getSymbolAtLocation(node), type = symbol && classifySymbol(symbol, ts.getMeaningFromLocation(node), typeChecker); type && pushClassification(node.getStart(sourceFile), node.getEnd(), type) } node.forEachChild(cb) } }), { spans: spans, endOfLineState: 0 } } function classifySymbol(symbol, meaningAtPosition, checker) { var flags = symbol.getFlags(); return 0 === (2885600 & flags) ? void 0 : 32 & flags ? 11 : 384 & flags ? 12 : 524288 & flags ? 16 : 1536 & flags ? 4 & meaningAtPosition || 1 & meaningAtPosition && hasValueSideModule(symbol) ? 14 : void 0 : 2097152 & flags ? classifySymbol(checker.getAliasedSymbol(symbol), meaningAtPosition, checker) : 2 & meaningAtPosition ? 64 & flags ? 13 : 262144 & flags ? 15 : void 0 : void 0 } function hasValueSideModule(symbol) { return ts.some(symbol.declarations, function (declaration) { return ts.isModuleDeclaration(declaration) && 1 === ts.getModuleInstanceState(declaration) }) } function getClassificationTypeName(type) { switch (type) { case 1: return "comment"; case 2: return "identifier"; case 3: return "keyword"; case 4: return "number"; case 5: return "operator"; case 6: return "string"; case 8: return "whitespace"; case 9: return "text"; case 10: return "punctuation"; case 11: return "class name"; case 12: return "enum name"; case 13: return "interface name"; case 14: return "module name"; case 15: return "type parameter name"; case 16: return "type alias name"; case 17: return "parameter name"; case 18: return "doc comment tag name"; case 19: return "jsx open tag name"; case 20: return "jsx close tag name"; case 21: return "jsx self closing tag name"; case 22: return "jsx attribute"; case 23: return "jsx text"; case 24: return "jsx attribute string literal value" } } function convertClassificationsToSpans(classifications) { ts.Debug.assert(classifications.spans.length % 3 === 0); for (var dense = classifications.spans, result = [], i = 0; i < dense.length; i += 3)result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) }); return result } function getSyntacticClassifications(cancellationToken, sourceFile, span) { return convertClassificationsToSpans(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)) } function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span) { function pushClassification(start, length, type) { result.push(start), result.push(length), result.push(type) } function classifyLeadingTriviaAndGetTokenStart(token) { for (triviaScanner.setTextPos(token.pos); ;) { var start = triviaScanner.getTextPos(); if (!ts.couldStartTrivia(sourceFile.text, start)) return start; var kind = triviaScanner.scan(), end = triviaScanner.getTextPos(), width = end - start; if (!ts.isTrivia(kind)) return start; switch (kind) { case 4: case 5: continue; case 2: case 3: classifyComment(token, kind, start, width), triviaScanner.setTextPos(end); continue; case 7: var text = sourceFile.text, ch = text.charCodeAt(start); if (60 === ch || 62 === ch) { pushClassification(start, width, 1); continue } ts.Debug.assert(124 === ch || 61 === ch), classifyDisabledMergeCode(text, start, end); break; case 6: break; default: ts.Debug.assertNever(kind) } } } function classifyComment(token, kind, start, width) { if (3 === kind) { var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width); if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) return docCommentAndDiagnostics.jsDoc.parent = token, void classifyJSDocComment(docCommentAndDiagnostics.jsDoc) } pushCommentRange(start, width) } function pushCommentRange(start, width) { pushClassification(start, width, 1) } function classifyJSDocComment(docComment) { function processJSDocParameterTag(tag) { tag.isNameFirst && (pushCommentRange(pos, tag.name.pos - pos), pushClassification(tag.name.pos, tag.name.end - tag.name.pos, 17), pos = tag.name.end), tag.typeExpression && (pushCommentRange(pos, tag.typeExpression.pos - pos), processElement(tag.typeExpression), pos = tag.typeExpression.end), tag.isNameFirst || (pushCommentRange(pos, tag.name.pos - pos), pushClassification(tag.name.pos, tag.name.end - tag.name.pos, 17), pos = tag.name.end) } var pos = docComment.pos; if (docComment.tags) for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) { var tag = _a[_i]; switch (tag.pos !== pos && pushCommentRange(pos, tag.pos - pos), pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10), pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18), pos = tag.tagName.end, tag.kind) { case 292: processJSDocParameterTag(tag); break; case 295: processJSDocTemplateTag(tag), pos = tag.end; break; case 294: processElement(tag.typeExpression), pos = tag.end; break; case 293: processElement(tag.typeExpression), pos = tag.end } } pos !== docComment.end && pushCommentRange(pos, docComment.end - pos) } function processJSDocTemplateTag(tag) { for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) { var child = _a[_i]; processElement(child) } } function classifyDisabledMergeCode(text, start, end) { var i; for (i = start; i < end && !ts.isLineBreak(text.charCodeAt(i)); i++); for (pushClassification(start, i - start, 1), mergeConflictScanner.setTextPos(i); mergeConflictScanner.getTextPos() < end;)classifyDisabledCodeToken() } function classifyDisabledCodeToken() { var start = mergeConflictScanner.getTextPos(), tokenKind = mergeConflictScanner.scan(), end = mergeConflictScanner.getTextPos(), type = classifyTokenType(tokenKind); type && pushClassification(start, end - start, type) } function tryClassifyNode(node) { if (ts.isJSDoc(node)) return !0; if (ts.nodeIsMissing(node)) return !0; var classifiedElementName = tryClassifyJsxElementName(node); if (!ts.isToken(node) && 10 !== node.kind && void 0 === classifiedElementName) return !1; var tokenStart = 10 === node.kind ? node.pos : classifyLeadingTriviaAndGetTokenStart(node), tokenWidth = node.end - tokenStart; if (ts.Debug.assert(tokenWidth >= 0), tokenWidth > 0) { var type = classifiedElementName || classifyTokenType(node.kind, node); type && pushClassification(tokenStart, tokenWidth, type) } return !0 } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { case 256: if (token.parent.tagName === token) return 19; break; case 257: if (token.parent.tagName === token) return 20; break; case 255: if (token.parent.tagName === token) return 21; break; case 261: if (token.parent.name === token) return 22 } } function classifyTokenType(tokenKind, token) { if (ts.isKeyword(tokenKind)) return 3; if ((27 === tokenKind || 29 === tokenKind) && token && ts.getTypeArgumentOrTypeParameterList(token.parent)) return 10; if (ts.isPunctuation(tokenKind)) { if (token) { if (58 === tokenKind && (231 === token.parent.kind || 151 === token.parent.kind || 148 === token.parent.kind || 261 === token.parent.kind)) return 5; if (199 === token.parent.kind || 197 === token.parent.kind || 198 === token.parent.kind || 200 === token.parent.kind) return 5 } return 10 } if (8 === tokenKind) return 4; if (9 === tokenKind) return 261 === token.parent.kind ? 24 : 6; if (12 === tokenKind) return 6; if (ts.isTemplateLiteralKind(tokenKind)) return 6; if (10 === tokenKind) return 23; if (71 === tokenKind) { if (token) switch (token.parent.kind) { case 234: if (token.parent.name === token) return 11; return; case 147: if (token.parent.name === token) return 15; return; case 235: if (token.parent.name === token) return 13; return; case 237: if (token.parent.name === token) return 12; return; case 238: if (token.parent.name === token) return 14; return; case 148: if (token.parent.name === token) return ts.isThisIdentifier(token) ? 3 : 17; return }return 2 } } function processElement(element) { if (element && ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { var child = _a[_i]; tryClassifyNode(child) || processElement(child) } } } var spanStart = span.start, spanLength = span.length, triviaScanner = ts.createScanner(6, !1, sourceFile.languageVariant, sourceFile.text), mergeConflictScanner = ts.createScanner(6, !1, sourceFile.languageVariant, sourceFile.text), result = []; return processElement(sourceFile), { spans: result, endOfLineState: 0 } } ts.createClassifier = createClassifier; var noRegexTable = ts.arrayToNumericMap([71, 9, 8, 12, 99, 43, 44, 20, 22, 18, 101, 86], function (token) { return token }, function () { return !0 }); ts.getSemanticClassifications = getSemanticClassifications, ts.getEncodedSemanticClassifications = getEncodedSemanticClassifications, ts.getSyntacticClassifications = getSyntacticClassifications, ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications }(ts || (ts = {})); var ts; !function (ts) { var Completions; !function (Completions) { var PathCompletions; !function (PathCompletions) { function nameAndKind(name, kind) { return { name: name, kind: kind } } function addReplacementSpans(text, textStart, names) { var span = getDirectoryFragmentTextSpan(text, textStart); return names.map(function (_a) { var name = _a.name, kind = _a.kind; return { name: name, kind: kind, span: span } }) } function getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) { return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(node, compilerOptions, host, typeChecker)) } function getStringLiteralCompletionsFromModuleNamesWorker(node, compilerOptions, host, typeChecker) { var literalValue = ts.normalizeSlashes(node.text), scriptPath = node.getSourceFile().path, scriptDirectory = ts.getDirectoryPath(scriptPath); if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { var extensions = getSupportedExtensionsForModuleResolution(compilerOptions); return compilerOptions.rootDirs ? getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, !1, compilerOptions, host, scriptPath) : getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, !1, host, scriptPath) } return getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, compilerOptions, host, typeChecker) } function getSupportedExtensionsForModuleResolution(compilerOptions) { var extensions = ts.getSupportedExtensions(compilerOptions); return compilerOptions.resolveJsonModule && ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ? extensions.concat(".json") : extensions } function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { rootDirs = rootDirs.map(function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)) }); var relativeDirectory = ts.firstDefined(rootDirs, function (rootDirectory) { return ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase) ? scriptPath.substr(rootDirectory.length) : void 0 }); return ts.deduplicate(rootDirs.map(function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory) }), ts.equateStringsCaseSensitive, ts.compareStringsCaseSensitive) } function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, compilerOptions, host, exclude) { for (var basePath = compilerOptions.project || host.getCurrentDirectory(), ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()), baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase), result = [], _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { var baseDirectory = baseDirectories_1[_i]; getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, host, exclude, result) } return result } function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, host, exclude, result) { void 0 === result && (result = []), void 0 === fragment && (fragment = ""), fragment = ts.normalizeSlashes(fragment), ts.hasTrailingDirectorySeparator(fragment) || (fragment = ts.getDirectoryPath(fragment)), "" === fragment && (fragment = "." + ts.directorySeparator), fragment = ts.ensureTrailingDirectorySeparator(fragment); var absolutePath = ts.resolvePath(scriptPath, fragment), baseDirectory = ts.hasTrailingDirectorySeparator(absolutePath) ? absolutePath : ts.getDirectoryPath(absolutePath), ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); if (tryDirectoryExists(host, baseDirectory)) { var files = tryReadDirectory(host, baseDirectory, extensions, void 0, ["./*"]); if (files) { for (var foundFiles = ts.createMap(), _i = 0, files_3 = files; _i < files_3.length; _i++) { var filePath = files_3[_i]; if (filePath = ts.normalizePath(filePath), !exclude || 0 !== ts.comparePaths(filePath, exclude, scriptPath, ignoreCase)) { var foundFileName = includeExtensions || ts.fileExtensionIs(filePath, ".json") ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); foundFiles.has(foundFileName) || foundFiles.set(foundFileName, !0) } } ts.forEachKey(foundFiles, function (foundFile) { result.push(nameAndKind(foundFile, "script")) }) } var directories = tryGetDirectories(host, baseDirectory); if (directories) for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) { var directory_2 = directories_1[_a], directoryName = ts.getBaseFileName(ts.normalizePath(directory_2)); "@types" !== directoryName && result.push(nameAndKind(directoryName, "directory")) } } return result } function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, compilerOptions, host, typeChecker) { var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, result = [], fileExtensions = getSupportedExtensionsForModuleResolution(compilerOptions); if (baseUrl) { var projectDir = compilerOptions.project || host.getCurrentDirectory(), absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, !1, host, void 0, result); for (var path in paths) { var patterns = paths[path]; if (paths.hasOwnProperty(path) && patterns) for (var _loop_12 = function (name, kind) { result.some(function (entry) { return entry.name === name }) || result.push(nameAndKind(name, kind)) }, _i = 0, _a = getCompletionsForPathMapping(path, patterns, fragment, baseUrl, fileExtensions, host); _i < _a.length; _i++) { var _b = _a[_i], name = _b.name, kind = _b.kind; _loop_12(name, kind) } } } for (var fragmentDirectory = containsSlash(fragment) ? ts.hasTrailingDirectorySeparator(fragment) ? fragment : ts.getDirectoryPath(fragment) : void 0, _c = 0, _d = getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker); _c < _d.length; _c++) { var ambientName = _d[_c]; result.push(nameAndKind(ambientName, "external module name")) } if (getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, result), ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs) { var foundGlobal = !1; if (void 0 === fragmentDirectory) for (var _loop_13 = function (moduleName) { result.some(function (entry) { return entry.name === moduleName }) || (foundGlobal = !0, result.push(nameAndKind(moduleName, "external module name"))) }, _e = 0, _f = enumerateNodeModulesVisibleToScript(host, scriptPath); _e < _f.length; _e++) { var moduleName = _f[_e]; _loop_13(moduleName) } foundGlobal || ts.forEachAncestorDirectory(scriptPath, function (ancestor) { var nodeModules = ts.combinePaths(ancestor, "node_modules"); tryDirectoryExists(host, nodeModules) && getCompletionEntriesForDirectoryFragment(fragment, nodeModules, fileExtensions, !1, host, void 0, result) }) } return result } function getCompletionsForPathMapping(path, patterns, fragment, baseUrl, fileExtensions, host) { if (!ts.endsWith(path, "*")) return !ts.stringContains(path, "*") && ts.startsWith(path, fragment) ? [{ name: path, kind: "directory" }] : ts.emptyArray; var pathPrefix = path.slice(0, path.length - 1); if (!ts.startsWith(fragment, pathPrefix)) return [{ name: pathPrefix, kind: "directory" }]; var remainingFragment = fragment.slice(pathPrefix.length); return ts.flatMap(patterns, function (pattern) { return getModulesForPathsPattern(remainingFragment, baseUrl, pattern, fileExtensions, host) }) } function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { if (host.readDirectory) { var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : void 0; if (parsed) { var normalizedPrefix = ts.resolvePath(parsed.prefix), normalizedPrefixDirectory = ts.hasTrailingDirectorySeparator(parsed.prefix) ? normalizedPrefix : ts.getDirectoryPath(normalizedPrefix), normalizedPrefixBase = ts.hasTrailingDirectorySeparator(parsed.prefix) ? "" : ts.getBaseFileName(normalizedPrefix), fragmentHasPath = containsSlash(fragment), fragmentDirectory = fragmentHasPath ? ts.hasTrailingDirectorySeparator(fragment) ? fragment : ts.getDirectoryPath(fragment) : void 0, expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + fragmentDirectory) : normalizedPrefixDirectory, normalizedSuffix = ts.normalizePath(parsed.suffix), baseDirectory = ts.normalizePath(ts.combinePaths(baseUrl, expandedPrefixDirectory)), completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase, includeGlob = normalizedSuffix ? "**/*" : "./*", matches = tryReadDirectory(host, baseDirectory, fileExtensions, void 0, [includeGlob]).map(function (name) { return { name: name, kind: "script" } }), directories = tryGetDirectories(host, baseDirectory).map(function (d) { return ts.combinePaths(baseDirectory, d) }).map(function (name) { return { name: name, kind: "directory" } }); return ts.mapDefined(ts.concatenate(matches, directories), function (_a) { var name = _a.name, kind = _a.kind, normalizedMatch = ts.normalizePath(name), inner = withoutStartAndEnd(normalizedMatch, completePrefix, normalizedSuffix); return void 0 !== inner ? { name: removeLeadingDirectorySeparator(ts.removeFileExtension(inner)), kind: kind } : void 0 }) } } } function withoutStartAndEnd(s, start, end) { return ts.startsWith(s, start) && ts.endsWith(s, end) ? s.slice(start.length, s.length - end.length) : void 0 } function removeLeadingDirectorySeparator(path) { return path[0] === ts.directorySeparator ? path.slice(1) : path } function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) { var ambientModules = checker.getAmbientModules().map(function (sym) { return ts.stripQuotes(sym.name) }), nonRelativeModuleNames = ambientModules.filter(function (moduleName) { return ts.startsWith(moduleName, fragment) }); if (void 0 !== fragmentDirectory) { var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(fragmentDirectory); return nonRelativeModuleNames.map(function (nonRelativeModuleName) { return ts.removePrefix(nonRelativeModuleName, moduleNameWithSeperator_1) }) } return nonRelativeModuleNames } function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { var token = ts.getTokenAtPosition(sourceFile, position, !1), commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos), range = commentRanges && ts.find(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end }); if (range) { var text = sourceFile.text.slice(range.pos, position), match = tripleSlashDirectiveFragmentRegex.exec(text); if (match) { var prefix = match[1], kind = match[2], toComplete = match[3], scriptPath = ts.getDirectoryPath(sourceFile.path), names = "path" === kind ? getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), !0, host, sourceFile.path) : "types" === kind ? getCompletionEntriesFromTypings(host, compilerOptions, scriptPath) : void 0; return names && addReplacementSpans(toComplete, range.pos + prefix.length, names) } } } function getCompletionEntriesFromTypings(host, options, scriptPath, result) { function getCompletionEntriesFromDirectories(directory) { if (ts.Debug.assert(!!host.getDirectories), tryDirectoryExists(host, directory)) { var directories = tryGetDirectories(host, directory); if (directories) for (var _i = 0, directories_2 = directories; _i < directories_2.length; _i++) { var typeDirectory = directories_2[_i]; typeDirectory = ts.normalizePath(typeDirectory); var directoryName = ts.getBaseFileName(typeDirectory), moduleName = ts.getUnmangledNameForScopedPackage(directoryName); pushResult(moduleName) } } } function pushResult(moduleName) { seen.has(moduleName) || (result.push(nameAndKind(moduleName, "external module name")), seen.set(moduleName, !0)) } void 0 === result && (result = []); var seen = ts.createMap(); if (options.types) for (var _i = 0, _a = options.types; _i < _a.length; _i++) { var typesName = _a[_i], moduleName = ts.getUnmangledNameForScopedPackage(typesName); pushResult(moduleName) } else if (host.getDirectories) { var typeRoots = void 0; try { typeRoots = ts.getEffectiveTypeRoots(options, host) } catch (_b) { } if (typeRoots) for (var _c = 0, typeRoots_2 = typeRoots; _c < typeRoots_2.length; _c++) { var root = typeRoots_2[_c]; getCompletionEntriesFromDirectories(root) } for (var _d = 0, _e = findPackageJsons(scriptPath, host); _d < _e.length; _d++) { var packageJson = _e[_d], typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); getCompletionEntriesFromDirectories(typesDir) } } return result } function findPackageJsons(directory, host) { var paths = []; return ts.forEachAncestorDirectory(directory, function (ancestor) { var currentConfigPath = ts.findConfigFile(ancestor, function (f) { return tryFileExists(host, f) }, "package.json"); return !currentConfigPath || void paths.push(currentConfigPath) }), paths } function enumerateNodeModulesVisibleToScript(host, scriptPath) { if (!host.readFile || !host.fileExists) return ts.emptyArray; for (var result = [], _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++)for (var packageJson = _a[_i], contents = ts.readJson(packageJson, host), _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { var key = nodeModulesDependencyKeys_1[_b], dependencies = contents[key]; if (dependencies) for (var dep in dependencies) dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/") && result.push(dep) } return result } function getDirectoryFragmentTextSpan(text, textStart) { var index = Math.max(text.lastIndexOf(ts.directorySeparator), text.lastIndexOf("\\")), offset = index !== -1 ? index + 1 : 0, length = text.length - offset; return 0 === length || ts.isIdentifierText(text.substr(offset, length), 6) ? void 0 : ts.createTextSpan(textStart + offset, length) } function isPathRelativeToScript(path) { if (path && path.length >= 2 && 46 === path.charCodeAt(0)) { var slashIndex = path.length >= 3 && 46 === path.charCodeAt(1) ? 2 : 1, slashCharCode = path.charCodeAt(slashIndex); return 47 === slashCharCode || 92 === slashCharCode } return !1 } function tryGetDirectories(host, directoryName) { return tryIOAndConsumeErrors(host, host.getDirectories, directoryName) || [] } function tryReadDirectory(host, path, extensions, exclude, include) { return tryIOAndConsumeErrors(host, host.readDirectory, path, extensions, exclude, include) || ts.emptyArray } function tryFileExists(host, path) { return tryIOAndConsumeErrors(host, host.fileExists, path) } function tryDirectoryExists(host, path) { try { return ts.directoryProbablyExists(path, host) } catch (_a) { } } function tryIOAndConsumeErrors(host, toApply) { for (var args = [], _i = 2; _i < arguments.length; _i++)args[_i - 2] = arguments[_i]; try { return toApply && toApply.apply(host, args) } catch (_a) { } } function containsSlash(fragment) { return ts.stringContains(fragment, ts.directorySeparator) } PathCompletions.getStringLiteralCompletionsFromModuleNames = getStringLiteralCompletionsFromModuleNames, PathCompletions.getTripleSlashReferenceCompletion = getTripleSlashReferenceCompletion; var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s* candidate.parameters.length)) { var type = checker.getParameterType(candidate, argumentInfo.argumentIndex); return isNewIdentifier = isNewIdentifier || !!(2 & type.flags), getStringLiteralTypes(type, checker, uniques) } }); return { kind: 2, types: types, isNewIdentifier: isNewIdentifier } } function stringLiteralCompletionsFromProperties(type) { return type && { kind: 1, symbols: type.getApparentProperties(), hasIndexSignature: hasIndexSignature(type) } } function getStringLiteralTypes(type, typeChecker, uniques) { return void 0 === uniques && (uniques = ts.createMap()), type ? (type = ts.skipConstraint(type), type.isUnion() ? ts.flatMap(type.types, function (t) { return getStringLiteralTypes(t, typeChecker, uniques) }) : !type.isStringLiteral() || 256 & type.flags || !ts.addToSeen(uniques, type.value) ? ts.emptyArray : [type]) : ts.emptyArray } function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId) { var completionData = getCompletionData(program, log, sourceFile, position, { includeCompletionsForModuleExports: !0, includeCompletionsWithInsertText: !0 }, entryId); if (!completionData) return { type: "none" }; if (0 !== completionData.kind) return { type: "request", request: completionData }; var symbols = completionData.symbols, location = completionData.location, completionKind = completionData.completionKind, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, previousToken = completionData.previousToken, isJsxInitializer = completionData.isJsxInitializer; return ts.firstDefined(symbols, function (symbol) { var origin = symbolToOriginInfoMap[ts.getSymbolId(symbol)], info = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, origin, completionKind); return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap, previousToken: previousToken, isJsxInitializer: isJsxInitializer } : void 0 }) || { type: "none" } } function getSymbolName(symbol, origin, target) { return origin && "export" === origin.type && origin.isDefaultExport && "default" === symbol.escapedName ? ts.firstDefined(symbol.declarations, function (d) { return ts.isExportAssignment(d) && ts.isIdentifier(d.expression) ? d.expression.text : void 0 }) || ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name } function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, getCanonicalFileName, preferences, cancellationToken) { var typeChecker = program.getTypeChecker(), compilerOptions = program.getCompilerOptions(), name = entryId.name, contextToken = ts.findPrecedingToken(position, sourceFile); if (ts.isInString(sourceFile, position, contextToken)) { var stringLiteralCompletions = contextToken && ts.isStringLiteralLike(contextToken) ? getStringLiteralCompletionEntries(sourceFile, contextToken, position, typeChecker, compilerOptions, host) : void 0; return stringLiteralCompletions && stringLiteralCompletionDetails(name, contextToken, stringLiteralCompletions, sourceFile, typeChecker, cancellationToken) } var symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); switch (symbolCompletion.type) { case "request": var request = symbolCompletion.request; switch (request.kind) { case 1: return ts.JsDoc.getJSDocTagNameCompletionDetails(name); case 2: return ts.JsDoc.getJSDocTagCompletionDetails(name); case 3: return ts.JsDoc.getJSDocParameterNameCompletionDetails(name); default: return ts.Debug.assertNever(request) }case "symbol": var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap, previousToken = symbolCompletion.previousToken, _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, typeChecker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, program.getSourceFiles(), preferences), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); case "none": return allKeywordsCompletions().some(function (c) { return c.name === name }) ? createCompletionDetails(name, "", "keyword", [ts.displayPart(name, ts.SymbolDisplayPartKind.keyword)]) : void 0 } } function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) { var _a = checker.runWithCancellationToken(cancellationToken, function (checker) { return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, sourceFile, location, location, 7) }), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; return createCompletionDetails(symbol.name, ts.SymbolDisplay.getSymbolModifiers(symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay) } function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) { switch (completion.kind) { case 0: var match = ts.find(completion.paths, function (p) { return p.name === name }); return match && createCompletionDetails(name, "", match.kind, [ts.textPart(name)]); case 1: var match = ts.find(completion.symbols, function (s) { return s.name === name }); return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken); case 2: return ts.find(completion.types, function (t) { return t.value === name }) ? createCompletionDetails(name, "", "type", [ts.textPart(name)]) : void 0; default: return ts.Debug.assertNever(completion) } } function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) { return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source } } function getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, program, checker, host, compilerOptions, sourceFile, previousToken, formatContext, getCanonicalFileName, allSourceFiles, preferences) { var symbolOriginInfo = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; if (!symbolOriginInfo || "export" !== symbolOriginInfo.type) return { codeActions: void 0, sourceDisplay: void 0 }; var moduleSymbol = symbolOriginInfo.moduleSymbol, exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)), _a = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), host, program, checker, compilerOptions, allSourceFiles, formatContext, getCanonicalFileName, previousToken, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] } } function getCompletionEntrySymbol(program, log, sourceFile, position, entryId) { var completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); return "symbol" === completion.type ? completion.symbol : void 0 } function getRecommendedCompletion(currentToken, position, sourceFile, checker) { var ty = getContextualType(currentToken, position, sourceFile, checker), symbol = ty && ty.symbol; return symbol && (384 & symbol.flags || 32 & symbol.flags && !ts.isAbstractConstructorSymbol(symbol)) ? getFirstSymbolInChain(symbol, currentToken, checker) : void 0 } function getContextualType(currentToken, position, sourceFile, checker) { var parent = currentToken.parent; switch (currentToken.kind) { case 71: return getContextualTypeFromParent(currentToken, checker); case 58: switch (parent.kind) { case 231: return checker.getContextualType(parent.initializer); case 199: return checker.getTypeAtLocation(parent.left); case 261: return checker.getContextualTypeForJsxAttribute(parent); default: return }case 94: return checker.getContextualType(parent); case 73: return getSwitchedType(ts.cast(parent, ts.isCaseClause), checker); case 17: return ts.isJsxExpression(parent) && 254 !== parent.parent.kind ? checker.getContextualTypeForJsxAttribute(parent.parent) : void 0; default: var argInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(currentToken, position, sourceFile); return argInfo ? checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (26 === currentToken.kind ? 1 : 0)) : isEqualityOperatorKind(currentToken.kind) && ts.isBinaryExpression(parent) && isEqualityOperatorKind(parent.operatorToken.kind) ? checker.getTypeAtLocation(parent.left) : checker.getContextualType(currentToken) } } function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { case 187: return checker.getContextualType(parent); case 199: var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); case 265: return parent.expression === node ? getSwitchedType(parent, checker) : void 0; default: return checker.getContextualType(node) } } function getSwitchedType(caseClause, checker) { return checker.getTypeAtLocation(caseClause.parent.parent.expression) } function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, 67108863, !1); return chain ? ts.first(chain) : symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)) } function isModuleSymbol(symbol) { return symbol.declarations.some(function (d) { return 273 === d.kind }) } function getCompletionData(program, log, sourceFile, position, preferences, detailsEntryId) { function isTagWithTypeExpression(tag) { switch (tag.kind) { case 292: case 297: case 293: case 294: case 296: return !0 } } function getTypeScriptMemberSymbols() { completionKind = 2; var isImportType = ts.isLiteralImportTypeNode(node), isTypeLocation = insideJsDocTagTypeExpression || isImportType && !node.isTypeOf || ts.isPartOfTypeNode(node.parent), isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node), allowTypeOrValue = isRhsOfImportDeclaration || !isTypeLocation && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile); if (ts.isEntityName(node) || isImportType) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && (symbol = ts.skipAlias(symbol, typeChecker), 1920 & symbol.flags)) { for (var exportedSymbols = ts.Debug.assertEachDefined(typeChecker.getExportsOfModule(symbol), "getExportsOfModule() should all be defined"), isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess(isImportType ? node : node.parent, symbol.name) }, isValidTypeAccess_1 = function (symbol) { return symbolCanBeReferencedAtTypeLocation(symbol) }, isValidAccess = allowTypeOrValue ? function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol) } : isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1, _i = 0, exportedSymbols_1 = exportedSymbols; _i < exportedSymbols_1.length; _i++) { var symbol_2 = exportedSymbols_1[_i]; isValidAccess(symbol_2) && symbols.push(symbol_2) } return void (!isTypeLocation && symbol.declarations.some(function (d) { return 273 !== d.kind && 238 !== d.kind && 237 !== d.kind }) && addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node))) } } isTypeLocation || addTypeProperties(typeChecker.getTypeAtLocation(node)) } function addTypeProperties(type) { if (isNewIdentifierLocation = hasIndexSignature(type), ts.isSourceFileJavaScript(sourceFile)) symbols.push.apply(symbols, getPropertiesForCompletion(type, typeChecker, !0)); else for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; typeChecker.isValidPropertyAccessForCompletions(178 === node.kind ? node : node.parent, type, symbol) && addPropertySymbol(symbol) } } function addPropertySymbol(symbol) { var symbolSymbol = ts.firstDefined(symbol.declarations, function (decl) { var name = ts.getNameOfDeclaration(decl), leftName = 146 === name.kind ? getLeftMostName(name.expression) : void 0; return leftName && typeChecker.getSymbolAtLocation(leftName) }); symbolSymbol ? (symbols.push(symbolSymbol), symbolToOriginInfoMap[ts.getSymbolId(symbolSymbol)] = { type: "symbol-member" }) : symbols.push(symbol) } function getLeftMostName(e) { return ts.isIdentifier(e) ? e : ts.isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : void 0 } function tryGetGlobalSymbols() { var result = tryGetObjectLikeCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1); return 1 === result } function tryGetConstructorCompletion() { return tryGetConstructorLikeCompletionContainer(contextToken) ? (completionKind = 5, isNewIdentifierLocation = !0, keywordFilters = 3, 1) : 0 } function tryGetJsxCompletionSymbols() { var jsxContainer = tryGetContainingJsxElement(contextToken), attrsType = jsxContainer && typeChecker.getAllAttributesTypeFromJsxOpeningLikeElement(jsxContainer); return attrsType ? (symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes.properties), completionKind = 3, isNewIdentifierLocation = !1, 1) : 0 } function getGlobalCompletions() { tryGetFunctionLikeBodyCompletionContainer(contextToken) && (keywordFilters = 4), completionKind = 1, isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken), previousToken !== contextToken && ts.Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'."); var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position, scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; isInSnippetScope = isSnippetScope(scopeNode); var symbolMeanings = 70107135; if (symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined"), preferences.includeCompletionsWithInsertText && 273 !== scopeNode.kind) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode); if (thisType) for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker, !0); _i < _a.length; _i++) { var symbol = _a[_i]; symbolToOriginInfoMap[ts.getSymbolId(symbol)] = { type: "this-type" }, symbols.push(symbol) } } shouldOfferImportCompletions() && getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", program.getCompilerOptions().target), filterGlobalCompletion(symbols) } function shouldOfferImportCompletions() { return !!preferences.includeCompletionsForModuleExports && (!!sourceFile.externalModuleIndicator || !sourceFile.commonJsModuleIndicator && (!!ts.programContainsEs6Modules(program) || !ts.isSourceFileJavaScript(sourceFile) && ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions()))) } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { case 273: case 201: case 264: case 212: return !0; default: return ts.isStatement(scopeNode) } } function filterGlobalCompletion(symbols) { var isTypeOnlyCompletion = insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (ts.isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken)), allowTypes = isTypeOnlyCompletion || !isContextTokenValueLocation(contextToken) && ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile); isTypeOnlyCompletion && (keywordFilters = 5), ts.filterMutate(symbols, function (symbol) { if (!ts.isSourceFile(location)) { if (ts.isExportAssignment(location.parent)) return !0; if (symbol = ts.skipAlias(symbol, typeChecker), ts.isInRightSideOfInternalImportEqualsDeclaration(location)) return !!(1920 & symbol.flags); if (allowTypes) { var symbolAllowedAsType = symbolCanBeReferencedAtTypeLocation(symbol); if (symbolAllowedAsType || isTypeOnlyCompletion) return symbolAllowedAsType } } return !!(67216319 & ts.getCombinedLocalAndExportSymbolFlags(symbol)) }) } function isContextTokenValueLocation(contextToken) { return contextToken && 103 === contextToken.kind && (164 === contextToken.parent.kind || ts.isTypeOfExpression(contextToken.parent)) } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 56: return 151 === parentKind || 150 === parentKind || 148 === parentKind || 231 === parentKind || ts.isFunctionLikeKind(parentKind); case 58: return 236 === parentKind; case 118: return 207 === parentKind } } return !1 } function symbolCanBeReferencedAtTypeLocation(symbol) { if (symbol = symbol.exportSymbol || symbol, symbol = ts.skipAlias(symbol, typeChecker), 67901928 & symbol.flags) return !0; if (1536 & symbol.flags) { var exportedSymbols = typeChecker.getExportsOfModule(symbol); return exportedSymbols.some(symbolCanBeReferencedAtTypeLocation) } } function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); ts.codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, program.getSourceFiles(), function (moduleSymbol) { if (!detailsEntryId || !detailsEntryId.source || ts.stripQuotes(moduleSymbol.name) === detailsEntryId.source) for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) { var symbol = _a[_i]; if (typeChecker.getMergedSymbol(symbol.parent) === typeChecker.resolveExternalModuleSymbol(moduleSymbol) && !ts.some(symbol.declarations, function (d) { return ts.isExportSpecifier(d) && !!d.parent.parent.moduleSpecifier })) { var isDefaultExport = "default" === symbol.name; isDefaultExport && (symbol = ts.getLocalSymbolForExportDefault(symbol) || symbol); var origin = { type: "export", moduleSymbol: moduleSymbol, isDefaultExport: isDefaultExport }; (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) && (symbols.push(symbol), symbolToOriginInfoMap[ts.getSymbolId(symbol)] = origin) } } }) } function stringContainsCharactersInOrder(str, characters) { if (0 === characters.length) return !0; for (var characterIndex = 0, strIndex = 0; strIndex < str.length; strIndex++)if (str.charCodeAt(strIndex) === characters.charCodeAt(characterIndex) && (characterIndex++ , characterIndex === characters.length)) return !0; return !1 } function getScopeNode(initialToken, position, sourceFile) { for (var scope = initialToken; scope && !ts.positionBelongsToNode(scope, position, sourceFile);)scope = scope.parent; return scope } function isCompletionListBlocker(contextToken) { var start = ts.timestamp(), result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || isSolelyIdentifierDefinitionLocation(contextToken) || isDotOfNumericLiteral(contextToken) || isInJsxText(contextToken); return log("getCompletionsAtPosition: isCompletionListBlocker: " + (ts.timestamp() - start)), result } function isInJsxText(contextToken) { if (10 === contextToken.kind) return !0; if (29 === contextToken.kind && contextToken.parent) { if (256 === contextToken.parent.kind) return !0; if (257 === contextToken.parent.kind || 255 === contextToken.parent.kind) return contextToken.parent.parent && 254 === contextToken.parent.parent.kind } return !1 } function isNewIdentifierDefinitionLocation(previousToken) { if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 26: return 186 === containingNodeKind || 154 === containingNodeKind || 187 === containingNodeKind || 182 === containingNodeKind || 199 === containingNodeKind || 162 === containingNodeKind; case 19: return 186 === containingNodeKind || 154 === containingNodeKind || 187 === containingNodeKind || 190 === containingNodeKind || 172 === containingNodeKind; case 21: return 182 === containingNodeKind || 159 === containingNodeKind || 146 === containingNodeKind; case 129: case 130: return !0; case 23: return 238 === containingNodeKind; case 17: return 234 === containingNodeKind; case 58: return 231 === containingNodeKind || 199 === containingNodeKind; case 14: return 201 === containingNodeKind; case 15: return 210 === containingNodeKind; case 114: case 112: case 113: return 151 === containingNodeKind }switch (keywordForNode(previousToken)) { case 114: case 113: case 112: return !0 } } return !1 } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { if (9 === contextToken.kind || 12 === contextToken.kind || ts.isTemplateLiteralKind(contextToken.kind)) { var start_5 = contextToken.getStart(), end = contextToken.getEnd(); if (start_5 < position && position < end) return !0; if (position === end) return !!contextToken.isUnterminated || 12 === contextToken.kind } return !1 } function tryGetObjectLikeCompletionSymbols() { var objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken); if (!objectLikeContainer) return 0; completionKind = 0; var typeMembers, existingMembers; if (183 === objectLikeContainer.kind) { var typeForObject = typeChecker.getContextualType(objectLikeContainer); if (!typeForObject) return 2; isNewIdentifierLocation = hasIndexSignature(typeForObject), typeMembers = getPropertiesForCompletion(typeForObject, typeChecker, !1), existingMembers = objectLikeContainer.properties } else { ts.Debug.assert(179 === objectLikeContainer.kind), isNewIdentifierLocation = !1; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (!ts.isVariableLike(rootDeclaration)) return ts.Debug.fail("Root declaration is not variable-like."); var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || 221 === rootDeclaration.parent.parent.kind; if (canGetType || 148 !== rootDeclaration.kind || (ts.isExpression(rootDeclaration.parent) ? canGetType = !!typeChecker.getContextualType(rootDeclaration.parent) : 153 !== rootDeclaration.parent.kind && 156 !== rootDeclaration.parent.kind || (canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent))), canGetType) { var typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); if (!typeForObject) return 2; typeMembers = typeChecker.getPropertiesOfType(typeForObject).filter(function (symbol) { return !(24 & ts.getDeclarationModifierFlagsFromSymbol(symbol)) }), existingMembers = objectLikeContainer.elements } } return typeMembers && typeMembers.length > 0 && (symbols = filterObjectMembersList(typeMembers, ts.Debug.assertDefined(existingMembers))), 1 } function tryGetImportOrExportClauseCompletionSymbols() { var namedImportsOrExports = !contextToken || 17 !== contextToken.kind && 26 !== contextToken.kind ? void 0 : ts.tryCast(contextToken.parent, ts.isNamedImportsOrExports); if (!namedImportsOrExports) return 0; var moduleSpecifier = (246 === namedImportsOrExports.kind ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier, moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); if (!moduleSpecifierSymbol) return 2; completionKind = 3, isNewIdentifierLocation = !1; var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol), existing = ts.arrayToSet(namedImportsOrExports.elements, function (n) { return isCurrentlyEditingNode(n) ? void 0 : (n.propertyName || n.name).escapedText }); return symbols = exports.filter(function (e) { return "default" !== e.escapedName && !existing.get(e.escapedName) }), 1 } function tryGetClassLikeCompletionSymbols() { var decl = tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location); if (!decl) return 0; if (completionKind = 3, isNewIdentifierLocation = !0, keywordFilters = ts.isClassLike(decl) ? 1 : 2, !ts.isClassLike(decl)) return 1; var classElement = contextToken.parent, classElementModifierFlags = ts.isClassElement(classElement) && ts.getModifierFlags(classElement); if (71 === contextToken.kind && !isCurrentlyEditingNode(contextToken)) switch (contextToken.getText()) { case "private": classElementModifierFlags |= 8; break; case "static": classElementModifierFlags |= 32 }if (!(8 & classElementModifierFlags)) { var baseSymbols = ts.flatMap(ts.getAllSuperTypeNodes(decl), function (baseTypeNode) { var type = typeChecker.getTypeAtLocation(baseTypeNode); return typeChecker.getPropertiesOfType(32 & classElementModifierFlags ? typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl) : type) }); symbols = filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags) } return 1 } function tryGetObjectLikeCompletionContainer(contextToken) { if (contextToken) switch (contextToken.kind) { case 17: case 26: var parent = contextToken.parent; if (ts.isObjectLiteralExpression(parent) || ts.isObjectBindingPattern(parent)) return parent } } function isConstructorParameterCompletion(node) { return !!node.parent && ts.isParameter(node.parent) && ts.isConstructorDeclaration(node.parent.parent) && (ts.isParameterPropertyModifier(node.kind) || ts.isDeclarationName(node)) } function tryGetConstructorLikeCompletionContainer(contextToken) { if (contextToken) switch (contextToken.kind) { case 19: case 26: return ts.isConstructorDeclaration(contextToken.parent) && contextToken.parent; default: if (isConstructorParameterCompletion(contextToken)) return contextToken.parent.parent } } function tryGetFunctionLikeBodyCompletionContainer(contextToken) { if (contextToken) { var prev_1, container = ts.findAncestor(contextToken.parent, function (node) { return ts.isClassLike(node) ? "quit" : !(!ts.isFunctionLikeDeclaration(node) || prev_1 !== node.body) || void (prev_1 = node) }); return container && container } } function tryGetContainingJsxElement(contextToken) { if (contextToken) { var parent = contextToken.parent; switch (contextToken.kind) { case 28: case 41: case 71: case 184: case 262: case 261: case 263: if (parent && (255 === parent.kind || 256 === parent.kind)) return parent; if (261 === parent.kind) return parent.parent.parent; break; case 9: if (parent && (261 === parent.kind || 263 === parent.kind)) return parent.parent.parent; break; case 18: if (parent && 264 === parent.kind && parent.parent && 261 === parent.parent.kind) return parent.parent.parent.parent; if (parent && 263 === parent.kind) return parent.parent.parent } } } function isSolelyIdentifierDefinitionLocation(contextToken) { var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 26: return 231 === containingNodeKind || 232 === containingNodeKind || 213 === containingNodeKind || 237 === containingNodeKind || isFunctionLikeButNotConstructor(containingNodeKind) || 235 === containingNodeKind || 180 === containingNodeKind || 236 === containingNodeKind || ts.isClassLike(contextToken.parent) && contextToken.parent.typeParameters && contextToken.parent.typeParameters.end >= contextToken.pos; case 23: return 180 === containingNodeKind; case 56: return 181 === containingNodeKind; case 21: return 180 === containingNodeKind; case 19: return 268 === containingNodeKind || isFunctionLikeButNotConstructor(containingNodeKind); case 17: return 237 === containingNodeKind; case 27: return 234 === containingNodeKind || 204 === containingNodeKind || 235 === containingNodeKind || 236 === containingNodeKind || ts.isFunctionLikeKind(containingNodeKind); case 115: return 151 === containingNodeKind && !ts.isClassLike(contextToken.parent.parent); case 24: return 148 === containingNodeKind || contextToken.parent && contextToken.parent.parent && 180 === contextToken.parent.parent.kind; case 114: case 112: case 113: return 148 === containingNodeKind && !ts.isConstructorDeclaration(contextToken.parent.parent); case 118: return 247 === containingNodeKind || 251 === containingNodeKind || 245 === containingNodeKind; case 125: case 136: if (isFromObjectTypeDeclaration(contextToken)) return !1; case 75: case 83: case 109: case 89: case 104: case 91: case 110: case 76: case 116: case 139: return !0 }if (isClassMemberCompletionKeyword(keywordForNode(contextToken)) && isFromObjectTypeDeclaration(contextToken)) return !1; if (isConstructorParameterCompletion(contextToken) && (!ts.isIdentifier(contextToken) || ts.isParameterPropertyModifier(keywordForNode(contextToken)) || isCurrentlyEditingNode(contextToken))) return !1; switch (keywordForNode(contextToken)) { case 117: case 120: case 75: case 76: case 124: case 83: case 89: case 109: case 110: case 112: case 113: case 114: case 115: case 104: case 116: return !0 }return ts.isDeclarationName(contextToken) && !ts.isJsxAttribute(contextToken.parent) && !(ts.isClassLike(contextToken.parent) && (contextToken !== previousToken || position > previousToken.end)) } function isFunctionLikeButNotConstructor(kind) { return ts.isFunctionLikeKind(kind) && 154 !== kind } function isDotOfNumericLiteral(contextToken) { if (8 === contextToken.kind) { var text = contextToken.getFullText(); return "." === text.charAt(text.length - 1) } return !1 } function filterObjectMembersList(contextualMemberSymbols, existingMembers) { if (0 === existingMembers.length) return contextualMemberSymbols; for (var existingMemberNames = ts.createUnderscoreEscapedMap(), _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; if ((269 === m.kind || 270 === m.kind || 181 === m.kind || 153 === m.kind || 155 === m.kind || 156 === m.kind) && !isCurrentlyEditingNode(m)) { var existingName = void 0; if (181 === m.kind && m.propertyName) 71 === m.propertyName.kind && (existingName = m.propertyName.escapedText); else { var name = ts.getNameOfDeclaration(m); existingName = ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : void 0 } existingMemberNames.set(existingName, !0) } } return contextualMemberSymbols.filter(function (m) { return !existingMemberNames.get(m.escapedName) }) } function filterClassMembersList(baseSymbols, existingMembers, currentClassElementModifierFlags) { for (var existingMemberNames = ts.createUnderscoreEscapedMap(), _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; if (!(151 !== m.kind && 153 !== m.kind && 155 !== m.kind && 156 !== m.kind || isCurrentlyEditingNode(m) || ts.hasModifier(m, 8) || ts.hasModifier(m, 32) !== !!(32 & currentClassElementModifierFlags))) { var existingName = ts.getPropertyNameForPropertyNameNode(m.name); existingName && existingMemberNames.set(existingName, !0) } } return baseSymbols.filter(function (propertySymbol) { return !(existingMemberNames.has(propertySymbol.escapedName) || !propertySymbol.declarations || 8 & ts.getDeclarationModifierFlagsFromSymbol(propertySymbol)) }) } function filterJsxAttributes(symbols, attributes) { for (var seenNames = ts.createUnderscoreEscapedMap(), _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { var attr = attributes_1[_i]; isCurrentlyEditingNode(attr) || 261 === attr.kind && seenNames.set(attr.name.escapedText, !0) } return symbols.filter(function (a) { return !seenNames.get(a.escapedName) }) } function isCurrentlyEditingNode(node) { return node.getStart(sourceFile) <= position && position <= node.getEnd() } var typeChecker = program.getTypeChecker(), start = ts.timestamp(), currentToken = ts.getTokenAtPosition(sourceFile, position, !1); log("getCompletionData: Get current token: " + (ts.timestamp() - start)), start = ts.timestamp(); var insideComment = ts.isInComment(sourceFile, position, currentToken); log("getCompletionData: Is inside comment: " + (ts.timestamp() - start)); var insideJsDocTagTypeExpression = !1, isInSnippetScope = !1; if (insideComment) { if (ts.hasDocComment(sourceFile, position)) { if (64 === sourceFile.text.charCodeAt(position - 1)) return { kind: 1 }; var lineStart = ts.getLineStartPositionForPosition(position, sourceFile); if (!sourceFile.text.substring(lineStart, position).match(/[^\*|\s|(\/\*\*)]/)) return { kind: 2 } } var tag = getJsDocTagAtPosition(currentToken, position); if (tag) { if (tag.tagName.pos <= position && position <= tag.tagName.end) return { kind: 1 }; if (isTagWithTypeExpression(tag) && tag.typeExpression && 277 === tag.typeExpression.kind && (currentToken = ts.getTokenAtPosition(sourceFile, position, !0), currentToken && (ts.isDeclarationName(currentToken) || 297 === currentToken.parent.kind && currentToken.parent.name === currentToken) || (insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression))), ts.isJSDocParameterTag(tag) && (ts.nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) return { kind: 3, tag: tag } } if (!insideJsDocTagTypeExpression) return void log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.") } start = ts.timestamp(); var previousToken = ts.findPrecedingToken(position, sourceFile, void 0, insideJsDocTagTypeExpression); log("getCompletionData: Get previous token 1: " + (ts.timestamp() - start)); var contextToken = previousToken; if (contextToken && position <= contextToken.end && (ts.isIdentifier(contextToken) || ts.isKeyword(contextToken.kind))) { var start_4 = ts.timestamp(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile, void 0, insideJsDocTagTypeExpression), log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_4)) } var propertyAccessToConvert, node = currentToken, isRightOfDot = !1, isRightOfOpenTag = !1, isStartingCloseTag = !1, isJsxInitializer = !1, location = ts.getTouchingPropertyName(sourceFile, position, insideJsDocTagTypeExpression); if (contextToken) { if (isCompletionListBlocker(contextToken)) return void log("Returning an empty list because completion was requested in an invalid position."); var parent = contextToken.parent; if (23 === contextToken.kind) switch (isRightOfDot = !0, parent.kind) { case 184: propertyAccessToConvert = parent, node = propertyAccessToConvert.expression; break; case 145: node = parent.left; break; case 178: node = parent; break; default: return } else if (1 === sourceFile.languageVariant) { if (parent && 184 === parent.kind && (contextToken = parent, parent = parent.parent), currentToken.parent === location) switch (currentToken.kind) { case 29: 254 !== currentToken.parent.kind && 256 !== currentToken.parent.kind || (location = currentToken); break; case 41: 255 === currentToken.parent.kind && (location = currentToken) }switch (parent.kind) { case 257: 41 === contextToken.kind && (isStartingCloseTag = !0, location = contextToken); break; case 199: if (!(32768 & parent.left.flags)) break; case 255: case 254: case 256: 27 === contextToken.kind && (isRightOfOpenTag = !0, location = contextToken); break; case 261: switch (previousToken.kind) { case 58: isJsxInitializer = !0; break; case 71: parent === previousToken.parent || parent.initializer || (isJsxInitializer = previousToken) } } } } var semanticStart = ts.timestamp(), completionKind = 5, isNewIdentifierLocation = !1, keywordFilters = 0, symbols = [], symbolToOriginInfoMap = []; if (isRightOfDot) getTypeScriptMemberSymbols(); else if (isRightOfOpenTag) { var tagSymbols = ts.Debug.assertEachDefined(typeChecker.getJsxIntrinsicTagNamesAt(location), "getJsxIntrinsicTagNames() should all be defined"); tryGetGlobalSymbols(), symbols = tagSymbols.concat(symbols), completionKind = 3 } else if (isStartingCloseTag) { var tagName = contextToken.parent.parent.openingElement.tagName, tagSymbol = typeChecker.getSymbolAtLocation(tagName); tagSymbol && (symbols = [tagSymbol]), completionKind = 3 } else if (!tryGetGlobalSymbols()) return; log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart)); var recommendedCompletion = previousToken && getRecommendedCompletion(previousToken, position, sourceFile, typeChecker); return { kind: 0, symbols: symbols, completionKind: completionKind, isInSnippetScope: isInSnippetScope, propertyAccessToConvert: propertyAccessToConvert, isNewIdentifierLocation: isNewIdentifierLocation, location: location, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap, recommendedCompletion: recommendedCompletion, previousToken: previousToken, isJsxInitializer: isJsxInitializer } } function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind) { var name = getSymbolName(symbol, origin, target); if (!(void 0 === name || 1536 & symbol.flags && ts.startsWithQuote(name) || ts.isKnownSymbol(symbol))) { var validIdentiferResult = { name: name, needsConvertPropertyAccess: !1 }; if (ts.isIdentifierText(name, target)) return validIdentiferResult; switch (kind) { case 3: return; case 0: return { name: JSON.stringify(name), needsConvertPropertyAccess: !1 }; case 2: case 1: return 32 === name.charCodeAt(0) ? void 0 : { name: name, needsConvertPropertyAccess: !0 }; case 5: case 4: return validIdentiferResult; default: ts.Debug.assertNever(kind) } } } function getKeywordCompletions(keywordFilter) { return _keywordCompletions[keywordFilter] || (_keywordCompletions[keywordFilter] = allKeywordsCompletions().filter(function (entry) { var kind = ts.stringToToken(entry.name); switch (keywordFilter) { case 0: return 140 !== kind; case 1: return isClassMemberCompletionKeyword(kind); case 2: return isInterfaceOrTypeLiteralCompletionKeyword(kind); case 3: return ts.isParameterPropertyModifier(kind); case 4: return !isClassMemberCompletionKeyword(kind); case 5: return ts.isTypeKeyword(kind); default: return ts.Debug.assertNever(keywordFilter) } })) } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { return 132 === kind } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 117: case 123: case 125: case 136: case 120: return !0; default: return ts.isClassMemberModifier(kind) } } function keywordForNode(node) { return ts.isIdentifier(node) ? node.originalKeywordKind || 0 : node.kind } function isEqualityOperatorKind(kind) { switch (kind) { case 34: case 32: case 35: case 33: return !0; default: return !1 } } function getJsDocTagAtPosition(node, position) { var jsDoc = getJsDocHavingNode(node).jsDoc; if (jsDoc) for (var _i = 0, jsDoc_1 = jsDoc; _i < jsDoc_1.length; _i++) { var _a = jsDoc_1[_i], pos = _a.pos, end = _a.end, tags = _a.tags; if (!(!tags || position < pos || position > end)) for (var i = tags.length - 1; i >= 0; i--) { var tag = tags[i]; if (position >= tag.pos) return tag } } } function getJsDocHavingNode(node) { if (!ts.isToken(node)) return node; switch (node.kind) { case 104: case 110: case 76: return node.parent.parent; default: return node.parent } } function getPropertiesForCompletion(type, checker, isForAccess) { if (!type.isUnion()) return ts.Debug.assertEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); var filteredTypes = isForAccess ? type.types : type.types.filter(function (memberType) { return !(16382 & memberType.flags || checker.isArrayLikeType(memberType) || ts.typeHasCallOrConstructSignatures(memberType, checker)) }); return ts.Debug.assertEachDefined(checker.getAllPossiblePropertiesOfTypes(filteredTypes), "getAllPossiblePropertiesOfTypes() should all be defined") } function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) { switch (location.kind) { case 298: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); if (cls && !ts.findChildOfKind(cls, 18, sourceFile)) return cls }if (contextToken) switch (contextToken.kind) { case 25: case 18: return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : ts.tryCast(location, ts.isObjectTypeDeclaration); case 17: case 26: return ts.tryCast(contextToken.parent, ts.isObjectTypeDeclaration); default: if (!isFromObjectTypeDeclaration(contextToken)) return; var isValidKeyword = ts.isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword; return isValidKeyword(contextToken.kind) || ts.isIdentifier(contextToken) && isValidKeyword(ts.stringToToken(contextToken.text)) ? contextToken.parent.parent : void 0 } } function isFromObjectTypeDeclaration(node) { return node.parent && ts.isClassOrTypeElement(node.parent) && ts.isObjectTypeDeclaration(node.parent.parent) } function hasIndexSignature(type) { return !!type.getStringIndexType() || !!type.getNumberIndexType() } function isValidTrigger(sourceFile, triggerCharacter, contextToken, position) { switch (triggerCharacter) { case ".": case "@": return !0; case '"': case "'": case "`": return isStringLiteralOrTemplate(contextToken) && position === contextToken.getStart(sourceFile) + 1; case "<": return 27 === contextToken.kind && 199 !== contextToken.parent.kind; case "/": return ts.isStringLiteralLike(contextToken) ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : 41 === contextToken.kind && ts.isJsxClosingElement(contextToken.parent); default: return ts.Debug.assertNever(triggerCharacter) } } function isStringLiteralOrTemplate(node) { switch (node.kind) { case 9: case 13: case 201: case 188: return !0; default: return !1 } } var KeywordCompletionFilters; !function (KeywordCompletionFilters) { KeywordCompletionFilters[KeywordCompletionFilters.None = 0] = "None", KeywordCompletionFilters[KeywordCompletionFilters.ClassElementKeywords = 1] = "ClassElementKeywords", KeywordCompletionFilters[KeywordCompletionFilters.InterfaceElementKeywords = 2] = "InterfaceElementKeywords", KeywordCompletionFilters[KeywordCompletionFilters.ConstructorParameterKeywords = 3] = "ConstructorParameterKeywords", KeywordCompletionFilters[KeywordCompletionFilters.FunctionLikeBodyKeywords = 4] = "FunctionLikeBodyKeywords", KeywordCompletionFilters[KeywordCompletionFilters.TypeKeywords = 5] = "TypeKeywords" }(KeywordCompletionFilters || (KeywordCompletionFilters = {})); var GlobalsSearch; !function (GlobalsSearch) { GlobalsSearch[GlobalsSearch.Continue = 0] = "Continue", GlobalsSearch[GlobalsSearch.Success = 1] = "Success", GlobalsSearch[GlobalsSearch.Fail = 2] = "Fail" }(GlobalsSearch || (GlobalsSearch = {})), Completions.getCompletionsAtPosition = getCompletionsAtPosition; var StringLiteralCompletionKind; !function (StringLiteralCompletionKind) { StringLiteralCompletionKind[StringLiteralCompletionKind.Paths = 0] = "Paths", StringLiteralCompletionKind[StringLiteralCompletionKind.Properties = 1] = "Properties", StringLiteralCompletionKind[StringLiteralCompletionKind.Types = 2] = "Types" }(StringLiteralCompletionKind || (StringLiteralCompletionKind = {})), Completions.getCompletionEntryDetails = getCompletionEntryDetails, Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; var CompletionDataKind; !function (CompletionDataKind) { CompletionDataKind[CompletionDataKind.Data = 0] = "Data", CompletionDataKind[CompletionDataKind.JsDocTagName = 1] = "JsDocTagName", CompletionDataKind[CompletionDataKind.JsDocTag = 2] = "JsDocTag", CompletionDataKind[CompletionDataKind.JsDocParameterName = 3] = "JsDocParameterName" }(CompletionDataKind || (CompletionDataKind = {})); var CompletionKind; !function (CompletionKind) { CompletionKind[CompletionKind.ObjectPropertyDeclaration = 0] = "ObjectPropertyDeclaration", CompletionKind[CompletionKind.Global = 1] = "Global", CompletionKind[CompletionKind.PropertyAccess = 2] = "PropertyAccess", CompletionKind[CompletionKind.MemberLike = 3] = "MemberLike", CompletionKind[CompletionKind.String = 4] = "String", CompletionKind[CompletionKind.None = 5] = "None" }(CompletionKind || (CompletionKind = {})); var _keywordCompletions = [], allKeywordsCompletions = ts.memoize(function () { for (var res = [], i = 72; i <= 144; i++)res.push({ name: ts.tokenToString(i), kind: "keyword", kindModifiers: "", sortText: "0" }); return res }) }(Completions = ts.Completions || (ts.Completions = {})) }(ts || (ts = {})); var ts; !function (ts) { var DocumentHighlights; !function (DocumentHighlights) { function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) { var node = ts.getTouchingPropertyName(sourceFile, position, !0); if (node.parent && (ts.isJsxOpeningElement(node.parent) && node.parent.tagName === node || ts.isJsxClosingElement(node.parent))) { var _a = node.parent.parent, openingElement = _a.openingElement, closingElement = _a.closingElement, highlightSpans = [openingElement, closingElement].map(function (_a) { var tagName = _a.tagName; return getHighlightSpanForNode(tagName, sourceFile) }); return [{ fileName: sourceFile.fileName, highlightSpans: highlightSpans }] } return getSemanticDocumentHighlights(position, node, program, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile) } function getHighlightSpanForNode(node, sourceFile) { return { fileName: sourceFile.fileName, textSpan: ts.createTextSpanFromNode(node, sourceFile), kind: "none" } } function getSemanticDocumentHighlights(position, node, program, cancellationToken, sourceFilesToSearch) { var sourceFilesSet = ts.arrayToSet(sourceFilesToSearch, function (f) { return f.fileName }), referenceEntries = ts.FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken, void 0, sourceFilesSet); if (referenceEntries) { var map = ts.arrayToMultiMap(referenceEntries.map(ts.FindAllReferences.toHighlightSpan), function (e) { return e.fileName }, function (e) { return e.span }); return ts.arrayFrom(map.entries(), function (_a) { var fileName = _a[0], highlightSpans = _a[1]; if (!sourceFilesSet.has(fileName)) { ts.Debug.assert(program.redirectTargetsSet.has(fileName)); var redirectTarget_1 = program.getSourceFile(fileName), redirect = ts.find(sourceFilesToSearch, function (f) { return f.redirectInfo && f.redirectInfo.redirectTarget === redirectTarget_1 }); fileName = redirect.fileName, ts.Debug.assert(sourceFilesSet.has(fileName)) } return { fileName: fileName, highlightSpans: highlightSpans } }) } } function getSyntacticDocumentHighlights(node, sourceFile) { var highlightSpans = getHighlightSpans(node, sourceFile); return highlightSpans && [{ fileName: sourceFile.fileName, highlightSpans: highlightSpans }] } function getHighlightSpans(node, sourceFile) { function getFromAllDeclarations(nodeTest, keywords) { return useParent(node.parent, nodeTest, function (decl) { return ts.mapDefined(decl.symbol.declarations, function (d) { return nodeTest(d) ? ts.find(d.getChildren(sourceFile), function (c) { return ts.contains(keywords, c.kind) }) : void 0 }) }) } function useParent(node, nodeTest, getNodes) { return nodeTest(node) ? highlightSpans(getNodes(node, sourceFile)) : void 0 } function highlightSpans(nodes) { return nodes && nodes.map(function (node) { return getHighlightSpanForNode(node, sourceFile) }) } switch (node.kind) { case 90: case 82: return ts.isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : void 0; case 96: return useParent(node.parent, ts.isReturnStatement, getReturnOccurrences); case 100: return useParent(node.parent, ts.isThrowStatement, getThrowOccurrences); case 102: case 74: case 87: var tryStatement = 74 === node.kind ? node.parent.parent : node.parent; return useParent(tryStatement, ts.isTryStatement, getTryCatchFinallyOccurrences); case 98: return useParent(node.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences); case 73: case 79: return useParent(node.parent.parent.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences); case 72: case 77: return useParent(node.parent, ts.isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences); case 88: case 106: case 81: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, !0) }, getLoopBreakContinueOccurrences); case 123: return getFromAllDeclarations(ts.isConstructorDeclaration, [123]); case 125: case 136: return getFromAllDeclarations(ts.isAccessor, [125, 136]); case 121: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); case 120: return highlightSpans(getAsyncAndAwaitOccurrences(node)); default: return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0 } } function aggregateOwnedThrowStatements(node) { return ts.isThrowStatement(node) ? [node] : ts.isTryStatement(node) ? ts.concatenate(node.catchClause ? aggregateOwnedThrowStatements(node.catchClause) : node.tryBlock && aggregateOwnedThrowStatements(node.tryBlock), aggregateOwnedThrowStatements(node.finallyBlock)) : ts.isFunctionLike(node) ? void 0 : flatMapChildren(node, aggregateOwnedThrowStatements) } function getThrowStatementOwner(throwStatement) { for (var child = throwStatement; child.parent;) { var parent = child.parent; if (ts.isFunctionBlock(parent) || 273 === parent.kind) return parent; if (ts.isTryStatement(parent) && parent.tryBlock === child && parent.catchClause) return child; child = parent } } function aggregateAllBreakAndContinueStatements(node) { return ts.isBreakOrContinueStatement(node) ? [node] : ts.isFunctionLike(node) ? void 0 : flatMapChildren(node, aggregateAllBreakAndContinueStatements) } function flatMapChildren(node, cb) { var result = []; return node.forEachChild(function (child) { var value = cb(child); void 0 !== value && result.push.apply(result, ts.toArray(value)) }), result } function ownsBreakOrContinueStatement(owner, statement) { var actualOwner = getBreakOrContinueOwner(statement); return actualOwner && actualOwner === owner } function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { case 226: if (222 === statement.kind) return !1; case 219: case 220: case 221: case 218: case 217: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: return ts.isFunctionLike(node) && "quit" } }) } function getModifierOccurrences(modifier, declaration) { var modifierFlag = ts.modifierToFlag(modifier); return ts.mapDefined(getNodesToSearchForModifier(declaration, modifierFlag), function (node) { if (ts.getModifierFlags(node) & modifierFlag) { var mod = ts.find(node.modifiers, function (m) { return m.kind === modifier }); return ts.Debug.assert(!!mod), mod } }) } function getNodesToSearchForModifier(declaration, modifierFlag) { var container = declaration.parent; switch (container.kind) { case 239: case 273: case 212: case 265: case 266: return 128 & modifierFlag && ts.isClassDeclaration(declaration) ? declaration.members.concat([declaration]) : container.statements; case 154: case 153: case 233: return container.parameters.concat(ts.isClassLike(container.parent) ? container.parent.members : []); case 234: case 204: var nodes = container.members; if (28 & modifierFlag) { var constructor = ts.find(container.members, ts.isConstructorDeclaration); if (constructor) return nodes.concat(constructor.parameters) } else if (128 & modifierFlag) return nodes.concat([container]); return nodes; default: ts.Debug.assertNever(container, "Invalid container kind.") } } function pushKeywordIf(keywordList, token) { for (var expected = [], _i = 2; _i < arguments.length; _i++)expected[_i - 2] = arguments[_i]; return !(!token || !ts.contains(expected, token.kind)) && (keywordList.push(token), !0) } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 88, 106, 81) && 217 === loopNode.kind) for (var loopTokens = loopNode.getChildren(), i = loopTokens.length - 1; i >= 0 && !pushKeywordIf(keywords, loopTokens[i], 106); i--); return ts.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function (statement) { ownsBreakOrContinueStatement(loopNode, statement) && pushKeywordIf(keywords, statement.getFirstToken(), 72, 77) }), keywords } function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) switch (owner.kind) { case 219: case 220: case 221: case 217: case 218: return getLoopBreakContinueOccurrences(owner); case 226: return getSwitchCaseDefaultOccurrences(owner) } } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; return pushKeywordIf(keywords, switchStatement.getFirstToken(), 98), ts.forEach(switchStatement.caseBlock.clauses, function (clause) { pushKeywordIf(keywords, clause.getFirstToken(), 73, 79), ts.forEach(aggregateAllBreakAndContinueStatements(clause), function (statement) { ownsBreakOrContinueStatement(switchStatement, statement) && pushKeywordIf(keywords, statement.getFirstToken(), 72) }) }), keywords } function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { var keywords = []; if (pushKeywordIf(keywords, tryStatement.getFirstToken(), 102), tryStatement.catchClause && pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 74), tryStatement.finallyBlock) { var finallyKeyword = ts.findChildOfKind(tryStatement, 87, sourceFile); pushKeywordIf(keywords, finallyKeyword, 87) } return keywords } function getThrowOccurrences(throwStatement, sourceFile) { var owner = getThrowStatementOwner(throwStatement); if (owner) { var keywords = []; return ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { keywords.push(ts.findChildOfKind(throwStatement, 100, sourceFile)) }), ts.isFunctionBlock(owner) && ts.forEachReturnStatement(owner, function (returnStatement) { keywords.push(ts.findChildOfKind(returnStatement, 96, sourceFile)) }), keywords } } function getReturnOccurrences(returnStatement, sourceFile) { var func = ts.getContainingFunction(returnStatement); if (func) { var keywords = []; return ts.forEachReturnStatement(ts.cast(func.body, ts.isBlock), function (returnStatement) { keywords.push(ts.findChildOfKind(returnStatement, 96, sourceFile)) }), ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { keywords.push(ts.findChildOfKind(throwStatement, 100, sourceFile)) }), keywords } } function getAsyncAndAwaitOccurrences(node) { function aggregate(node) { ts.isAwaitExpression(node) && pushKeywordIf(keywords, node.getFirstToken(), 121), ts.isFunctionLike(node) || ts.isClassLike(node) || ts.isInterfaceDeclaration(node) || ts.isModuleDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isTypeNode(node) || ts.forEachChild(node, aggregate) } var func = ts.getContainingFunction(node); if (func) { var keywords = []; return func.modifiers && func.modifiers.forEach(function (modifier) { pushKeywordIf(keywords, modifier, 120) }), ts.forEachChild(func, aggregate), keywords } } function getIfElseOccurrences(ifStatement, sourceFile) { for (var keywords = getIfElseKeywords(ifStatement, sourceFile), result = [], i = 0; i < keywords.length; i++) { if (82 === keywords[i].kind && i < keywords.length - 1) { for (var elseKeyword = keywords[i], ifKeyword = keywords[i + 1], shouldCombineElseAndIf = !0, j = ifKeyword.getStart(sourceFile) - 1; j >= elseKeyword.end; j--)if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { shouldCombineElseAndIf = !1; break } if (shouldCombineElseAndIf) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), kind: "reference" }), i++; continue } } result.push(getHighlightSpanForNode(keywords[i], sourceFile)) } return result } function getIfElseKeywords(ifStatement, sourceFile) { for (var keywords = []; ts.isIfStatement(ifStatement.parent) && ifStatement.parent.elseStatement === ifStatement;)ifStatement = ifStatement.parent; for (; ;) { var children = ifStatement.getChildren(sourceFile); pushKeywordIf(keywords, children[0], 90); for (var i = children.length - 1; i >= 0 && !pushKeywordIf(keywords, children[i], 82); i--); if (!ifStatement.elseStatement || !ts.isIfStatement(ifStatement.elseStatement)) break; ifStatement = ifStatement.elseStatement } return keywords } function isLabeledBy(node, labelName) { return !!ts.findAncestor(node.parent, function (owner) { return ts.isLabeledStatement(owner) ? owner.label.escapedText === labelName : "quit" }) } DocumentHighlights.getDocumentHighlights = getDocumentHighlights }(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})) }(ts || (ts = {})); var ts; !function (ts) { function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { return createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory) } function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory, externalCache) { function getKeyForCompilationSettings(settings) { return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths) } function getBucketForCompilationSettings(key, createIfMissing) { var bucket = buckets.get(key); return !bucket && createIfMissing && buckets.set(key, bucket = ts.createMap()), bucket } function reportStats() { var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && "_" === name.charAt(0) }).map(function (name) { var entries = buckets.get(name), sourceFiles = []; return entries.forEach(function (entry, name) { sourceFiles.push({ name: name, refCount: entry.languageServiceRefCount }) }), sourceFiles.sort(function (x, y) { return y.refCount - x.refCount }), { bucket: name, sourceFiles: sourceFiles } }); return JSON.stringify(bucketInfoArray, void 0, 2) } function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName), key = getKeyForCompilationSettings(compilationSettings); return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) } function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, !0, scriptKind) } function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName), key = getKeyForCompilationSettings(compilationSettings); return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) } function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, !1, scriptKind) } function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { var bucket = getBucketForCompilationSettings(key, !0), entry = bucket.get(path), scriptTarget = 6 === scriptKind ? 100 : compilationSettings.target; if (!entry && externalCache) { var sourceFile = externalCache.getDocument(key, path); sourceFile && (ts.Debug.assert(acquiring), entry = { sourceFile: sourceFile, languageServiceRefCount: 0 }, bucket.set(path, entry)) } if (entry) entry.sourceFile.version !== version && (entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)), externalCache && externalCache.setDocument(key, path, entry.sourceFile)), acquiring && entry.languageServiceRefCount++; else { var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, !1, scriptKind); externalCache && externalCache.setDocument(key, path, sourceFile), entry = { sourceFile: sourceFile, languageServiceRefCount: 1 }, bucket.set(path, entry) } return ts.Debug.assert(0 !== entry.languageServiceRefCount), entry.sourceFile } function releaseDocument(fileName, compilationSettings) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName), key = getKeyForCompilationSettings(compilationSettings); return releaseDocumentWithKey(path, key) } function releaseDocumentWithKey(path, key) { var bucket = getBucketForCompilationSettings(key, !1); ts.Debug.assert(void 0 !== bucket); var entry = bucket.get(path); entry.languageServiceRefCount-- , ts.Debug.assert(entry.languageServiceRefCount >= 0), 0 === entry.languageServiceRefCount && bucket.delete(path) } function getLanguageServiceRefCounts(path) { return ts.arrayFrom(buckets.entries(), function (_a) { var key = _a[0], bucket = _a[1], entry = bucket.get(path); return [key, entry && entry.languageServiceRefCount] }) } void 0 === currentDirectory && (currentDirectory = ""); var buckets = ts.createMap(), getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); return { acquireDocument: acquireDocument, acquireDocumentWithKey: acquireDocumentWithKey, updateDocument: updateDocument, updateDocumentWithKey: updateDocumentWithKey, releaseDocument: releaseDocument, releaseDocumentWithKey: releaseDocumentWithKey, getLanguageServiceRefCounts: getLanguageServiceRefCounts, reportStats: reportStats, getKeyForCompilationSettings: getKeyForCompilationSettings } } ts.createDocumentRegistry = createDocumentRegistry, ts.createDocumentRegistryInternal = createDocumentRegistryInternal }(ts || (ts = {})); var ts; !function (ts) { var FindAllReferences; !function (FindAllReferences) { function createImportTracker(sourceFiles, sourceFilesSet, checker, cancellationToken) { var allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken); return function (exportSymbol, exportInfo, isForRename) { var _a = getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, exportInfo, checker, cancellationToken), directImports = _a.directImports, indirectUsers = _a.indirectUsers; return __assign({ indirectUsers: indirectUsers }, getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename)) } } function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, _a, checker, cancellationToken) { function getIndirectUsers() { if (isAvailableThroughGlobal) return sourceFiles; for (var _i = 0, _a = exportingModuleSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; ts.isExternalModuleAugmentation(decl) && sourceFilesSet.has(decl.getSourceFile().fileName) && addIndirectUser(decl) } return indirectUserDeclarations.map(ts.getSourceFileOfNode) } function handleDirectImports(exportingModuleSymbol) { var theseDirectImports = getDirectImports(exportingModuleSymbol); if (theseDirectImports) for (var _i = 0, theseDirectImports_1 = theseDirectImports; _i < theseDirectImports_1.length; _i++) { var direct = theseDirectImports_1[_i]; if (markSeenDirectImport(direct)) switch (cancellationToken.throwIfCancellationRequested(), direct.kind) { case 186: if (!isAvailableThroughGlobal) { var parent = direct.parent; if (2 === exportKind && 231 === parent.kind) { var name = parent.name; if (71 === name.kind) { directImports.push(name); break } } addIndirectUser(direct.getSourceFile()) } break; case 71: break; case 242: handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1)); break; case 243: var namedBindings = direct.importClause && direct.importClause.namedBindings; if (namedBindings && 245 === namedBindings.kind) handleNamespaceImport(direct, namedBindings.name); else if (ts.isDefaultImport(direct)) { var sourceFileLike = getSourceFileLikeForImportDeclaration(direct); isAvailableThroughGlobal || addIndirectUser(sourceFileLike), directImports.push(direct) } else directImports.push(direct); break; case 249: direct.exportClause ? directImports.push(direct) : handleDirectImports(getContainingModuleSymbol(direct, checker)); break; case 178: directImports.push(direct); break; default: ts.Debug.assertNever(direct, "Unexpected import kind: " + ts.Debug.showSyntaxKind(direct)) } } } function handleNamespaceImport(importDeclaration, name, isReExport) { if (2 === exportKind) directImports.push(importDeclaration); else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); ts.Debug.assert(273 === sourceFileLike.kind || 238 === sourceFileLike.kind), isReExport || findNamespaceReExports(sourceFileLike, name, checker) ? addIndirectUsers(sourceFileLike) : addIndirectUser(sourceFileLike) } } function addIndirectUser(sourceFileLike) { ts.Debug.assert(!isAvailableThroughGlobal); var isNew = markSeenIndirectUser(sourceFileLike); return isNew && indirectUserDeclarations.push(sourceFileLike), isNew } function addIndirectUsers(sourceFileLike) { if (addIndirectUser(sourceFileLike)) { var moduleSymbol = checker.getMergedSymbol(sourceFileLike.symbol); ts.Debug.assert(!!(1536 & moduleSymbol.flags)); var directImports = getDirectImports(moduleSymbol); if (directImports) for (var _i = 0, directImports_1 = directImports; _i < directImports_1.length; _i++) { var directImport = directImports_1[_i]; addIndirectUsers(getSourceFileLikeForImportDeclaration(directImport)) } } } function getDirectImports(moduleSymbol) { return allDirectImports.get(ts.getSymbolId(moduleSymbol).toString()) } var exportingModuleSymbol = _a.exportingModuleSymbol, exportKind = _a.exportKind, markSeenDirectImport = ts.nodeSeenTracker(), markSeenIndirectUser = ts.nodeSeenTracker(), directImports = [], isAvailableThroughGlobal = !!exportingModuleSymbol.globalExports, indirectUserDeclarations = isAvailableThroughGlobal ? void 0 : []; return handleDirectImports(exportingModuleSymbol), { directImports: directImports, indirectUsers: getIndirectUsers() } } function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, checker, isForRename) { function addSearch(location, symbol) { importSearches.push([location, symbol]) } function handleImport(decl) { if (242 === decl.kind) return void (isExternalModuleImportEquals(decl) && handleNamespaceImportLike(decl.name)); if (71 === decl.kind) return void handleNamespaceImportLike(decl); if (178 === decl.kind) return void (decl.qualifier ? ts.isIdentifier(decl.qualifier) && decl.qualifier.escapedText === ts.symbolName(exportSymbol) && singleReferences.push(decl.qualifier) : 2 === exportKind && singleReferences.push(decl.argument.literal)); if (9 === decl.moduleSpecifier.kind) { if (249 === decl.kind) return void searchForNamedImport(decl.exportClause); var importClause = decl.importClause; if (importClause) { var namedBindings = importClause.namedBindings; if (namedBindings && 245 === namedBindings.kind) return void handleNamespaceImportLike(namedBindings.name); if (0 === exportKind) searchForNamedImport(namedBindings); else { var name = importClause.name; if (name && (!isForRename || name.escapedText === ts.symbolEscapedNameNoDefault(exportSymbol))) { var defaultImportAlias = checker.getSymbolAtLocation(name); addSearch(name, defaultImportAlias) } 1 === exportKind && searchForNamedImport(namedBindings) } } } } function handleNamespaceImportLike(importName) { 2 !== exportKind || isForRename && !isNameMatch(importName.escapedText) || addSearch(importName, checker.getSymbolAtLocation(importName)) } function searchForNamedImport(namedBindings) { if (namedBindings) for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var element = _a[_i], name = element.name, propertyName = element.propertyName; if (isNameMatch((propertyName || name).escapedText)) if (propertyName) singleReferences.push(propertyName), isForRename && name.escapedText !== exportSymbol.escapedName || addSearch(name, checker.getSymbolAtLocation(name)); else { var localSymbol = 251 === element.kind && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) : checker.getSymbolAtLocation(name); addSearch(name, localSymbol) } } } function isNameMatch(name) { return name === exportSymbol.escapedName || 0 !== exportKind && "default" === name } var importSearches = [], singleReferences = []; if (directImports) for (var _i = 0, directImports_2 = directImports; _i < directImports_2.length; _i++) { var decl = directImports_2[_i]; handleImport(decl) } return { importSearches: importSearches, singleReferences: singleReferences } } function findNamespaceReExports(sourceFileLike, name, checker) { var namespaceImportSymbol = checker.getSymbolAtLocation(name); return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { if (ts.isExportDeclaration(statement)) { var exportClause = statement.exportClause, moduleSpecifier = statement.moduleSpecifier; return !moduleSpecifier && exportClause && exportClause.elements.some(function (element) { return checker.getExportSpecifierLocalTargetSymbol(element) === namespaceImportSymbol }) } }) } function findModuleReferences(program, sourceFiles, searchModuleSymbol) { for (var refs = [], checker = program.getTypeChecker(), _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { var referencingFile = sourceFiles_5[_i], searchSourceFile = searchModuleSymbol.valueDeclaration; if (273 === searchSourceFile.kind) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile && refs.push({ kind: "reference", referencingFile: referencingFile, ref: ref }) } for (var _c = 0, _d = referencingFile.typeReferenceDirectives; _c < _d.length; _c++) { var ref = _d[_c], referenced = program.getResolvedTypeReferenceDirectives().get(ref.fileName); void 0 !== referenced && referenced.resolvedFileName === searchSourceFile.fileName && refs.push({ kind: "reference", referencingFile: referencingFile, ref: ref }) } } forEachImport(referencingFile, function (_importDecl, moduleSpecifier) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); moduleSymbol === searchModuleSymbol && refs.push({ kind: "import", literal: moduleSpecifier }) }) } return refs } function getDirectImportsMap(sourceFiles, checker, cancellationToken) { for (var map = ts.createMap(), _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { var sourceFile = sourceFiles_6[_i]; cancellationToken.throwIfCancellationRequested(), forEachImport(sourceFile, function (importDecl, moduleSpecifier) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { var id = ts.getSymbolId(moduleSymbol).toString(), imports = map.get(id); imports || map.set(id, imports = []), imports.push(importDecl) } }) } return map } function forEachPossibleImportOrExportStatement(sourceFileLike, action) { return ts.forEach(273 === sourceFileLike.kind ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action) }) } function forEachImport(sourceFile, action) { if (sourceFile.externalModuleIndicator || void 0 !== sourceFile.imports) for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { var i = _a[_i]; action(ts.importFromModuleSpecifier(i), i) } else forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { case 249: case 243: var decl = statement; decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier) && action(decl, decl.moduleSpecifier); break; case 242: var decl = statement; isExternalModuleImportEquals(decl) && action(decl, decl.moduleReference.expression) } }) } function getImportOrExportSymbol(node, symbol, checker, comingFromExport) { function getExport() { function getExportAssignmentExport(ex) { var exportingModuleSymbol = ts.Debug.assertDefined(ex.symbol.parent, "Expected export symbol to have a parent"), exportKind = ex.isExportEquals ? 2 : 1; return { kind: 1, symbol: symbol, exportInfo: { exportingModuleSymbol: exportingModuleSymbol, exportKind: exportKind } } } function getSpecialPropertyExport(node, useLhsSymbol) { var kind; switch (ts.getSpecialPropertyAssignmentKind(node)) { case 1: kind = 0; break; case 2: kind = 2; break; default: return }var sym = useLhsSymbol ? checker.getSymbolAtLocation(ts.cast(node.left, ts.isPropertyAccessExpression).name) : symbol; return !sym || 1536 & checker.getMergedSymbol(sym.parent).flags || ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.showSymbol(sym) + ", parent is " + ts.Debug.showSymbol(sym.parent)), sym && exportInfo(sym, kind) } var parent = node.parent; if (symbol.exportSymbol) return 184 === parent.kind ? symbol.declarations.some(function (d) { return d === parent }) && ts.isBinaryExpression(parent.parent) ? getSpecialPropertyExport(parent.parent, !1) : void 0 : exportInfo(symbol.exportSymbol, getExportKindForDeclaration(parent)); var exportNode = getExportNode(parent, node); if (exportNode && ts.hasModifier(exportNode, 1)) { if (ts.isImportEqualsDeclaration(exportNode) && exportNode.moduleReference === node) { if (comingFromExport) return; var lhsSymbol = checker.getSymbolAtLocation(exportNode.name); return { kind: 0, symbol: lhsSymbol, isNamedImport: !1 } } return exportInfo(symbol, getExportKindForDeclaration(exportNode)) } return ts.isExportAssignment(parent) ? getExportAssignmentExport(parent) : ts.isExportAssignment(parent.parent) ? getExportAssignmentExport(parent.parent) : ts.isBinaryExpression(parent) ? getSpecialPropertyExport(parent, !0) : ts.isBinaryExpression(parent.parent) ? getSpecialPropertyExport(parent.parent, !0) : ts.isJSDocTypedefTag(parent) ? exportInfo(symbol, 0) : void 0; } function getImport() { var isImport = isNodeImport(node); if (isImport) { var importedSymbol = checker.getImmediateAliasedSymbol(symbol); if (importedSymbol) { importedSymbol = skipExportSpecifierSymbol(importedSymbol, checker), "export=" === importedSymbol.escapedName && (importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker)); var importedName = ts.symbolEscapedNameNoDefault(importedSymbol); return void 0 === importedName || "default" === importedName || importedName === symbol.escapedName ? __assign({ kind: 0, symbol: importedSymbol }, isImport) : void 0 } } } function exportInfo(symbol, kind) { var exportInfo = getExportInfo(symbol, kind, checker); return exportInfo && { kind: 1, symbol: symbol, exportInfo: exportInfo } } function getExportKindForDeclaration(node) { return ts.hasModifier(node, 512) ? 1 : 0 } return comingFromExport ? getExport() : getExport() || getImport() } function getExportEqualsLocalSymbol(importedSymbol, checker) { if (2097152 & importedSymbol.flags) return ts.Debug.assertDefined(checker.getImmediateAliasedSymbol(importedSymbol)); var decl = importedSymbol.valueDeclaration; return ts.isExportAssignment(decl) ? ts.Debug.assertDefined(decl.expression.symbol) : ts.isBinaryExpression(decl) ? ts.Debug.assertDefined(decl.right.symbol) : ts.isSourceFile(decl) ? ts.Debug.assertDefined(decl.symbol) : ts.Debug.fail() } function getExportNode(parent, node) { if (231 === parent.kind) { var p = parent; return p.name !== node ? void 0 : 268 === p.parent.kind ? void 0 : 213 === p.parent.parent.kind ? p.parent.parent : void 0 } return parent } function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { case 242: return parent.name === node && isExternalModuleImportEquals(parent) ? { isNamedImport: !1 } : void 0; case 247: return parent.propertyName ? void 0 : { isNamedImport: !0 }; case 244: case 245: return ts.Debug.assert(parent.name === node), { isNamedImport: !1 }; default: return } } function getExportInfo(exportSymbol, exportKind, checker) { var moduleSymbol = exportSymbol.parent; if (moduleSymbol) { var exportingModuleSymbol = checker.getMergedSymbol(moduleSymbol); return ts.isExternalModuleSymbol(exportingModuleSymbol) ? { exportingModuleSymbol: exportingModuleSymbol, exportKind: exportKind } : void 0 } } function skipExportSpecifierSymbol(symbol, checker) { if (symbol.declarations) for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (ts.isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) return checker.getExportSpecifierLocalTargetSymbol(declaration) } return symbol } function getContainingModuleSymbol(importer, checker) { return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol) } function getSourceFileLikeForImportDeclaration(node) { if (186 === node.kind) return node.getSourceFile(); var parent = node.parent; return 273 === parent.kind ? parent : (ts.Debug.assert(239 === parent.kind), ts.cast(parent.parent, isAmbientModuleDeclaration)) } function isAmbientModuleDeclaration(node) { return 238 === node.kind && 9 === node.name.kind } function isExternalModuleImportEquals(eq) { return 253 === eq.moduleReference.kind && 9 === eq.moduleReference.expression.kind } FindAllReferences.createImportTracker = createImportTracker; var ExportKind; !function (ExportKind) { ExportKind[ExportKind.Named = 0] = "Named", ExportKind[ExportKind.Default = 1] = "Default", ExportKind[ExportKind.ExportEquals = 2] = "ExportEquals" }(ExportKind = FindAllReferences.ExportKind || (FindAllReferences.ExportKind = {})); var ImportExport; !function (ImportExport) { ImportExport[ImportExport.Import = 0] = "Import", ImportExport[ImportExport.Export = 1] = "Export" }(ImportExport = FindAllReferences.ImportExport || (FindAllReferences.ImportExport = {})), FindAllReferences.findModuleReferences = findModuleReferences, FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol, FindAllReferences.getExportInfo = getExportInfo }(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})) }(ts || (ts = {})); var ts; !function (ts) { var FindAllReferences; !function (FindAllReferences) { function nodeEntry(node, isInString) { return { type: "node", node: node, isInString: isInString } } function findReferencedSymbols(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position, !0), referencedSymbols = FindAllReferences.Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken), checker = program.getTypeChecker(); return referencedSymbols && referencedSymbols.length ? ts.mapDefined(referencedSymbols, function (_a) { var definition = _a.definition, references = _a.references; return definition && { definition: checker.runWithCancellationToken(cancellationToken, function (checker) { return definitionToReferencedSymbolDefinitionInfo(definition, checker, node) }), references: references.map(toReferenceEntry) } }) : void 0 } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position, !1), referenceEntries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position), checker = program.getTypeChecker(); return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker) }) } function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { if (273 !== node.kind) { var checker = program.getTypeChecker(); if (270 === node.parent.kind) { var result_5 = []; return FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)) }), result_5 } if (97 === node.kind || ts.isSuperProperty(node.parent)) { var symbol = checker.getSymbolAtLocation(node); return symbol.valueDeclaration && [nodeEntry(symbol.valueDeclaration)] } return getReferenceEntriesForNode(position, node, program, sourceFiles, cancellationToken, { implementations: !0 }) } } function findReferencedEntries(program, cancellationToken, sourceFiles, sourceFile, position, options) { var node = ts.getTouchingPropertyName(sourceFile, position, !0); return ts.map(flattenEntries(FindAllReferences.Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options)), toReferenceEntry) } function getReferenceEntriesForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { return void 0 === options && (options = {}), void 0 === sourceFilesSet && (sourceFilesSet = ts.arrayToSet(sourceFiles, function (f) { return f.fileName })), flattenEntries(FindAllReferences.Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet)) } function flattenEntries(referenceSymbols) { return referenceSymbols && ts.flatMap(referenceSymbols, function (r) { return r.references }) } function definitionToReferencedSymbolDefinitionInfo(def, checker, originalNode) { var info = function () { switch (def.type) { case "symbol": var symbol = def.symbol, _a = getDefinitionKindAndDisplayParts(symbol, checker, originalNode), displayParts_1 = _a.displayParts, kind_1 = _a.kind, name_3 = displayParts_1.map(function (p) { return p.text }).join(""); return { node: symbol.declarations ? ts.getNameOfDeclaration(ts.first(symbol.declarations)) || ts.first(symbol.declarations) : originalNode, name: name_3, kind: kind_1, displayParts: displayParts_1 }; case "label": var node_3 = def.node; return { node: node_3, name: node_3.text, kind: "label", displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; case "keyword": var node_4 = def.node, name_4 = ts.tokenToString(node_4.kind); return { node: node_4, name: name_4, kind: "keyword", displayParts: [{ text: name_4, kind: "keyword" }] }; case "this": var node_5 = def.node, symbol = checker.getSymbolAtLocation(node_5), displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts || [ts.textPart("this")]; return { node: node_5, name: "this", kind: "var", displayParts: displayParts_2 }; case "string": var node_6 = def.node; return { node: node_6, name: node_6.text, kind: "var", displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; default: return ts.Debug.assertNever(def) } }(), node = info.node, name = info.name, kind = info.kind, displayParts = info.displayParts, sourceFile = node.getSourceFile(); return { containerKind: "", containerName: "", fileName: sourceFile.fileName, kind: kind, name: name, textSpan: getTextSpan(ts.isComputedPropertyName(node) ? node.expression : node, sourceFile), displayParts: displayParts } } function getDefinitionKindAndDisplayParts(symbol, checker, node) { var meaning = FindAllReferences.Core.getIntersectingMeaningFromDeclarations(node, symbol), enclosingDeclaration = ts.firstOrUndefined(symbol.declarations) || node, _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning), displayParts = _a.displayParts, symbolKind = _a.symbolKind; return { displayParts: displayParts, kind: symbolKind } } function toReferenceEntry(entry) { if ("span" === entry.type) return { textSpan: entry.textSpan, fileName: entry.fileName, isWriteAccess: !1, isDefinition: !1 }; var node = entry.node, isInString = entry.isInString, sourceFile = node.getSourceFile(); return { fileName: sourceFile.fileName, textSpan: getTextSpan(node, sourceFile), isWriteAccess: isWriteAccessForReference(node), isDefinition: 79 === node.kind || ts.isAnyDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node), isInString: isInString } } function toImplementationLocation(entry, checker) { if ("node" === entry.type) { var node = entry.node, sourceFile = node.getSourceFile(); return __assign({ textSpan: getTextSpan(node, sourceFile), fileName: sourceFile.fileName }, implementationKindDisplayParts(node, checker)) } var textSpan = entry.textSpan, fileName = entry.fileName; return { textSpan: textSpan, fileName: fileName, kind: "", displayParts: [] } } function implementationKindDisplayParts(node, checker) { var symbol = checker.getSymbolAtLocation(ts.isDeclaration(node) && node.name ? node.name : node); return symbol ? getDefinitionKindAndDisplayParts(symbol, checker, node) : 183 === node.kind ? { kind: "interface", displayParts: [ts.punctuationPart(19), ts.textPart("object literal"), ts.punctuationPart(20)] } : 204 === node.kind ? { kind: "local class", displayParts: [ts.punctuationPart(19), ts.textPart("anonymous local class"), ts.punctuationPart(20)] } : { kind: ts.getNodeKind(node), displayParts: [] } } function toHighlightSpan(entry) { if ("span" === entry.type) { var fileName = entry.fileName, textSpan = entry.textSpan; return { fileName: fileName, span: { textSpan: textSpan, kind: "reference" } } } var node = entry.node, isInString = entry.isInString, sourceFile = node.getSourceFile(), writeAccess = isWriteAccessForReference(node), span = { textSpan: getTextSpan(node, sourceFile), kind: writeAccess ? "writtenReference" : "reference", isInString: isInString }; return { fileName: sourceFile.fileName, span: span } } function getTextSpan(node, sourceFile) { var start = node.getStart(sourceFile), end = node.getEnd(); return 9 === node.kind && (start += 1, end -= 1), ts.createTextSpanFromBounds(start, end) } function isWriteAccessForReference(node) { return 79 === node.kind || ts.isAnyDeclarationName(node) || ts.isWriteAccess(node) } FindAllReferences.nodeEntry = nodeEntry, FindAllReferences.findReferencedSymbols = findReferencedSymbols, FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition, FindAllReferences.findReferencedEntries = findReferencedEntries, FindAllReferences.getReferenceEntriesForNode = getReferenceEntriesForNode, FindAllReferences.toHighlightSpan = toHighlightSpan }(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})) }(ts || (ts = {})), function (ts) { var FindAllReferences; !function (FindAllReferences) { var Core; !function (Core) { function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { if (void 0 === options && (options = {}), void 0 === sourceFilesSet && (sourceFilesSet = ts.arrayToSet(sourceFiles, function (f) { return f.fileName })), ts.isSourceFile(node)) { var reference = ts.GoToDefinition.getReferenceAtPosition(node, position, program); return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), !1, sourceFiles, sourceFilesSet) } if (!options.implementations) { var special = getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken); if (special) return special } var checker = program.getTypeChecker(), symbol = checker.getSymbolAtLocation(node); if (!symbol) return !options.implementations && ts.isStringLiteral(node) ? getReferencesForStringLiteral(node, sourceFiles, cancellationToken) : void 0; var moduleReferences = ts.emptyArray, moduleSourceFile = isModuleSymbol(symbol); if (moduleSourceFile) { var exportEquals = symbol.exports.get("export="); if (moduleReferences = getReferencedSymbolsForModule(program, symbol, !!exportEquals, sourceFiles, sourceFilesSet), !exportEquals || !sourceFilesSet.has(moduleSourceFile.fileName)) return moduleReferences; symbol = ts.skipAlias(exportEquals, checker), node = void 0 } return ts.concatenate(moduleReferences, getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options)) } function isModuleSymbol(symbol) { return 1536 & symbol.flags && ts.find(symbol.declarations, ts.isSourceFile) } function getReferencedSymbolsForModule(program, symbol, excludeImportTypeOfExportEquals, sourceFiles, sourceFilesSet) { ts.Debug.assert(!!symbol.valueDeclaration); for (var references = ts.mapDefined(FindAllReferences.findModuleReferences(program, sourceFiles, symbol), function (reference) { if ("import" === reference.kind) { var parent = reference.literal.parent; if (ts.isLiteralTypeNode(parent)) { var importType = ts.cast(parent.parent, ts.isImportTypeNode); if (excludeImportTypeOfExportEquals && !importType.qualifier) return } return { type: "node", node: reference.literal } } return { type: "span", fileName: reference.referencingFile.fileName, textSpan: ts.createTextSpanFromRange(reference.ref) } }), _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { case 273: break; case 238: sourceFilesSet.has(decl.getSourceFile().fileName) && references.push({ type: "node", node: decl.name }); break; default: ts.Debug.fail("Expected a module symbol to be declared by a SourceFile or ModuleDeclaration.") } } return references.length ? [{ definition: { type: "symbol", symbol: symbol }, references: references }] : ts.emptyArray } function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { if (ts.isTypeKeyword(node.kind)) return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); if (ts.isJumpStatementTarget(node)) { var labelDefinition = ts.getTargetLabel(node.parent, node.text); return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition) } return ts.isLabelOfLabeledStatement(node) ? getLabelReferencesInNode(node.parent, node) : ts.isThis(node) ? getReferencesForThisKeyword(node, sourceFiles, cancellationToken) : 97 === node.kind ? getReferencesForSuperKeyword(node) : void 0 } function getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options) { symbol = node && skipPastExportOrImportSpecifierOrUnion(symbol, node, checker) || symbol; var searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : 7, result = [], state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : 0, checker, cancellationToken, searchMeaning, options, result); if (node && 79 === node.kind) addReference(node, symbol, state), searchForImportsOfExport(node, symbol, { exportingModuleSymbol: ts.Debug.assertDefined(symbol.parent, "Expected export symbol to have a parent"), exportKind: 1 }, state); else { var search = state.createSearch(node, symbol, void 0, { allSearchSymbols: node ? populateSearchSymbolSet(symbol, node, checker, options.implementations) : [symbol] }), scope = getSymbolScope(symbol); if (scope) getReferencesInContainer(scope, scope.getSourceFile(), search, state, !(ts.isSourceFile(scope) && !ts.contains(sourceFiles, scope))); else for (var _i = 0, _a = state.sourceFiles; _i < _a.length; _i++) { var sourceFile = _a[_i]; state.cancellationToken.throwIfCancellationRequested(), searchForName(sourceFile, search, state) } } return result } function getSpecialSearchKind(node) { switch (node.kind) { case 123: return 1; case 71: if (ts.isClassLike(node.parent)) return ts.Debug.assert(node.parent.name === node), 2; default: return 0 } } function skipPastExportOrImportSpecifierOrUnion(symbol, node, checker) { var parent = node.parent; return ts.isExportSpecifier(parent) ? getLocalSymbolForExportSpecifier(node, symbol, parent, checker) : ts.isImportSpecifier(parent) && parent.propertyName === node ? checker.getImmediateAliasedSymbol(symbol) : ts.firstDefined(symbol.declarations, function (decl) { return decl.parent || ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol)), ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent) ? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name) : void 0 }) } function searchForImportsOfExport(exportLocation, exportSymbol, exportInfo, state) { var _a = state.getImportSearches(exportSymbol, exportInfo), importSearches = _a.importSearches, singleReferences = _a.singleReferences, indirectUsers = _a.indirectUsers; if (singleReferences.length) for (var addRef = state.referenceAdder(exportSymbol), _i = 0, singleReferences_1 = singleReferences; _i < singleReferences_1.length; _i++) { var singleRef = singleReferences_1[_i]; shouldAddSingleReference(singleRef, state) && addRef(singleRef) } for (var _b = 0, importSearches_1 = importSearches; _b < importSearches_1.length; _b++) { var _c = importSearches_1[_b], importLocation = _c[0], importSymbol = _c[1]; getReferencesInSourceFile(importLocation.getSourceFile(), state.createSearch(importLocation, importSymbol, 1), state) } if (indirectUsers.length) { var indirectSearch = void 0; switch (exportInfo.exportKind) { case 0: indirectSearch = state.createSearch(exportLocation, exportSymbol, 1); break; case 1: indirectSearch = state.options.isForRename ? void 0 : state.createSearch(exportLocation, exportSymbol, 1, { text: "default" }); break; case 2: }if (indirectSearch) for (var _d = 0, indirectUsers_1 = indirectUsers; _d < indirectUsers_1.length; _d++) { var indirectUser = indirectUsers_1[_d]; searchForName(indirectUser, indirectSearch, state) } } } function shouldAddSingleReference(singleRef, state) { return !!hasMatchingMeaning(singleRef, state) && (!state.options.isForRename || !!ts.isIdentifier(singleRef) && !((ts.isExportSpecifier(singleRef.parent) || ts.isImportSpecifier(singleRef.parent)) && "default" === singleRef.escapedText)) } function searchForImportedSymbol(symbol, state) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i], exportingFile = declaration.getSourceFile(); getReferencesInSourceFile(exportingFile, state.createSearch(declaration, symbol, 0), state, state.includesSourceFile(exportingFile)) } } function searchForName(sourceFile, search, state) { void 0 !== ts.getNameTable(sourceFile).get(search.escapedText) && getReferencesInSourceFile(sourceFile, search, state) } function getPropertySymbolOfDestructuringAssignment(location, checker) { return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && checker.getPropertySymbolOfDestructuringAssignment(location) } function getObjectBindingElementWithoutPropertyName(symbol) { var bindingElement = ts.getDeclarationOfKind(symbol, 181); if (bindingElement && 179 === bindingElement.parent.kind && ts.isIdentifier(bindingElement.name) && !bindingElement.propertyName) return bindingElement } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { var bindingElement = getObjectBindingElementWithoutPropertyName(symbol); return bindingElement && ts.getPropertySymbolFromBindingElement(checker, bindingElement) } function getSymbolScope(symbol) { var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; if (valueDeclaration && (191 === valueDeclaration.kind || 204 === valueDeclaration.kind)) return valueDeclaration; if (declarations) if (8196 & flags) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8) }); if (privateDeclaration) return ts.getAncestor(privateDeclaration, 234) } else if (!getObjectBindingElementWithoutPropertyName(symbol)) { var exposedByParent = parent && !(262144 & symbol.flags); if (!exposedByParent || 1536 & parent.flags && ts.isExternalModuleSymbol(parent) && !parent.globalExports) { for (var scope, _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { var declaration = declarations_10[_i], container = ts.getContainerNode(declaration); if (scope && scope !== container) return; if (!container || 273 === container.kind && !ts.isExternalOrCommonJsModule(container)) return; scope = container } return exposedByParent ? scope.getSourceFile() : scope } } } function isSymbolReferencedInFile(definition, checker, sourceFile) { return eachSymbolReferenceInFile(definition, checker, sourceFile, function () { return !0 }) || !1 } function eachSymbolReferenceInFile(definition, checker, sourceFile, cb) { var symbol = checker.getSymbolAtLocation(definition); if (symbol) for (var _i = 0, _a = getPossibleSymbolReferenceNodes(sourceFile, symbol.name); _i < _a.length; _i++) { var token = _a[_i]; if (ts.isIdentifier(token) && token !== definition && token.escapedText === definition.escapedText) { var referenceSymbol = checker.getSymbolAtLocation(token); if (referenceSymbol === symbol || checker.getShorthandAssignmentValueSymbol(token.parent) === symbol || ts.isExportSpecifier(token.parent) && getLocalSymbolForExportSpecifier(token, referenceSymbol, token.parent, checker) === symbol) { var res = cb(token); if (res) return res } } } } function getPossibleSymbolReferenceNodes(sourceFile, symbolName, container) { return void 0 === container && (container = sourceFile), getPossibleSymbolReferencePositions(sourceFile, symbolName, container).map(function (pos) { return ts.getTouchingPropertyName(sourceFile, pos, !0) }) } function getPossibleSymbolReferencePositions(sourceFile, symbolName, container) { void 0 === container && (container = sourceFile); var positions = []; if (!symbolName || !symbolName.length) return positions; for (var text = sourceFile.text, sourceLength = text.length, symbolNameLength = symbolName.length, position = text.indexOf(symbolName, container.pos); position >= 0 && !(position > container.end);) { var endPosition = position + symbolNameLength; 0 !== position && ts.isIdentifierPart(text.charCodeAt(position - 1), 6) || endPosition !== sourceLength && ts.isIdentifierPart(text.charCodeAt(endPosition), 6) || positions.push(position), position = text.indexOf(symbolName, position + symbolNameLength + 1) } return positions } function getLabelReferencesInNode(container, targetLabel) { var sourceFile = container.getSourceFile(), labelName = targetLabel.text, references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), function (node) { return node === targetLabel || ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel ? FindAllReferences.nodeEntry(node) : void 0 }); return [{ definition: { type: "label", node: targetLabel }, references: references }] } function isValidReferencePosition(node, searchSymbolName) { switch (node.kind) { case 71: return node.text.length === searchSymbolName.length; case 9: var str = node; return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node)) && str.text.length === searchSymbolName.length; case 8: return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length; case 79: return "default".length === searchSymbolName.length; default: return !1 } } function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { var references = ts.flatMap(sourceFiles, function (sourceFile) { return cancellationToken.throwIfCancellationRequested(), ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, ts.tokenToString(keywordKind), sourceFile), function (referenceLocation) { return referenceLocation.kind === keywordKind ? FindAllReferences.nodeEntry(referenceLocation) : void 0 }) }); return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : void 0 } function getReferencesInSourceFile(sourceFile, search, state, addReferencesHere) { return void 0 === addReferencesHere && (addReferencesHere = !0), state.cancellationToken.throwIfCancellationRequested(), getReferencesInContainer(sourceFile, sourceFile, search, state, addReferencesHere) } function getReferencesInContainer(container, sourceFile, search, state, addReferencesHere) { if (state.markSearchedSymbols(sourceFile, search.allSearchSymbols)) for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container); _i < _a.length; _i++) { var position = _a[_i]; getReferencesAtLocation(sourceFile, position, search, state, addReferencesHere) } } function hasMatchingMeaning(referenceLocation, state) { return !!(ts.getMeaningFromLocation(referenceLocation) & state.searchMeaning) } function getReferencesAtLocation(sourceFile, position, search, state, addReferencesHere) { var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, !0); if (!isValidReferencePosition(referenceLocation, search.text)) return void (!state.options.implementations && (state.options.findInStrings && ts.isInString(sourceFile, position) || state.options.findInComments && ts.isInNonReferenceComment(sourceFile, position)) && state.addStringOrCommentReference(sourceFile.fileName, ts.createTextSpan(position, search.text.length))); if (hasMatchingMeaning(referenceLocation, state)) { var referenceSymbol = state.checker.getSymbolAtLocation(referenceLocation); if (referenceSymbol) { var parent = referenceLocation.parent; if (!ts.isImportSpecifier(parent) || parent.propertyName !== referenceLocation) { if (ts.isExportSpecifier(parent)) return ts.Debug.assert(71 === referenceLocation.kind), void getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state, addReferencesHere); var relatedSymbol = getRelatedSymbol(search, referenceSymbol, referenceLocation, state); if (!relatedSymbol) return void getReferenceForShorthandProperty(referenceSymbol, search, state); switch (state.specialSearchKind) { case 0: addReferencesHere && addReference(referenceLocation, relatedSymbol, state); break; case 1: addConstructorReferences(referenceLocation, sourceFile, search, state); break; case 2: addClassStaticThisReferences(referenceLocation, search, state); break; default: ts.Debug.assertNever(state.specialSearchKind) }getImportOrExportReferences(referenceLocation, referenceSymbol, search, state) } } } } function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state, addReferencesHere) { function addRef() { addReferencesHere && addReference(referenceLocation, localSymbol, state) } var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name, exportDeclaration = parent.parent, localSymbol = getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, state.checker); if (search.includes(localSymbol)) { if (propertyName ? referenceLocation === propertyName ? (exportDeclaration.moduleSpecifier || addRef(), addReferencesHere && !state.options.isForRename && state.markSeenReExportRHS(name) && addReference(name, referenceSymbol, state)) : state.markSeenReExportRHS(referenceLocation) && addRef() : state.options.isForRename && "default" === name.escapedText || addRef(), referenceLocation !== propertyName || !state.options.isForRename) { var exportKind = 79 === referenceLocation.originalKeywordKind ? 1 : 0, exportInfo = FindAllReferences.getExportInfo(referenceSymbol, exportKind, state.checker); ts.Debug.assert(!!exportInfo), searchForImportsOfExport(referenceLocation, referenceSymbol, exportInfo, state) } if (1 !== search.comingFrom && exportDeclaration.moduleSpecifier && !propertyName) { var imported = state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); imported && searchForImportedSymbol(imported, state) } } } function getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, checker) { return isExportSpecifierAlias(referenceLocation, exportSpecifier) && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) || referenceSymbol } function isExportSpecifierAlias(referenceLocation, exportSpecifier) { var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; return ts.Debug.assert(propertyName === referenceLocation || name === referenceLocation), propertyName ? propertyName === referenceLocation : !parent.parent.moduleSpecifier } function getImportOrExportReferences(referenceLocation, referenceSymbol, search, state) { var importOrExport = FindAllReferences.getImportOrExportSymbol(referenceLocation, referenceSymbol, state.checker, 1 === search.comingFrom); if (importOrExport) { var symbol = importOrExport.symbol; 0 === importOrExport.kind ? state.options.isForRename && !importOrExport.isNamedImport || searchForImportedSymbol(symbol, state) : searchForImportsOfExport(referenceLocation, symbol, importOrExport.exportInfo, state) } } function getReferenceForShorthandProperty(_a, search, state) { var flags = _a.flags, valueDeclaration = _a.valueDeclaration, shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration); 33554432 & flags || !search.includes(shorthandValueSymbol) || addReference(ts.getNameOfDeclaration(valueDeclaration), shorthandValueSymbol, state) } function addReference(referenceLocation, relatedSymbol, state) { var addRef = state.referenceAdder(relatedSymbol); state.options.implementations ? addImplementationReferences(referenceLocation, addRef, state) : addRef(referenceLocation) } function addConstructorReferences(referenceLocation, sourceFile, search, state) { ts.isNewExpressionTarget(referenceLocation) && addReference(referenceLocation, search.symbol, state); var pusher = function () { return state.referenceAdder(search.symbol) }; if (ts.isClassLike(referenceLocation.parent)) ts.Debug.assert(79 === referenceLocation.kind || referenceLocation.parent.name === referenceLocation), findOwnConstructorReferences(search.symbol, sourceFile, pusher()); else { var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); classExtending && findSuperConstructorAccesses(classExtending, pusher()) } } function addClassStaticThisReferences(referenceLocation, search, state) { addReference(referenceLocation, search.symbol, state); var classLike = referenceLocation.parent; if (!state.options.isForRename && ts.isClassLike(classLike)) { ts.Debug.assert(classLike.name === referenceLocation); for (var addRef = state.referenceAdder(search.symbol), _i = 0, _a = classLike.members; _i < _a.length; _i++) { var member = _a[_i]; ts.isMethodOrAccessor(member) && ts.hasModifier(member, 32) && member.body.forEachChild(function cb(node) { 99 === node.kind ? addRef(node) : ts.isFunctionLike(node) || node.forEachChild(cb) }) } } } function findOwnConstructorReferences(classSymbol, sourceFile, addNode) { for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { var decl = _a[_i], ctrKeyword = ts.findChildOfKind(decl, 123, sourceFile); ts.Debug.assert(154 === decl.kind && !!ctrKeyword), addNode(ctrKeyword) } classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; if (decl && 153 === decl.kind) { var body = decl.body; body && forEachDescendantOfKind(body, 99, function (thisKeyword) { ts.isNewExpressionTarget(thisKeyword) && addNode(thisKeyword) }) } }) } function findSuperConstructorAccesses(cls, addNode) { var symbol = cls.symbol, ctr = symbol.members.get("__constructor"); if (ctr) for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { var decl = _a[_i]; ts.Debug.assert(154 === decl.kind); var body = decl.body; body && forEachDescendantOfKind(body, 97, function (node) { ts.isCallExpressionTarget(node) && addNode(node) }) } } function addImplementationReferences(refNode, addReference, state) { function addIfImplementation(e) { isImplementationExpression(e) && addReference(e) } if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) return void addReference(refNode.parent); if (71 === refNode.kind) { 270 === refNode.parent.kind && getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); var containingClass = getContainingClassIfInHeritageClause(refNode); if (containingClass) return void addReference(containingClass); var typeNode = ts.findAncestor(refNode, function (a) { return !ts.isQualifiedName(a.parent) && !ts.isTypeNode(a.parent) && !ts.isTypeElement(a.parent) }), typeHavingNode = typeNode.parent; if (ts.hasType(typeHavingNode) && typeHavingNode.type === typeNode && state.markSeenContainingTypeReference(typeHavingNode)) if (ts.hasInitializer(typeHavingNode)) addIfImplementation(typeHavingNode.initializer); else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; 212 === body.kind ? ts.forEachReturnStatement(body, function (returnStatement) { returnStatement.expression && addIfImplementation(returnStatement.expression) }) : addIfImplementation(body) } else ts.isAssertionExpression(typeHavingNode) && addIfImplementation(typeHavingNode.expression) } } function getContainingClassIfInHeritageClause(node) { return ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) ? getContainingClassIfInHeritageClause(node.parent) : ts.isExpressionWithTypeArguments(node) ? ts.tryCast(node.parent.parent, ts.isClassLike) : void 0; } function isImplementationExpression(node) { switch (node.kind) { case 190: return isImplementationExpression(node.expression); case 192: case 191: case 183: case 204: case 182: return !0; default: return !1 } } function explicitlyInheritsFrom(symbol, parent, cachedResults, checker) { if (symbol === parent) return !0; var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent), cached = cachedResults.get(key); if (void 0 !== cached) return cached; cachedResults.set(key, !1); var inherits = symbol.declarations.some(function (declaration) { return ts.getAllSuperTypeNodes(declaration).some(function (typeReference) { var type = checker.getTypeAtLocation(typeReference); return !!type && !!type.symbol && explicitlyInheritsFrom(type.symbol, parent, cachedResults, checker) }) }); return cachedResults.set(key, inherits), inherits } function getReferencesForSuperKeyword(superKeyword) { var searchSpaceNode = ts.getSuperContainer(superKeyword, !1); if (searchSpaceNode) { var staticFlag = 32; switch (searchSpaceNode.kind) { case 151: case 150: case 153: case 152: case 154: case 155: case 156: staticFlag &= ts.getModifierFlags(searchSpaceNode), searchSpaceNode = searchSpaceNode.parent; break; default: return }var sourceFile = searchSpaceNode.getSourceFile(), references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function (node) { if (97 === node.kind) { var container = ts.getSuperContainer(node, !1); return container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol ? FindAllReferences.nodeEntry(node) : void 0 } }); return [{ definition: { type: "symbol", symbol: searchSpaceNode.symbol }, references: references }] } } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, !1), staticFlag = 32; switch (searchSpaceNode.kind) { case 153: case 152: if (ts.isObjectLiteralMethod(searchSpaceNode)) break; case 151: case 150: case 154: case 155: case 156: staticFlag &= ts.getModifierFlags(searchSpaceNode), searchSpaceNode = searchSpaceNode.parent; break; case 273: if (ts.isExternalModule(searchSpaceNode)) return; case 233: case 191: break; default: return }var references = ts.flatMap(273 === searchSpaceNode.kind ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { return cancellationToken.throwIfCancellationRequested(), getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) return !1; var container = ts.getThisContainer(node, !1); switch (searchSpaceNode.kind) { case 191: case 233: return searchSpaceNode.symbol === container.symbol; case 153: case 152: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; case 204: case 234: return container.parent && searchSpaceNode.symbol === container.parent.symbol && (32 & ts.getModifierFlags(container)) === staticFlag; case 273: return 273 === container.kind && !ts.isExternalModule(container) } }) }).map(function (n) { return FindAllReferences.nodeEntry(n) }); return [{ definition: { type: "this", node: thisOrSuperKeyword }, references: references }] } function getReferencesForStringLiteral(node, sourceFiles, cancellationToken) { var references = ts.flatMap(sourceFiles, function (sourceFile) { return cancellationToken.throwIfCancellationRequested(), ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, node.text), function (ref) { return ts.isStringLiteral(ref) && ref.text === node.text ? FindAllReferences.nodeEntry(ref, !0) : void 0 }) }); return [{ definition: { type: "string", node: node }, references: references }] } function populateSearchSymbolSet(symbol, location, checker, implementations) { var result = []; return forEachRelatedSymbol(symbol, location, checker, function (sym, root, base) { result.push(base || root || sym) }, function () { return !implementations }), result } function forEachRelatedSymbol(symbol, location, checker, cbSymbol, allowBaseTypes) { function fromRoot(sym) { return ts.firstDefined(checker.getRootSymbols(sym), function (rootSymbol) { return cbSymbol(sym, rootSymbol) || (rootSymbol.parent && 96 & rootSymbol.parent.flags && allowBaseTypes(rootSymbol) ? getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, function (base) { return cbSymbol(sym, rootSymbol, base) }) : void 0) }) } var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { var res_1 = ts.firstDefined(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), fromRoot); if (res_1) return res_1; var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker), res1 = propertySymbol && cbSymbol(propertySymbol); if (res1) return res1; var shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent), res2 = shorthandValueSymbol && cbSymbol(shorthandValueSymbol); if (res2) return res2 } var res = fromRoot(symbol); if (res) return res; if (symbol.valueDeclaration && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { var paramProps = checker.getSymbolsOfParameterPropertyDeclaration(ts.cast(symbol.valueDeclaration, ts.isParameter), symbol.name); return ts.Debug.assert(2 === paramProps.length && !!(1 & paramProps[0].flags) && !!(4 & paramProps[1].flags)), fromRoot(1 & symbol.flags ? paramProps[1] : paramProps[0]) } var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); return bindingElementPropertySymbol && fromRoot(bindingElementPropertySymbol) } function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, cb) { function recur(symbol) { if (96 & symbol.flags && ts.addToSeen(seen, ts.getSymbolId(symbol))) return ts.firstDefined(symbol.declarations, function (declaration) { return ts.firstDefined(ts.getAllSuperTypeNodes(declaration), function (typeReference) { var type = checker.getTypeAtLocation(typeReference), propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName); return propertySymbol && (ts.firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol)) }) }) } var seen = ts.createMap(); return recur(symbol) } function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) { var checker = state.checker; return forEachRelatedSymbol(referenceSymbol, referenceLocation, checker, function (sym, rootSymbol, baseSymbol) { return search.includes(baseSymbol || rootSymbol || sym) ? !rootSymbol || 6 & ts.getCheckFlags(sym) ? sym : rootSymbol : void 0 }, function (rootSymbol) { return !(search.parents && !search.parents.some(function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker) })) }) } function getPropertySymbolsFromContextualType(node, checker) { var contextualType = checker.getContextualType(node.parent), name = ts.getNameFromPropertyName(node.name), symbol = contextualType && name && contextualType.getProperty(name); return symbol ? [symbol] : contextualType && contextualType.isUnion() ? ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name) }) : ts.emptyArray } function getIntersectingMeaningFromDeclarations(node, symbol) { var meaning = ts.getMeaningFromLocation(node), declarations = symbol.declarations; if (declarations) { var lastIterationMeaning = void 0; do { lastIterationMeaning = meaning; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i], declarationMeaning = ts.getMeaningFromDeclaration(declaration); declarationMeaning & meaning && (meaning |= declarationMeaning) } } while (meaning !== lastIterationMeaning) } return meaning } function isImplementation(node) { return !!(4194304 & node.flags) || (ts.isVariableLike(node) ? ts.hasInitializer(node) : ts.isFunctionLikeDeclaration(node) ? !!node.body : ts.isClassLike(node) || ts.isModuleOrEnumDeclaration(node)) } function getReferenceEntriesForShorthandPropertyAssignment(node, checker, addReference) { var refSymbol = checker.getSymbolAtLocation(node), shorthandSymbol = checker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); if (shorthandSymbol) for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { var declaration = _a[_i]; 1 & ts.getMeaningFromDeclaration(declaration) && addReference(declaration) } } function forEachDescendantOfKind(node, kind, action) { ts.forEachChild(node, function (child) { child.kind === kind && action(child), forEachDescendantOfKind(child, kind, action) }) } function tryGetClassByExtendingIdentifier(node) { return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent) } function getParentSymbolsOfPropertyAccess(location, symbol, checker) { var propertyAccessExpression = ts.isRightSideOfPropertyAccess(location) ? location.parent : void 0, lhsType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression), res = ts.mapDefined(lhsType && (lhsType.isUnionOrIntersection() ? lhsType.types : lhsType.symbol === symbol.parent ? void 0 : [lhsType]), function (t) { return t.symbol && 96 & t.symbol.flags ? t.symbol : void 0 }); return 0 === res.length ? void 0 : res } Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode; var SpecialSearchKind; !function (SpecialSearchKind) { SpecialSearchKind[SpecialSearchKind.None = 0] = "None", SpecialSearchKind[SpecialSearchKind.Constructor = 1] = "Constructor", SpecialSearchKind[SpecialSearchKind.Class = 2] = "Class" }(SpecialSearchKind || (SpecialSearchKind = {})); var State = function () { function State(sourceFiles, sourceFilesSet, specialSearchKind, checker, cancellationToken, searchMeaning, options, result) { this.sourceFiles = sourceFiles, this.sourceFilesSet = sourceFilesSet, this.specialSearchKind = specialSearchKind, this.checker = checker, this.cancellationToken = cancellationToken, this.searchMeaning = searchMeaning, this.options = options, this.result = result, this.inheritsFromCache = ts.createMap(), this.markSeenContainingTypeReference = ts.nodeSeenTracker(), this.markSeenReExportRHS = ts.nodeSeenTracker(), this.symbolIdToReferences = [], this.sourceFileToSeenSymbols = [] } return State.prototype.includesSourceFile = function (sourceFile) { return this.sourceFilesSet.has(sourceFile.fileName) }, State.prototype.getImportSearches = function (exportSymbol, exportInfo) { return this.importTracker || (this.importTracker = FindAllReferences.createImportTracker(this.sourceFiles, this.sourceFilesSet, this.checker, this.cancellationToken)), this.importTracker(exportSymbol, exportInfo, this.options.isForRename) }, State.prototype.createSearch = function (location, symbol, comingFrom, searchOptions) { void 0 === searchOptions && (searchOptions = {}); var _a = searchOptions.text, text = void 0 === _a ? ts.stripQuotes(ts.unescapeLeadingUnderscores((ts.getLocalSymbolForExportDefault(symbol) || symbol).escapedName)) : _a, _b = searchOptions.allSearchSymbols, allSearchSymbols = void 0 === _b ? [symbol] : _b, escapedText = ts.escapeLeadingUnderscores(text), parents = this.options.implementations && location && getParentSymbolsOfPropertyAccess(location, symbol, this.checker); return { symbol: symbol, comingFrom: comingFrom, text: text, escapedText: escapedText, parents: parents, allSearchSymbols: allSearchSymbols, includes: function (sym) { return ts.contains(allSearchSymbols, sym) } } }, State.prototype.referenceAdder = function (searchSymbol) { var symbolId = ts.getSymbolId(searchSymbol), references = this.symbolIdToReferences[symbolId]; return references || (references = this.symbolIdToReferences[symbolId] = [], this.result.push({ definition: { type: "symbol", symbol: searchSymbol }, references: references })), function (node) { return references.push(FindAllReferences.nodeEntry(node)) } }, State.prototype.addStringOrCommentReference = function (fileName, textSpan) { this.result.push({ definition: void 0, references: [{ type: "span", fileName: fileName, textSpan: textSpan }] }) }, State.prototype.markSearchedSymbols = function (sourceFile, symbols) { for (var sourceId = ts.getNodeId(sourceFile), seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap()), anyNewSymbols = !1, _i = 0, symbols_5 = symbols; _i < symbols_5.length; _i++) { var sym = symbols_5[_i]; anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols } return anyNewSymbols }, State }(); Core.isSymbolReferencedInFile = isSymbolReferencedInFile, Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile, Core.getIntersectingMeaningFromDeclarations = getIntersectingMeaningFromDeclarations, Core.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment }(Core = FindAllReferences.Core || (FindAllReferences.Core = {})) }(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})) }(ts || (ts = {})); var ts; !function (ts) { function getEditsForFileRename(program, oldFileOrDirPath, newFileOrDirPath, host, formatContext, preferences) { var useCaseSensitiveFileNames = ts.hostUsesCaseSensitiveFileNames(host), getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames), oldToNew = getPathUpdater(oldFileOrDirPath, newFileOrDirPath, getCanonicalFileName), newToOld = getPathUpdater(newFileOrDirPath, oldFileOrDirPath, getCanonicalFileName); return ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext }, function (changeTracker) { updateTsconfigFiles(program, changeTracker, oldToNew, newFileOrDirPath, host.getCurrentDirectory(), useCaseSensitiveFileNames), updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName, preferences) }) } function getPathUpdater(oldFileOrDirPath, newFileOrDirPath, getCanonicalFileName) { var canonicalOldPath = getCanonicalFileName(oldFileOrDirPath); return function (path) { var canonicalPath = getCanonicalFileName(path); if (canonicalPath === canonicalOldPath) return newFileOrDirPath; var suffix = ts.tryRemoveDirectoryPrefix(canonicalPath, canonicalOldPath); return void 0 === suffix ? void 0 : newFileOrDirPath + "/" + suffix } } function updateTsconfigFiles(program, changeTracker, oldToNew, newFileOrDirPath, currentDirectory, useCaseSensitiveFileNames) { function updatePaths(property) { for (var elements = ts.isArrayLiteralExpression(property.initializer) ? property.initializer.elements : [property.initializer], foundExactMatch = !1, _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var element = elements_5[_i]; foundExactMatch = tryUpdateString(element) || foundExactMatch } return foundExactMatch } function tryUpdateString(element) { if (!ts.isStringLiteral(element)) return !1; var elementFileName = combinePathsSafe(configDir, element.text), updated = oldToNew(elementFileName); return void 0 !== updated && (changeTracker.replaceRangeWithText(configFile, createStringRange(element, configFile), relativePath(updated)), !0) } function relativePath(path) { return ts.getRelativePathFromDirectory(configDir, path, !useCaseSensitiveFileNames) } var configFile = program.getCompilerOptions().configFile; if (configFile) { var configDir = ts.getDirectoryPath(configFile.fileName), jsonObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); jsonObjectLiteral && forEachProperty(jsonObjectLiteral, function (property, propertyName) { switch (propertyName) { case "files": case "include": case "exclude": var foundExactMatch = updatePaths(property); if (!foundExactMatch && "include" === propertyName && ts.isArrayLiteralExpression(property.initializer)) { var includes = ts.mapDefined(property.initializer.elements, function (e) { return ts.isStringLiteral(e) ? e.text : void 0 }), matchers = ts.getFileMatcherPatterns(configDir, [], includes, useCaseSensitiveFileNames, currentDirectory); ts.getRegexFromPattern(ts.Debug.assertDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(newFileOrDirPath) || changeTracker.insertNodeAfter(configFile, ts.last(property.initializer.elements), ts.createStringLiteral(relativePath(newFileOrDirPath))) } break; case "compilerOptions": forEachProperty(property.initializer, function (property, propertyName) { var option = ts.getOptionFromName(propertyName); option && (option.isFilePath || "list" === option.type && option.element.isFilePath) ? updatePaths(property) : "paths" === propertyName && forEachProperty(property.initializer, function (pathsProperty) { if (ts.isArrayLiteralExpression(pathsProperty.initializer)) for (var _i = 0, _a = pathsProperty.initializer.elements; _i < _a.length; _i++) { var e = _a[_i]; tryUpdateString(e) } }) }) } }) } } function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName, preferences) { for (var _loop_14 = function (sourceFile) { var newImportFromPath = oldToNew(sourceFile.fileName) || sourceFile.fileName, newImportFromDirectory = ts.getDirectoryPath(newImportFromPath), oldFromNew = newToOld(sourceFile.fileName), oldImportFromPath = oldFromNew || sourceFile.fileName, oldImportFromDirectory = ts.getDirectoryPath(oldImportFromPath); updateImportsWorker(sourceFile, changeTracker, function (referenceText) { if (ts.pathIsRelative(referenceText)) { var oldAbsolute = combinePathsSafe(oldImportFromDirectory, referenceText), newAbsolute = oldToNew(oldAbsolute); return void 0 === newAbsolute ? void 0 : ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(newImportFromDirectory, newAbsolute, getCanonicalFileName)) } }, function (importLiteral) { var toImport = void 0 !== oldFromNew ? getSourceFileToImportFromResolved(ts.resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, program) : getSourceFileToImport(importLiteral, sourceFile, program, host, oldToNew); return void 0 === toImport ? void 0 : ts.moduleSpecifiers.getModuleSpecifier(program.getCompilerOptions(), sourceFile, newImportFromPath, toImport, host, preferences) }) }, _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; _loop_14(sourceFile) } } function combineNormal(pathA, pathB) { return ts.normalizePath(ts.combinePaths(pathA, pathB)) } function combinePathsSafe(pathA, pathB) { return ts.ensurePathIsNonModuleName(combineNormal(pathA, pathB)) } function getSourceFileToImport(importLiteral, importingSourceFile, program, host, oldToNew) { var symbol = program.getTypeChecker().getSymbolAtLocation(importLiteral); if (symbol) { if (symbol.declarations.some(function (d) { return ts.isAmbientModule(d) })) return; var oldFileName = ts.find(symbol.declarations, ts.isSourceFile).fileName; return oldToNew(oldFileName) || oldFileName } var resolved = host.resolveModuleNames ? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName) : program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName); return getSourceFileToImportFromResolved(resolved, oldToNew, program) } function getSourceFileToImportFromResolved(resolved, oldToNew, program) { function getIfInProgram(oldLocation) { var newLocation = oldToNew(oldLocation); return program.getSourceFile(oldLocation) || void 0 !== newLocation && program.getSourceFile(newLocation) ? newLocation || oldLocation : void 0 } return resolved && (resolved.resolvedModule && getIfInProgram(resolved.resolvedModule.resolvedFileName) || ts.firstDefined(resolved.failedLookupLocations, getIfInProgram)) } function updateImportsWorker(sourceFile, changeTracker, updateRef, updateImport) { for (var _i = 0, _a = sourceFile.referencedFiles; _i < _a.length; _i++) { var ref = _a[_i], updated = updateRef(ref.fileName); void 0 !== updated && updated !== sourceFile.text.slice(ref.pos, ref.end) && changeTracker.replaceRangeWithText(sourceFile, ref, updated) } for (var _b = 0, _c = sourceFile.imports; _b < _c.length; _b++) { var importStringLiteral = _c[_b], updated = updateImport(importStringLiteral); void 0 !== updated && updated !== importStringLiteral.text && changeTracker.replaceRangeWithText(sourceFile, createStringRange(importStringLiteral, sourceFile), updated) } } function createStringRange(node, sourceFile) { return ts.createTextRange(node.getStart(sourceFile) + 1, node.end - 1) } function forEachProperty(objectLiteral, cb) { if (ts.isObjectLiteralExpression(objectLiteral)) for (var _i = 0, _a = objectLiteral.properties; _i < _a.length; _i++) { var property = _a[_i]; ts.isPropertyAssignment(property) && ts.isStringLiteral(property.name) && cb(property, property.name.text) } } ts.getEditsForFileRename = getEditsForFileRename }(ts || (ts = {})); var ts; !function (ts) { var GoToDefinition; !function (GoToDefinition) { function getDefinitionAtPosition(program, sourceFile, position) { var reference = getReferenceAtPosition(sourceFile, position, program); if (reference) return [getDefinitionInfoForFileReference(reference.fileName, reference.file.fileName)]; var node = ts.getTouchingPropertyName(sourceFile, position, !0); if (node !== sourceFile) { if (ts.isJumpStatementTarget(node)) { var label = ts.getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfoFromName(label, "label", node.text, void 0)] : void 0 } var typeChecker = program.getTypeChecker(), symbol = getSymbol(node, typeChecker); if (!symbol) return getDefinitionInfoForIndexSignatures(node, typeChecker); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); if (calledDeclaration) { var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration); return typeChecker.getRootSymbols(symbol).some(function (s) { return calledDeclaration.symbol === s || calledDeclaration.symbol.parent === s }) || symbol.declarations.some(function (d) { return ts.isVariableDeclaration(d) && d.initializer && ts.isRequireCall(d.initializer, !1) }) ? [sigInfo] : [sigInfo].concat(getDefinitionFromSymbol(typeChecker, symbol, node)) } if (270 === node.parent.kind) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); return shorthandSymbol_1 ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node) }) : [] } if (ts.isPropertyName(node) && ts.isBindingElement(node.parent) && ts.isObjectBindingPattern(node.parent.parent) && node === (node.parent.propertyName || node.parent.name)) { var type = typeChecker.getTypeAtLocation(node.parent.parent); if (type) { var propSymbols = ts.getPropertySymbolsFromType(type, node); if (propSymbols) return ts.flatMap(propSymbols, function (propSymbol) { return getDefinitionFromSymbol(typeChecker, propSymbol, node) }) } } var element = ts.getContainingObjectLiteralElement(node); return element && typeChecker.getContextualType(element.parent) ? ts.flatMap(ts.getPropertySymbolsFromContextualType(typeChecker, element), function (propertySymbol) { return getDefinitionFromSymbol(typeChecker, propertySymbol, node) }) : getDefinitionFromSymbol(typeChecker, symbol, node) } } function getReferenceAtPosition(sourceFile, position, program) { var referencePath = findReferenceInPosition(sourceFile.referencedFiles, position); if (referencePath) { var file_16 = ts.tryResolveScriptReference(program, sourceFile, referencePath); return file_16 && { fileName: referencePath.fileName, file: file_16 } } var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { var reference = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName), file_17 = reference && program.getSourceFile(reference.resolvedFileName); return file_17 && { fileName: typeReferenceDirective.fileName, file: file_17 } } } function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position, !0); if (node !== sourceFile) { var symbol = typeChecker.getSymbolAtLocation(node), type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, node); if (type) return !type.isUnion() || 16 & type.flags ? type.symbol && getDefinitionFromSymbol(typeChecker, type.symbol, node) : ts.flatMap(type.types, function (t) { return t.symbol && getDefinitionFromSymbol(typeChecker, t.symbol, node) }) } } function getDefinitionAndBoundSpan(program, sourceFile, position) { var definitions = getDefinitionAtPosition(program, sourceFile, position); if (definitions && 0 !== definitions.length) { var comment = findReferenceInPosition(sourceFile.referencedFiles, position) || findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (comment) return { definitions: definitions, textSpan: ts.createTextSpanFromRange(comment) }; var node = ts.getTouchingPropertyName(sourceFile, position, !0), textSpan = ts.createTextSpan(node.getStart(), node.getWidth()); return { definitions: definitions, textSpan: textSpan } } } function getDefinitionInfoForIndexSignatures(node, checker) { if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { var type = checker.getTypeAtLocation(node.parent.expression); return ts.mapDefined(type.isUnionOrIntersection() ? type.types : [type], function (nonUnionType) { var info = checker.getIndexInfoOfType(nonUnionType, 0); return info && info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration) }) } } function getSymbol(node, checker) { var symbol = checker.getSymbolAtLocation(node); if (symbol && 2097152 & symbol.flags && shouldSkipAlias(node, symbol.declarations[0])) { var aliased = checker.getAliasedSymbol(symbol); if (aliased.declarations) return aliased } return symbol } function shouldSkipAlias(node, declaration) { if (71 !== node.kind) return !1; if (node.parent === declaration) return !0; switch (declaration.kind) { case 244: case 242: return !0; case 247: return 246 === declaration.parent.kind; default: return !1 } } function getDefinitionFromSymbol(typeChecker, symbol, node) { function getConstructSignatureDefinition() { if (32 & symbol.flags && (ts.isNewExpressionTarget(node) || 123 === node.kind)) { var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, !0) } } function getCallSignatureDefinition() { return ts.isCallExpressionTarget(node) || ts.isNewExpressionTarget(node) || ts.isNameOfFunctionDeclaration(node) ? getSignatureDefinition(symbol.declarations, !1) : void 0 } function getSignatureDefinition(signatureDeclarations, selectConstructors) { if (signatureDeclarations) { var declarations = signatureDeclarations.filter(selectConstructors ? ts.isConstructorDeclaration : ts.isFunctionLike); return declarations.length ? [createDefinitionInfo(ts.find(declarations, function (d) { return !!d.body }) || ts.last(declarations), typeChecker, symbol, node)] : void 0 } } return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(symbol.declarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node) }) } function createDefinitionInfo(declaration, checker, symbol, node) { var symbolName = checker.symbolToString(symbol), symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node), containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : ""; return createDefinitionInfoFromName(declaration, symbolKind, symbolName, containerName) } function createDefinitionInfoFromName(declaration, symbolKind, symbolName, containerName) { var name = ts.getNameOfDeclaration(declaration) || declaration, sourceFile = name.getSourceFile(); return { fileName: sourceFile.fileName, textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: void 0, containerName: containerName } } function createDefinitionFromSignatureDeclaration(typeChecker, decl) { return createDefinitionInfo(decl, typeChecker, decl.symbol, decl) } function findReferenceInPosition(refs, pos) { return ts.find(refs, function (ref) { return ref.pos <= pos && pos <= ref.end }) } function getDefinitionInfoForFileReference(name, targetFileName) { return { fileName: targetFileName, textSpan: ts.createTextSpanFromBounds(0, 0), kind: "script", name: name, containerName: void 0, containerKind: void 0 } } function getAncestorCallLikeExpression(node) { var target = climbPastManyPropertyAccesses(node), callLike = target.parent; return callLike && ts.isCallLikeExpression(callLike) && ts.getInvokedExpression(callLike) === target && callLike } function climbPastManyPropertyAccesses(node) { return ts.isRightSideOfPropertyAccess(node) ? climbPastManyPropertyAccesses(node.parent) : node } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node), signature = callLike && typeChecker.getResolvedSignature(callLike); return ts.tryCast(signature && signature.declaration, function (d) { return ts.isFunctionLike(d) && !ts.isFunctionTypeNode(d) }) } GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition, GoToDefinition.getReferenceAtPosition = getReferenceAtPosition, GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition, GoToDefinition.getDefinitionAndBoundSpan = getDefinitionAndBoundSpan, GoToDefinition.findReferenceInPosition = findReferenceInPosition }(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})) }(ts || (ts = {})); var ts; !function (ts) { var JsDoc; !function (JsDoc) { function getJsDocCommentsFromDeclarations(declarations) { var documentationComment = []; return forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var comment = _a[_i].comment; void 0 !== comment && (documentationComment.length && documentationComment.push(ts.lineBreakPart()), documentationComment.push(ts.textPart(comment))) } }), documentationComment } function getCommentHavingNodes(declaration) { switch (declaration.kind) { case 292: case 297: return [declaration]; case 291: case 296: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration) } } function getJsDocTagsFromDeclarations(declarations) { var tags = []; return forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = ts.getJSDocTags(declaration); _i < _a.length; _i++) { var tag = _a[_i]; tags.push({ name: tag.tagName.text, text: getCommentText(tag) }) } }), tags } function getCommentText(tag) { function withNode(node) { return addComment(node.getText()) } function withList(list) { return addComment(list.map(function (x) { return x.getText() }).join(", ")) } function addComment(s) { return void 0 === comment ? s : s + " " + comment } var comment = tag.comment; switch (tag.kind) { case 289: return withNode(tag.class); case 295: return withList(tag.typeParameters); case 294: return withNode(tag.typeExpression); case 296: case 291: case 297: case 292: var name = tag.name; return name ? withNode(name) : comment; default: return comment } } function forEachUnique(array, callback) { if (array) for (var i = 0; i < array.length; i++)if (array.indexOf(array[i]) === i) { var result = callback(array[i], i); if (result) return result } } function getJSDocTagNameCompletions() { return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: tagName, kind: "keyword", kindModifiers: "", sortText: "0" } })) } function getJSDocTagCompletions() { return jsDocTagCompletionEntries || (jsDocTagCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: "@" + tagName, kind: "keyword", kindModifiers: "", sortText: "0" } })) } function getJSDocTagCompletionDetails(name) { return { name: name, kind: "", kindModifiers: "", displayParts: [ts.textPart(name)], documentation: ts.emptyArray, tags: ts.emptyArray, codeActions: void 0 } } function getJSDocParameterNameCompletions(tag) { if (!ts.isIdentifier(tag.name)) return ts.emptyArray; var nameThusFar = tag.name.text, jsdoc = tag.parent, fn = jsdoc.parent; return ts.isFunctionLike(fn) ? ts.mapDefined(fn.parameters, function (param) { if (ts.isIdentifier(param.name)) { var name = param.name.text; if (!jsdoc.tags.some(function (t) { return t !== tag && ts.isJSDocParameterTag(t) && ts.isIdentifier(t.name) && t.name.escapedText === name }) && (void 0 === nameThusFar || ts.startsWith(name, nameThusFar))) return { name: name, kind: "parameter", kindModifiers: "", sortText: "0" } } }) : [] } function getJSDocParameterNameCompletionDetails(name) { return { name: name, kind: "parameter", kindModifiers: "", displayParts: [ts.textPart(name)], documentation: ts.emptyArray, tags: ts.emptyArray, codeActions: void 0 } } function getDocCommentTemplateAtPosition(newLine, sourceFile, position) { if (!(ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position))) { var tokenAtPos = ts.getTokenAtPosition(sourceFile, position, !1), tokenStart = tokenAtPos.getStart(); if (tokenAtPos && !(tokenStart < position)) { var commentOwnerInfo = getCommentOwnerInfo(tokenAtPos); if (commentOwnerInfo) { var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters; if (!(commentOwner.getStart() < position)) { if (!parameters || 0 === parameters.length) { var singleLineResult = "/** */"; return { newText: singleLineResult, caretOffset: 3 } } for (var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position), lineStart = sourceFile.getLineStarts()[posLineAndChar.line], indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character).replace(/\S/i, function () { return " " }), isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName), docParams = "", i = 0; i < parameters.length; i++) { var currentName = parameters[i].name, paramName = 71 === currentName.kind ? currentName.escapedText : "param" + i; docParams += isJavaScriptFile ? indentationStr + " * @param {any} " + paramName + newLine : indentationStr + " * @param " + paramName + newLine } var preamble = "/**" + newLine + indentationStr + " * ", result = preamble + newLine + docParams + indentationStr + " */" + (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length } } } } } } function getCommentOwnerInfo(tokenAtPos) { for (var commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent)switch (commentOwner.kind) { case 233: case 153: case 154: case 152: var parameters = commentOwner.parameters; return { commentOwner: commentOwner, parameters: parameters }; case 234: case 235: case 150: case 237: case 272: case 236: return { commentOwner: commentOwner }; case 213: var varStatement = commentOwner, varDeclarations = varStatement.declarationList.declarations, parameters_1 = 1 === varDeclarations.length && varDeclarations[0].initializer ? getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer) : void 0; return { commentOwner: commentOwner, parameters: parameters_1 }; case 273: return; case 238: return 238 === commentOwner.parent.kind ? void 0 : { commentOwner: commentOwner }; case 199: var be = commentOwner; if (0 === ts.getSpecialPropertyAssignmentKind(be)) return; var parameters_2 = ts.isFunctionLike(be.right) ? be.right.parameters : ts.emptyArray; return { commentOwner: commentOwner, parameters: parameters_2 } } } function getParametersFromRightHandSideOfAssignment(rightHandSide) { for (; 190 === rightHandSide.kind;)rightHandSide = rightHandSide.expression; switch (rightHandSide.kind) { case 191: case 192: return rightHandSide.parameters; case 204: var ctr = ts.find(rightHandSide.members, ts.isConstructorDeclaration); return ctr && ctr.parameters }return ts.emptyArray } var jsDocTagNameCompletionEntries, jsDocTagCompletionEntries, jsDocTagNames = ["augments", "author", "argument", "borrows", "callback", "class", "constant", "constructor", "constructs", "default", "deprecated", "description", "event", "example", "extends", "field", "fileOverview", "function", "ignore", "inheritDoc", "inner", "lends", "link", "memberOf", "method", "name", "namespace", "param", "private", "prop", "property", "public", "requires", "returns", "see", "since", "static", "template", "throws", "type", "typedef", "version"]; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations, JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations, JsDoc.getJSDocTagNameCompletions = getJSDocTagNameCompletions, JsDoc.getJSDocTagNameCompletionDetails = getJSDocTagCompletionDetails, JsDoc.getJSDocTagCompletions = getJSDocTagCompletions, JsDoc.getJSDocTagCompletionDetails = getJSDocTagCompletionDetails, JsDoc.getJSDocParameterNameCompletions = getJSDocParameterNameCompletions, JsDoc.getJSDocParameterNameCompletionDetails = getJSDocParameterNameCompletionDetails, JsDoc.getDocCommentTemplateAtPosition = getDocCommentTemplateAtPosition }(JsDoc = ts.JsDoc || (ts.JsDoc = {})) }(ts || (ts = {})); var ts; !function (ts) { function stringToInt(str) { var n = parseInt(str, 10); if (isNaN(n)) throw new Error("Error in parseInt(" + JSON.stringify(str) + ")"); return n } var isPrereleaseRegex = /^(.*)-next.\d+/, prereleaseSemverRegex = /^(\d+)\.(\d+)\.0-next.(\d+)$/, semverRegex = /^(\d+)\.(\d+)\.(\d+)$/, Semver = function () { function Semver(major, minor, patch, isPrerelease) { this.major = major, this.minor = minor, this.patch = patch, this.isPrerelease = isPrerelease } return Semver.parse = function (semver) { var isPrerelease = isPrereleaseRegex.test(semver), result = Semver.tryParse(semver, isPrerelease); if (!result) throw new Error("Unexpected semver: " + semver + " (isPrerelease: " + isPrerelease + ")"); return result }, Semver.fromRaw = function (_a) { var major = _a.major, minor = _a.minor, patch = _a.patch, isPrerelease = _a.isPrerelease; return new Semver(major, minor, patch, isPrerelease) }, Semver.tryParse = function (semver, isPrerelease) { var rgx = isPrerelease ? prereleaseSemverRegex : semverRegex, match = rgx.exec(semver); return match ? new Semver(stringToInt(match[1]), stringToInt(match[2]), stringToInt(match[3]), isPrerelease) : void 0 }, Object.defineProperty(Semver.prototype, "versionString", { get: function () { return this.isPrerelease ? this.major + "." + this.minor + ".0-next." + this.patch : this.major + "." + this.minor + "." + this.patch }, enumerable: !0, configurable: !0 }), Semver.prototype.equals = function (sem) { return this.major === sem.major && this.minor === sem.minor && this.patch === sem.patch && this.isPrerelease === sem.isPrerelease }, Semver.prototype.greaterThan = function (sem) { return this.major > sem.major || this.major === sem.major && (this.minor > sem.minor || this.minor === sem.minor && (!this.isPrerelease && sem.isPrerelease || this.isPrerelease === sem.isPrerelease && this.patch > sem.patch)) }, Semver }(); ts.Semver = Semver }(ts || (ts = {})); var ts; !function (ts) { var JsTyping; !function (JsTyping) { function isTypingUpToDate(cachedTyping, availableTypingVersions) { var availableVersion = ts.Semver.parse(ts.getProperty(availableTypingVersions, "ts" + ts.versionMajorMinor) || ts.getProperty(availableTypingVersions, "latest")); return !availableVersion.greaterThan(cachedTyping.version) } function loadSafeList(host, safeListPath) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path) }); return ts.createMapFromTemplate(result.config) } function loadTypesMap(host, typesMapPath) { var result = ts.readConfigFile(typesMapPath, function (path) { return host.readFile(path) }); if (result.config) return ts.createMapFromTemplate(result.config.simpleMap) } function discoverTypings(host, log, fileNames, projectRootPath, safeList, packageNameToTypingLocation, typeAcquisition, unresolvedImports, typesRegistry) { function addInferredTyping(typingName) { inferredTypings.has(typingName) || inferredTypings.set(typingName, void 0) } function addInferredTypings(typingNames, message) { log && log(message + ": " + JSON.stringify(typingNames)), ts.forEach(typingNames, addInferredTyping) } function getTypingNamesFromJson(jsonPath, filesToWatch) { if (host.fileExists(jsonPath)) { filesToWatch.push(jsonPath); var jsonConfig = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path) }).config, jsonTypingNames = ts.flatMap([jsonConfig.dependencies, jsonConfig.devDependencies, jsonConfig.optionalDependencies, jsonConfig.peerDependencies], ts.getOwnKeys); addInferredTypings(jsonTypingNames, "Typing names in '" + jsonPath + "' dependencies") } } function getTypingNamesFromSourceFileNames(fileNames) { var fromFileNames = ts.mapDefined(fileNames, function (j) { if (ts.hasJavaScriptFileExtension(j)) { var inferredTypingName = ts.removeFileExtension(ts.getBaseFileName(j.toLowerCase())), cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); return safeList.get(cleanedTypingName) } }); fromFileNames.length && addInferredTypings(fromFileNames, "Inferred typings from file names"); var hasJsxFile = ts.some(fileNames, function (f) { return ts.fileExtensionIs(f, ".jsx") }); hasJsxFile && (log && log("Inferred 'react' typings due to presence of '.jsx' extension"), addInferredTyping("react")) } function getTypingNamesFromPackagesFolder(packagesFolderPath, filesToWatch) { if (filesToWatch.push(packagesFolderPath), host.directoryExists(packagesFolderPath)) { var fileNames = host.readDirectory(packagesFolderPath, [".json"], void 0, void 0, 2); log && log("Searching for typing names in " + packagesFolderPath + "; all files: " + JSON.stringify(fileNames)); for (var packageNames = [], _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i], normalizedFileName = ts.normalizePath(fileName), baseFileName = ts.getBaseFileName(normalizedFileName); if ("package.json" === baseFileName || "bower.json" === baseFileName) { var result_6 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path) }), packageJson = result_6.config; if (("package.json" !== baseFileName || !packageJson._requiredBy || 0 !== ts.filter(packageJson._requiredBy, function (r) { return "#" === r[0] || "/" === r }).length) && packageJson.name) { var ownTypes = packageJson.types || packageJson.typings; if (ownTypes) { var absolutePath = ts.getNormalizedAbsolutePath(ownTypes, ts.getDirectoryPath(normalizedFileName)); log && log(" Package '" + packageJson.name + "' provides its own types."), inferredTypings.set(packageJson.name, absolutePath) } else packageNames.push(packageJson.name) } } } addInferredTypings(packageNames, " Found package names") } } if (!typeAcquisition || !typeAcquisition.enable) return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; var inferredTypings = ts.createMap(); fileNames = ts.mapDefined(fileNames, function (fileName) { var path = ts.normalizePath(fileName); if (ts.hasJavaScriptFileExtension(path)) return path }); var filesToWatch = []; typeAcquisition.include && addInferredTypings(typeAcquisition.include, "Explicitly included types"); var exclude = typeAcquisition.exclude || [], possibleSearchDirs = ts.arrayToSet(fileNames, ts.getDirectoryPath); if (possibleSearchDirs.set(projectRootPath, !0), possibleSearchDirs.forEach(function (_true, searchDir) { var packageJsonPath = ts.combinePaths(searchDir, "package.json"); getTypingNamesFromJson(packageJsonPath, filesToWatch); var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); getTypingNamesFromJson(bowerJsonPath, filesToWatch); var bowerComponentsPath = ts.combinePaths(searchDir, "bower_components"); getTypingNamesFromPackagesFolder(bowerComponentsPath, filesToWatch); var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); getTypingNamesFromPackagesFolder(nodeModulesPath, filesToWatch) }), getTypingNamesFromSourceFileNames(fileNames), unresolvedImports) { var module_1 = ts.deduplicate(unresolvedImports.map(function (moduleId) { return JsTyping.nodeCoreModules.has(moduleId) ? "node" : moduleId }), ts.equateStringsCaseSensitive, ts.compareStringsCaseSensitive); addInferredTypings(module_1, "Inferred typings from unresolved imports") } packageNameToTypingLocation.forEach(function (typing, name) { var registryEntry = typesRegistry.get(name); inferredTypings.has(name) && void 0 === inferredTypings.get(name) && void 0 !== registryEntry && isTypingUpToDate(typing, registryEntry) && inferredTypings.set(name, typing.typingLocation) }); for (var _i = 0, exclude_1 = exclude; _i < exclude_1.length; _i++) { var excludeTypingName = exclude_1[_i], didDelete = inferredTypings.delete(excludeTypingName); didDelete && log && log("Typing for " + excludeTypingName + " is in exclude list, will be ignored.") } var newTypingNames = [], cachedTypingPaths = []; inferredTypings.forEach(function (inferred, typing) { void 0 !== inferred ? cachedTypingPaths.push(inferred) : newTypingNames.push(typing) }); var result = { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; return log && log("Result: " + JSON.stringify(result)), result } function validatePackageName(packageName) { return packageName ? packageName.length > maxPackageNameLength ? 3 : 46 === packageName.charCodeAt(0) ? 4 : 95 === packageName.charCodeAt(0) ? 5 : /^@[^\/]+\/[^\/]+$/.test(packageName) ? 1 : encodeURIComponent(packageName) !== packageName ? 6 : 0 : 2 } function renderPackageNameValidationFailure(result, typing) { switch (result) { case 2: return "Package name '" + typing + "' cannot be empty"; case 3: return "Package name '" + typing + "' should be less than " + maxPackageNameLength + " characters"; case 4: return "Package name '" + typing + "' cannot start with '.'"; case 5: return "Package name '" + typing + "' cannot start with '_'"; case 1: return "Package '" + typing + "' is scoped and currently is not supported"; case 6: return "Package name '" + typing + "' contains non URI safe characters"; case 0: return ts.Debug.fail(); default: ts.Debug.assertNever(result) } } JsTyping.isTypingUpToDate = isTypingUpToDate, JsTyping.nodeCoreModuleList = ["assert", "async_hooks", "buffer", "child_process", "cluster", "console", "constants", "crypto", "dgram", "dns", "domain", "events", "fs", "http", "https", "http2", "inspector", "net", "os", "path", "perf_hooks", "process", "punycode", "querystring", "readline", "repl", "stream", "string_decoder", "timers", "tls", "tty", "url", "util", "v8", "vm", "zlib"], JsTyping.nodeCoreModules = ts.arrayToSet(JsTyping.nodeCoreModuleList), JsTyping.loadSafeList = loadSafeList, JsTyping.loadTypesMap = loadTypesMap, JsTyping.discoverTypings = discoverTypings; var PackageNameValidationResult; !function (PackageNameValidationResult) { PackageNameValidationResult[PackageNameValidationResult.Ok = 0] = "Ok", PackageNameValidationResult[PackageNameValidationResult.ScopedPackagesNotSupported = 1] = "ScopedPackagesNotSupported", PackageNameValidationResult[PackageNameValidationResult.EmptyName = 2] = "EmptyName", PackageNameValidationResult[PackageNameValidationResult.NameTooLong = 3] = "NameTooLong", PackageNameValidationResult[PackageNameValidationResult.NameStartsWithDot = 4] = "NameStartsWithDot", PackageNameValidationResult[PackageNameValidationResult.NameStartsWithUnderscore = 5] = "NameStartsWithUnderscore", PackageNameValidationResult[PackageNameValidationResult.NameContainsNonURISafeCharacters = 6] = "NameContainsNonURISafeCharacters" }(PackageNameValidationResult = JsTyping.PackageNameValidationResult || (JsTyping.PackageNameValidationResult = {})); var maxPackageNameLength = 214; JsTyping.validatePackageName = validatePackageName, JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure }(JsTyping = ts.JsTyping || (ts.JsTyping = {})) }(ts || (ts = {})); var ts; !function (ts) { var NavigateTo; !function (NavigateTo) { function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); if (!patternMatcher) return ts.emptyArray; for (var rawItems = [], _loop_15 = function (sourceFile) { return cancellationToken.throwIfCancellationRequested(), excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? "continue" : void sourceFile.getNamedDeclarations().forEach(function (declarations, name) { getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, rawItems) }) }, _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { var sourceFile = sourceFiles_7[_i]; _loop_15(sourceFile) } return rawItems.sort(compareNavigateToItems), void 0 !== maxResultCount && (rawItems = rawItems.slice(0, maxResultCount)), rawItems.map(createNavigateToItem) } function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, rawItems) { var match = patternMatcher.getMatchForLastSegmentOfPattern(name); if (match) for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) { var declaration = declarations_12[_i]; if (shouldKeepItem(declaration, checker)) if (patternMatcher.patternContainsDots) { var fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name); fullMatch && rawItems.push({ name: name, fileName: fileName, matchKind: fullMatch.kind, isCaseSensitive: fullMatch.isCaseSensitive, declaration: declaration }) } else rawItems.push({ name: name, fileName: fileName, matchKind: match.kind, isCaseSensitive: match.isCaseSensitive, declaration: declaration }) } } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { case 244: case 247: case 242: var importer = checker.getSymbolAtLocation(declaration.name), imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; default: return !0 } } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); return name && ts.isPropertyNameLiteral(name) ? (containers.unshift(ts.getTextOfIdentifierOrLiteral(name)), !0) : !(!name || 146 !== name.kind) && tryAddComputedPropertyName(name.expression, containers, !0) } function tryAddComputedPropertyName(expression, containers, includeLastPortion) { if (ts.isPropertyNameLiteral(expression)) { var text = ts.getTextOfIdentifierOrLiteral(expression); return includeLastPortion && containers.unshift(text), !0 } return !!ts.isPropertyAccessExpression(expression) && (includeLastPortion && containers.unshift(expression.name.text), tryAddComputedPropertyName(expression.expression, containers, !0)) } function getContainers(declaration) { var containers = [], name = ts.getNameOfDeclaration(declaration); if (146 !== name.kind || tryAddComputedPropertyName(name.expression, containers, !1)) { for (declaration = ts.getContainerNode(declaration); declaration;) { if (!tryAddSingleDeclarationName(declaration, containers)) return; declaration = ts.getContainerNode(declaration) } return containers } } function compareNavigateToItems(i1, i2) { return ts.compareValues(i1.matchKind, i2.matchKind) || ts.compareStringsCaseSensitiveUI(i1.name, i2.name) } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration, container = ts.getContainerNode(declaration), containerName = container && ts.getNameOfDeclaration(container); return { name: rawItem.name, kind: ts.getNodeKind(declaration), kindModifiers: ts.getNodeModifiers(declaration), matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, textSpan: ts.createTextSpanFromNode(declaration), containerName: containerName ? containerName.text : "", containerKind: containerName ? ts.getNodeKind(container) : "" } } NavigateTo.getNavigateToItems = getNavigateToItems }(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})) }(ts || (ts = {})); var ts; !function (ts) { var NavigationBar; !function (NavigationBar) { function getNavigationBarItems(sourceFile, cancellationToken) { curCancellationToken = cancellationToken, curSourceFile = sourceFile; try { return ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem) } finally { reset() } } function getNavigationTree(sourceFile, cancellationToken) { curCancellationToken = cancellationToken, curSourceFile = sourceFile; try { return convertToTree(rootNavigationBarNode(sourceFile)) } finally { reset() } } function reset() { curSourceFile = void 0, curCancellationToken = void 0, parentsStack = [], parent = void 0, emptyChildItemArray = [] } function nodeText(node) { return node.getText(curSourceFile) } function navigationBarNodeKind(n) { return n.node.kind } function pushChild(parent, child) { parent.children ? parent.children.push(child) : parent.children = [child] } function rootNavigationBarNode(sourceFile) { ts.Debug.assert(!parentsStack.length); var root = { node: sourceFile, additionalNodes: void 0, parent: void 0, children: void 0, indent: 0 }; parent = root; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; addChildrenRecursively(statement) } return endNode(), ts.Debug.assert(!parent && !parentsStack.length), root } function addLeafNode(node) { pushChild(parent, emptyNavigationBarNode(node)) } function emptyNavigationBarNode(node) { return { node: node, additionalNodes: void 0, parent: parent, children: void 0, indent: parent.indent + 1 } } function startNode(node) { var navNode = emptyNavigationBarNode(node); pushChild(parent, navNode), parentsStack.push(parent), parent = navNode } function endNode() { parent.children && (mergeChildren(parent.children), sortChildren(parent.children)), parent = parentsStack.pop() } function addNodeWithRecursiveChild(node, child) { startNode(node), addChildrenRecursively(child), endNode() } function addChildrenRecursively(node) { if (curCancellationToken.throwIfCancellationRequested(), node && !ts.isToken(node)) switch (node.kind) { case 154: var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) { var param = _a[_i]; ts.isParameterPropertyDeclaration(param) && addLeafNode(param) } break; case 153: case 155: case 156: case 152: ts.hasDynamicName(node) || addNodeWithRecursiveChild(node, node.body); break; case 151: case 150: ts.hasDynamicName(node) || addLeafNode(node); break; case 244: var importClause = node; importClause.name && addLeafNode(importClause); var namedBindings = importClause.namedBindings; if (namedBindings) if (245 === namedBindings.kind) addLeafNode(namedBindings); else for (var _b = 0, _c = namedBindings.elements; _b < _c.length; _b++) { var element = _c[_b]; addLeafNode(element) } break; case 181: case 231: var _d = node, name = _d.name, initializer = _d.initializer; ts.isBindingPattern(name) ? addChildrenRecursively(name) : initializer && isFunctionOrClassExpression(initializer) ? initializer.name ? addChildrenRecursively(initializer) : (startNode(node), ts.forEachChild(initializer, addChildrenRecursively), endNode()) : addNodeWithRecursiveChild(node, initializer); break; case 192: case 233: case 191: addNodeWithRecursiveChild(node, node.body); break; case 237: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; isComputedProperty(member) || addLeafNode(member) } endNode(); break; case 234: case 204: case 235: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; addChildrenRecursively(member) } endNode(); break; case 238: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; case 251: case 242: case 159: case 157: case 158: case 236: addLeafNode(node); break; case 199: var special = ts.getSpecialPropertyAssignmentKind(node); switch (special) { case 1: case 2: case 3: case 6: addNodeWithRecursiveChild(node, node.right); break; case 4: case 5: case 0: break; default: ts.Debug.assertNever(special) }default: ts.hasJSDocNodes(node) && ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { ts.isJSDocTypeAlias(tag) && addLeafNode(tag) }) }), ts.forEachChild(node, addChildrenRecursively) } } function mergeChildren(children) { var nameToItems = ts.createMap(); ts.filterMutate(children, function (child) { var declName = ts.getNameOfDeclaration(child.node), name = declName && nodeText(declName); if (!name) return !0; var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) return nameToItems.set(name, child), !0; if (itemsWithSameName instanceof Array) { for (var _i = 0, itemsWithSameName_1 = itemsWithSameName; _i < itemsWithSameName_1.length; _i++) { var itemWithSameName = itemsWithSameName_1[_i]; if (tryMerge(itemWithSameName, child)) return !1 } return itemsWithSameName.push(child), !0 } var itemWithSameName = itemsWithSameName; return !tryMerge(itemWithSameName, child) && (nameToItems.set(name, [itemWithSameName, child]), !0) }) } function tryMerge(a, b) { return !!shouldReallyMerge(a.node, b.node) && (merge(a, b), !0) } function shouldReallyMerge(a, b) { if (a.kind !== b.kind) return !1; switch (a.kind) { case 151: case 153: case 155: case 156: return ts.hasModifier(a, 32) === ts.hasModifier(b, 32); case 238: return areSameModule(a, b); default: return !0 } } function areSameModule(a, b) { return a.body.kind === b.body.kind && (238 !== a.body.kind || areSameModule(a.body, b.body)) } function merge(target, source) { var _a; target.additionalNodes = target.additionalNodes || [], target.additionalNodes.push(source.node), source.additionalNodes && (_a = target.additionalNodes).push.apply(_a, source.additionalNodes), target.children = ts.concatenate(target.children, source.children), target.children && (mergeChildren(target.children), sortChildren(target.children)) } function sortChildren(children) { children.sort(compareChildren) } function compareChildren(child1, child2) { return ts.compareStringsCaseSensitiveUI(tryGetName(child1.node), tryGetName(child2.node)) || ts.compareValues(navigationBarNodeKind(child1), navigationBarNodeKind(child2)) } function tryGetName(node) { if (238 === node.kind) return getModuleName(node); var declName = ts.getNameOfDeclaration(node); if (declName) return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); switch (node.kind) { case 191: case 192: case 204: return getFunctionOrClassName(node); default: return } } function getItemName(node) { if (238 === node.kind) return getModuleName(node); var name = ts.getNameOfDeclaration(node); if (name) { var text = nodeText(name); if (text.length > 0) return text } switch (node.kind) { case 273: var sourceFile = node; return ts.isExternalModule(sourceFile) ? '"' + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + '"' : ""; case 192: case 233: case 191: case 234: case 204: return 512 & ts.getModifierFlags(node) ? "default" : getFunctionOrClassName(node); case 154: return "constructor"; case 158: return "new()"; case 157: return "()"; case 159: return "[]"; default: return "" } } function topLevelItems(root) { function recur(item) { if (isTopLevel(item) && (topLevel.push(item), item.children)) for (var _i = 0, _a = item.children; _i < _a.length; _i++) { var child = _a[_i]; recur(child) } } function isTopLevel(item) { function isTopLevelFunctionDeclaration(item) { if (!item.node.body) return !1; switch (navigationBarNodeKind(item.parent)) { case 239: case 273: case 153: case 154: return !0; default: return hasSomeImportantChild(item) } } function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); return 231 !== childKind && 181 !== childKind }) } switch (navigationBarNodeKind(item)) { case 234: case 204: case 237: case 235: case 238: case 273: case 236: case 296: case 291: return !0; case 154: case 153: case 155: case 156: case 231: return hasSomeImportantChild(item); case 192: case 233: case 191: return isTopLevelFunctionDeclaration(item); default: return !1 } } var topLevel = []; return recur(root), topLevel } function convertToTree(n) { return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) } } function convertToTopLevelItem(n) { function convertToChildItem(n) { return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), kindModifiers: ts.getNodeModifiers(n.node), spans: getSpans(n), childItems: emptyChildItemArray, indent: 0, bolded: !1, grayed: !1 } } return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, bolded: !1, grayed: !1 } } function getSpans(n) { var spans = [getNodeSpan(n.node)]; if (n.additionalNodes) for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) { var node = _a[_i]; spans.push(getNodeSpan(node)) } return spans } function getModuleName(moduleDeclaration) { if (ts.isAmbientModule(moduleDeclaration)) return ts.getTextOfNode(moduleDeclaration.name); var result = []; for (result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); moduleDeclaration.body && 238 === moduleDeclaration.body.kind;)moduleDeclaration = moduleDeclaration.body, result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); return result.join(".") } function getInteriorModule(decl) { return 238 === decl.body.kind ? getInteriorModule(decl.body) : decl } function isComputedProperty(member) { return !member.name || 146 === member.name.kind } function getNodeSpan(node) { return 273 === node.kind ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile) } function getModifiers(node) { return node.parent && 231 === node.parent.kind && (node = node.parent), ts.getNodeModifiers(node) } function getFunctionOrClassName(node) { return node.name && ts.getFullWidth(node.name) > 0 ? ts.declarationNameToString(node.name) : 231 === node.parent.kind ? ts.declarationNameToString(node.parent.name) : 199 === node.parent.kind && 58 === node.parent.operatorToken.kind ? nodeText(node.parent.left).replace(whiteSpaceRegex, "") : 269 === node.parent.kind && node.parent.name ? nodeText(node.parent.name) : 512 & ts.getModifierFlags(node) ? "default" : ts.isClassLike(node) ? "" : "" } function isFunctionOrClassExpression(node) { switch (node.kind) { case 192: case 191: case 204: return !0; default: return !1 } } var curCancellationToken, curSourceFile, parent, whiteSpaceRegex = /\s+/g, parentsStack = [], emptyChildItemArray = []; NavigationBar.getNavigationBarItems = getNavigationBarItems, NavigationBar.getNavigationTree = getNavigationTree }(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})) }(ts || (ts = {})); var ts; !function (ts) { var OrganizeImports; !function (OrganizeImports) { function organizeImports(sourceFile, formatContext, host, program, _preferences) { function organizeImportsWorker(oldImportDecls, coalesce) { if (0 !== ts.length(oldImportDecls)) { ts.suppressLeadingTrivia(oldImportDecls[0]); var oldImportGroups = ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier) }), sortedImportGroups = ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier) }), newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) { return getExternalModuleName(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup }); 0 === newImportDecls.length ? changeTracker.deleteNode(sourceFile, oldImportDecls[0], { useNonAdjustedStartPosition: !0, useNonAdjustedEndPosition: !1 }) : changeTracker.replaceNodeWithNodes(sourceFile, oldImportDecls[0], newImportDecls, { useNonAdjustedStartPosition: !0, useNonAdjustedEndPosition: !1, suffix: ts.getNewLineOrDefaultFromHost(host, formatContext.options) }); for (var i = 1; i < oldImportDecls.length; i++)changeTracker.deleteNode(sourceFile, oldImportDecls[i]) } } var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext }), coalesceAndOrganizeImports = function (importGroup) { return coalesceImports(removeUnusedImports(importGroup, sourceFile, program)) }, topLevelImportDecls = sourceFile.statements.filter(ts.isImportDeclaration); organizeImportsWorker(topLevelImportDecls, coalesceAndOrganizeImports); var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); organizeImportsWorker(topLevelExportDecls, coalesceExports); for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) { var ambientModule = _a[_i], ambientModuleBody = getModuleBlock(ambientModule), ambientModuleImportDecls = ambientModuleBody.statements.filter(ts.isImportDeclaration); organizeImportsWorker(ambientModuleImportDecls, coalesceAndOrganizeImports); var ambientModuleExportDecls = ambientModuleBody.statements.filter(ts.isExportDeclaration); organizeImportsWorker(ambientModuleExportDecls, coalesceExports) } return changeTracker.getChanges() } function getModuleBlock(moduleDecl) { var body = moduleDecl.body; return body && !ts.isIdentifier(body) && (ts.isModuleBlock(body) ? body : getModuleBlock(body)) } function removeUnusedImports(oldImports, sourceFile, program) { function isDeclarationUsed(identifier) { return jsxElementsPresent && identifier.text === jsxNamespace || ts.FindAllReferences.Core.isSymbolReferencedInFile(identifier, typeChecker, sourceFile) } for (var typeChecker = program.getTypeChecker(), jsxNamespace = typeChecker.getJsxNamespace(), jsxElementsPresent = !!(4 & sourceFile.transformFlags), usedImports = [], _i = 0, oldImports_1 = oldImports; _i < oldImports_1.length; _i++) { var importDecl = oldImports_1[_i], importClause = importDecl.importClause; if (importClause) { var name = importClause.name, namedBindings = importClause.namedBindings; if (name && !isDeclarationUsed(name) && (name = void 0), namedBindings) if (ts.isNamespaceImport(namedBindings)) isDeclarationUsed(namedBindings.name) || (namedBindings = void 0); else { var newElements = namedBindings.elements.filter(function (e) { return isDeclarationUsed(e.name) }); newElements.length < namedBindings.elements.length && (namedBindings = newElements.length ? ts.updateNamedImports(namedBindings, newElements) : void 0) } (name || namedBindings) && usedImports.push(updateImportDeclarationAndClause(importDecl, name, namedBindings)) } else usedImports.push(importDecl) } return usedImports } function getExternalModuleName(specifier) { return void 0 !== specifier && ts.isStringLiteralLike(specifier) ? specifier.text : void 0 } function coalesceImports(importGroup) { function getCategorizedImports(importGroup) { for (var importWithoutClause, defaultImports = [], namespaceImports = [], namedImports = [], _i = 0, importGroup_1 = importGroup; _i < importGroup_1.length; _i++) { var importDeclaration = importGroup_1[_i]; if (void 0 !== importDeclaration.importClause) { var _a = importDeclaration.importClause, name = _a.name, namedBindings = _a.namedBindings; name && defaultImports.push(importDeclaration), namedBindings && (ts.isNamespaceImport(namedBindings) ? namespaceImports.push(importDeclaration) : namedImports.push(importDeclaration)) } else importWithoutClause = importWithoutClause || importDeclaration } return { importWithoutClause: importWithoutClause, defaultImports: defaultImports, namespaceImports: namespaceImports, namedImports: namedImports } } if (0 === importGroup.length) return importGroup; var _a = getCategorizedImports(importGroup), importWithoutClause = _a.importWithoutClause, defaultImports = _a.defaultImports, namespaceImports = _a.namespaceImports, namedImports = _a.namedImports, coalescedImports = []; if (importWithoutClause && coalescedImports.push(importWithoutClause), 1 === defaultImports.length && 1 === namespaceImports.length && 0 === namedImports.length) { var defaultImport = defaultImports[0]; return coalescedImports.push(updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)), coalescedImports } for (var sortedNamespaceImports = ts.stableSort(namespaceImports, function (i1, i2) { return compareIdentifiers(i1.importClause.namedBindings.name, i2.importClause.namedBindings.name) }), _i = 0, sortedNamespaceImports_1 = sortedNamespaceImports; _i < sortedNamespaceImports_1.length; _i++) { var namespaceImport = sortedNamespaceImports_1[_i]; coalescedImports.push(updateImportDeclarationAndClause(namespaceImport, void 0, namespaceImport.importClause.namedBindings)) } if (0 === defaultImports.length && 0 === namedImports.length) return coalescedImports; var newDefaultImport, newImportSpecifiers = []; if (1 === defaultImports.length) newDefaultImport = defaultImports[0].importClause.name; else for (var _b = 0, defaultImports_1 = defaultImports; _b < defaultImports_1.length; _b++) { var defaultImport = defaultImports_1[_b]; newImportSpecifiers.push(ts.createImportSpecifier(ts.createIdentifier("default"), defaultImport.importClause.name)) } newImportSpecifiers.push.apply(newImportSpecifiers, ts.flatMap(namedImports, function (i) { return i.importClause.namedBindings.elements })); var sortedImportSpecifiers = sortSpecifiers(newImportSpecifiers), importDecl = defaultImports.length > 0 ? defaultImports[0] : namedImports[0], newNamedImports = 0 === sortedImportSpecifiers.length ? newDefaultImport ? void 0 : ts.createNamedImports(ts.emptyArray) : 0 === namedImports.length ? ts.createNamedImports(sortedImportSpecifiers) : ts.updateNamedImports(namedImports[0].importClause.namedBindings, sortedImportSpecifiers); return coalescedImports.push(updateImportDeclarationAndClause(importDecl, newDefaultImport, newNamedImports)), coalescedImports } function coalesceExports(exportGroup) { function getCategorizedExports(exportGroup) { for (var exportWithoutClause, namedExports = [], _i = 0, exportGroup_1 = exportGroup; _i < exportGroup_1.length; _i++) { var exportDeclaration = exportGroup_1[_i]; void 0 === exportDeclaration.exportClause ? exportWithoutClause = exportWithoutClause || exportDeclaration : namedExports.push(exportDeclaration) } return { exportWithoutClause: exportWithoutClause, namedExports: namedExports } } if (0 === exportGroup.length) return exportGroup; var _a = getCategorizedExports(exportGroup), exportWithoutClause = _a.exportWithoutClause, namedExports = _a.namedExports, coalescedExports = []; if (exportWithoutClause && coalescedExports.push(exportWithoutClause), 0 === namedExports.length) return coalescedExports; var newExportSpecifiers = []; newExportSpecifiers.push.apply(newExportSpecifiers, ts.flatMap(namedExports, function (i) { return i.exportClause.elements })); var sortedExportSpecifiers = sortSpecifiers(newExportSpecifiers), exportDecl = namedExports[0]; return coalescedExports.push(ts.updateExportDeclaration(exportDecl, exportDecl.decorators, exportDecl.modifiers, ts.updateNamedExports(exportDecl.exportClause, sortedExportSpecifiers), exportDecl.moduleSpecifier)), coalescedExports } function updateImportDeclarationAndClause(importDeclaration, name, namedBindings) { return ts.updateImportDeclaration(importDeclaration, importDeclaration.decorators, importDeclaration.modifiers, ts.updateImportClause(importDeclaration.importClause, name, namedBindings), importDeclaration.moduleSpecifier) } function sortSpecifiers(specifiers) { return ts.stableSort(specifiers, function (s1, s2) { return compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) || compareIdentifiers(s1.name, s2.name) }) } function compareModuleSpecifiers(m1, m2) { var name1 = getExternalModuleName(m1), name2 = getExternalModuleName(m2); return ts.compareBooleans(void 0 === name1, void 0 === name2) || ts.compareBooleans(ts.isExternalModuleNameRelative(name1), ts.isExternalModuleNameRelative(name2)) || ts.compareStringsCaseInsensitive(name1, name2) } function compareIdentifiers(s1, s2) { return ts.compareStringsCaseInsensitive(s1.text, s2.text) } OrganizeImports.organizeImports = organizeImports, OrganizeImports.coalesceImports = coalesceImports, OrganizeImports.coalesceExports = coalesceExports, OrganizeImports.compareModuleSpecifiers = compareModuleSpecifiers }(OrganizeImports = ts.OrganizeImports || (ts.OrganizeImports = {})) }(ts || (ts = {})); var ts; !function (ts) { var OutliningElementsCollector; !function (OutliningElementsCollector) { function collectElements(sourceFile, cancellationToken) { var res = []; return addNodeOutliningSpans(sourceFile, cancellationToken, res), addRegionOutliningSpans(sourceFile, res), res.sort(function (span1, span2) { return span1.textSpan.start - span2.textSpan.start }) } function addNodeOutliningSpans(sourceFile, cancellationToken, out) { function visitNonImportNode(n) { if (0 !== depthRemaining) { cancellationToken.throwIfCancellationRequested(), ts.isDeclaration(n) && addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out); var span = getOutliningSpanForNode(n, sourceFile); span && out.push(span), depthRemaining-- , ts.isIfStatement(n) && n.elseStatement && ts.isIfStatement(n.elseStatement) ? (visitNonImportNode(n.expression), visitNonImportNode(n.thenStatement), depthRemaining++ , visitNonImportNode(n.elseStatement), depthRemaining--) : n.forEachChild(visitNonImportNode), depthRemaining++ } } for (var depthRemaining = 40, current = 0, statements = sourceFile.statements, n = statements.length; current < n;) { for (; current < n && !ts.isAnyImportSyntax(statements[current]);)visitNonImportNode(statements[current]), current++; if (current === n) break; for (var firstImport = current; current < n && ts.isAnyImportSyntax(statements[current]);)addOutliningForLeadingCommentsForNode(statements[current], sourceFile, cancellationToken, out), current++; var lastImport = current - 1; lastImport !== firstImport && out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 91, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports")) } } function addRegionOutliningSpans(sourceFile, out) { for (var regions = [], lineStarts = sourceFile.getLineStarts(), i = 0; i < lineStarts.length; i++) { var currentLineStart = lineStarts[i], lineEnd = i + 1 === lineStarts.length ? sourceFile.getEnd() : lineStarts[i + 1] - 1, lineText = sourceFile.text.substring(currentLineStart, lineEnd), result = lineText.match(/^\s*\/\/\s*#(end)?region(?:\s+(.*))?(?:\r)?$/); if (result && !ts.isInComment(sourceFile, currentLineStart)) if (result[1]) { var region = regions.pop(); region && (region.textSpan.length = lineEnd - region.textSpan.start, region.hintSpan.length = lineEnd - region.textSpan.start, out.push(region)) } else { var span = ts.createTextSpanFromBounds(sourceFile.text.indexOf("//", currentLineStart), lineEnd); regions.push(createOutliningSpan(span, "region", span, !1, result[2] || "#region")) } } } function addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out) { function combineAndAddMultipleSingleLineComments() { singleLineCommentCount > 1 && out.push(createOutliningSpanFromBounds(firstSingleLineCommentStart, lastSingleLineCommentEnd, "comment")) } var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile); if (comments) { for (var firstSingleLineCommentStart = -1, lastSingleLineCommentEnd = -1, singleLineCommentCount = 0, _i = 0, comments_3 = comments; _i < comments_3.length; _i++) { var _a = comments_3[_i], kind = _a.kind, pos = _a.pos, end = _a.end; switch (cancellationToken.throwIfCancellationRequested(), kind) { case 2: 0 === singleLineCommentCount && (firstSingleLineCommentStart = pos), lastSingleLineCommentEnd = end, singleLineCommentCount++; break; case 3: combineAndAddMultipleSingleLineComments(), out.push(createOutliningSpanFromBounds(pos, end, "comment")), singleLineCommentCount = 0; break; default: ts.Debug.assertNever(kind) } } combineAndAddMultipleSingleLineComments() } } function createOutliningSpanFromBounds(pos, end, kind) { return createOutliningSpan(ts.createTextSpanFromBounds(pos, end), kind) } function getOutliningSpanForNode(n, sourceFile) { function spanForObjectOrArrayLiteral(node, open) { return void 0 === open && (open = 17), spanForNode(node, !1, !ts.isArrayLiteralExpression(node.parent), open) } function spanForNode(hintSpanNode, autoCollapse, useFullStart, open) { void 0 === autoCollapse && (autoCollapse = !1), void 0 === useFullStart && (useFullStart = !0), void 0 === open && (open = 17); var openToken = ts.findChildOfKind(n, open, sourceFile), close = 17 === open ? 18 : 22, closeToken = ts.findChildOfKind(n, close, sourceFile); if (openToken && closeToken) { var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd()); return createOutliningSpan(textSpan, "code", ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse) } } switch (n.kind) { case 212: if (ts.isFunctionBlock(n)) return spanForNode(n.parent, 192 !== n.parent.kind); switch (n.parent.kind) { case 217: case 220: case 221: case 219: case 216: case 218: case 225: case 268: return spanForNode(n.parent); case 229: var tryStatement = n.parent; if (tryStatement.tryBlock === n) return spanForNode(n.parent); if (tryStatement.finallyBlock === n) return spanForNode(ts.findChildOfKind(tryStatement, 87, sourceFile)); default: return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code") }case 239: return spanForNode(n.parent); case 234: case 235: case 237: case 240: return spanForNode(n); case 183: return spanForObjectOrArrayLiteral(n); case 182: return spanForObjectOrArrayLiteral(n, 21) } } function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) { return void 0 === hintSpan && (hintSpan = textSpan), void 0 === autoCollapse && (autoCollapse = !1), void 0 === bannerText && (bannerText = "..."), { textSpan: textSpan, kind: kind, hintSpan: hintSpan, bannerText: bannerText, autoCollapse: autoCollapse } } OutliningElementsCollector.collectElements = collectElements }(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})) }(ts || (ts = {})); var ts; !function (ts) { function createPatternMatch(kind, isCaseSensitive) { return { kind: kind, isCaseSensitive: isCaseSensitive } } function createPatternMatcher(pattern) { var stringToWordSpans = ts.createMap(), dotSeparatedSegments = pattern.trim().split(".").map(function (p) { return createSegment(p.trim()) }); if (!dotSeparatedSegments.some(function (segment) { return !segment.subWordTextChunks.length })) return { getFullMatch: function (containers, candidate) { return getFullMatch(containers, candidate, dotSeparatedSegments, stringToWordSpans) }, getMatchForLastSegmentOfPattern: function (candidate) { return matchSegment(candidate, ts.last(dotSeparatedSegments), stringToWordSpans) }, patternContainsDots: dotSeparatedSegments.length > 1 } } function getFullMatch(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) { var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments), stringToWordSpans); if (candidateMatch && (candidateContainers = candidateContainers || [], !(dotSeparatedSegments.length - 1 > candidateContainers.length))) { for (var bestMatch, i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1)bestMatch = betterMatch(bestMatch, matchSegment(candidateContainers[j], dotSeparatedSegments[i], stringToWordSpans)); return bestMatch } } function getWordSpans(word, stringToWordSpans) { var spans = stringToWordSpans.get(word); return spans || stringToWordSpans.set(word, spans = breakIntoWordSpans(word)), spans } function matchTextChunk(candidate, chunk, stringToWordSpans) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); if (0 === index) return createPatternMatch(chunk.text.length === candidate.length ? PatternMatchKind.exact : PatternMatchKind.prefix, ts.startsWith(candidate, chunk.text)); if (chunk.isLowerCase) { if (index === -1) return; for (var wordSpans = getWordSpans(candidate, stringToWordSpans), _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { var span = wordSpans_1[_i]; if (partStartsWith(candidate, span, chunk.text, !0)) return createPatternMatch(PatternMatchKind.substring, partStartsWith(candidate, span, chunk.text, !1)) } if (chunk.text.length < candidate.length && isUpperCaseLetter(candidate.charCodeAt(index))) return createPatternMatch(PatternMatchKind.substring, !1) } else { if (candidate.indexOf(chunk.text) > 0) return createPatternMatch(PatternMatchKind.substring, !0); if (chunk.characterSpans.length > 0) { var candidateParts = getWordSpans(candidate, stringToWordSpans), isCaseSensitive = !!tryCamelCaseMatch(candidate, candidateParts, chunk, !1) || !tryCamelCaseMatch(candidate, candidateParts, chunk, !0) && void 0; if (void 0 !== isCaseSensitive) return createPatternMatch(PatternMatchKind.camelCase, isCaseSensitive) } } } function matchSegment(candidate, segment, stringToWordSpans) { if (every(segment.totalTextChunk.text, function (ch) { return 32 !== ch && 42 !== ch })) { var match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans); if (match) return match } for (var bestMatch, subWordTextChunks = segment.subWordTextChunks, _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { var subWordTextChunk = subWordTextChunks_1[_i]; bestMatch = betterMatch(bestMatch, matchTextChunk(candidate, subWordTextChunk, stringToWordSpans)) } return bestMatch } function betterMatch(a, b) { return ts.min(a, b, compareMatches) } function compareMatches(a, b) { return void 0 === a ? 1 : void 0 === b ? -1 : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive) } function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { return void 0 === patternSpan && (patternSpan = { start: 0, length: pattern.length }), patternSpan.length <= candidateSpan.length && everyInRange(0, patternSpan.length, function (i) { return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase) }) } function equalChars(ch1, ch2, ignoreCase) { return ignoreCase ? toLowerCase(ch1) === toLowerCase(ch2) : ch1 === ch2 } function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { for (var firstMatch, contiguous, chunkCharacterSpans = chunk.characterSpans, currentCandidate = 0, currentChunkSpan = 0; ;) { if (currentChunkSpan === chunkCharacterSpans.length) return !0; if (currentCandidate === candidateParts.length) return !1; for (var candidatePart = candidateParts[currentCandidate], gotOneMatchThisCandidate = !1; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate && (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start)))) break; if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) break; gotOneMatchThisCandidate = !0, firstMatch = void 0 === firstMatch ? currentCandidate : firstMatch, contiguous = void 0 === contiguous || contiguous, candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length) } gotOneMatchThisCandidate || void 0 === contiguous || (contiguous = !1), currentCandidate++ } } function createSegment(text) { return { totalTextChunk: createTextChunk(text), subWordTextChunks: breakPatternIntoTextChunks(text) } } function isUpperCaseLetter(ch) { if (ch >= 65 && ch <= 90) return !0; if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 6)) return !1; var str = String.fromCharCode(ch); return str === str.toUpperCase() } function isLowerCaseLetter(ch) { if (ch >= 97 && ch <= 122) return !0; if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 6)) return !1; var str = String.fromCharCode(ch); return str === str.toLowerCase() } function indexOfIgnoringCase(str, value) { for (var n = str.length - value.length, _loop_16 = function (start) { if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar })) return { value: start } }, start = 0; start <= n; start++) { var state_4 = _loop_16(start); if ("object" == typeof state_4) return state_4.value } return -1 } function toLowerCase(ch) { return ch >= 65 && ch <= 90 ? 97 + (ch - 65) : ch < 127 ? ch : String.fromCharCode(ch).toLowerCase().charCodeAt(0) } function isDigit(ch) { return ch >= 48 && ch <= 57 } function isWordChar(ch) { return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || 95 === ch || 36 === ch } function breakPatternIntoTextChunks(pattern) { for (var result = [], wordStart = 0, wordLength = 0, i = 0; i < pattern.length; i++) { var ch = pattern.charCodeAt(i); isWordChar(ch) ? (0 === wordLength && (wordStart = i), wordLength++) : wordLength > 0 && (result.push(createTextChunk(pattern.substr(wordStart, wordLength))), wordLength = 0) } return wordLength > 0 && result.push(createTextChunk(pattern.substr(wordStart, wordLength))), result } function createTextChunk(text) { var textLowerCase = text.toLowerCase(); return { text: text, textLowerCase: textLowerCase, isLowerCase: text === textLowerCase, characterSpans: breakIntoCharacterSpans(text) } } function breakIntoCharacterSpans(identifier) { return breakIntoSpans(identifier, !1) } function breakIntoWordSpans(identifier) { return breakIntoSpans(identifier, !0) } function breakIntoSpans(identifier, word) { for (var result = [], wordStart = 0, i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)), currentIsDigit = isDigit(identifier.charCodeAt(i)), hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i), hasTransitionFromUpperToLower = word && transitionFromUpperToLower(identifier, i, wordStart); (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit !== currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) && (isAllPunctuation(identifier, wordStart, i) || result.push(ts.createTextSpan(wordStart, i - wordStart)), wordStart = i) } return isAllPunctuation(identifier, wordStart, identifier.length) || result.push(ts.createTextSpan(wordStart, identifier.length - wordStart)), result } function charIsPunctuation(ch) { switch (ch) { case 33: case 34: case 35: case 37: case 38: case 39: case 40: case 41: case 42: case 44: case 45: case 46: case 47: case 58: case 59: case 63: case 64: case 91: case 92: case 93: case 95: case 123: case 125: return !0 }return !1 } function isAllPunctuation(identifier, start, end) { return every(identifier, function (ch) { return charIsPunctuation(ch) && 95 !== ch }, start, end) } function transitionFromUpperToLower(identifier, index, wordStart) { return index !== wordStart && index + 1 < identifier.length && isUpperCaseLetter(identifier.charCodeAt(index)) && isLowerCaseLetter(identifier.charCodeAt(index + 1)) && every(identifier, isUpperCaseLetter, wordStart, index) } function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)), currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); return currentIsUpper && (!word || !lastIsUpper) } function everyInRange(start, end, pred) { for (var i = start; i < end; i++)if (!pred(i)) return !1; return !0 } function every(s, pred, start, end) { return void 0 === start && (start = 0), void 0 === end && (end = s.length), everyInRange(start, end, function (i) { return pred(s.charCodeAt(i), i) }) } var PatternMatchKind; !function (PatternMatchKind) { PatternMatchKind[PatternMatchKind.exact = 0] = "exact", PatternMatchKind[PatternMatchKind.prefix = 1] = "prefix", PatternMatchKind[PatternMatchKind.substring = 2] = "substring", PatternMatchKind[PatternMatchKind.camelCase = 3] = "camelCase" }(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {})), ts.createPatternMatcher = createPatternMatcher, ts.breakIntoCharacterSpans = breakIntoCharacterSpans, ts.breakIntoWordSpans = breakIntoWordSpans }(ts || (ts = {})); var ts; !function (ts) { function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { function nextToken() { return lastToken = currentToken, currentToken = ts.scanner.scan(), 17 === currentToken ? braceNesting++ : 18 === currentToken && braceNesting-- , currentToken } function getFileReference() { var fileName = ts.scanner.getTokenValue(), pos = ts.scanner.getTokenPos(); return { fileName: fileName, pos: pos, end: pos + fileName.length } } function recordAmbientExternalModule() { ambientExternalModules || (ambientExternalModules = []), ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }) } function recordModuleName() { importedFiles.push(getFileReference()), markAsExternalModuleIfTopLevel() } function markAsExternalModuleIfTopLevel() { 0 === braceNesting && (externalModule = !0) } function tryConsumeDeclare() { var token = ts.scanner.getToken(); return 124 === token && (token = nextToken(), 129 === token && (token = nextToken(), 9 === token && recordAmbientExternalModule()), !0) } function tryConsumeImport() { if (23 === lastToken) return !1; var token = ts.scanner.getToken(); if (91 === token) { if (token = nextToken(), 19 === token) { if (token = nextToken(), 9 === token) return recordModuleName(), !0 } else { if (9 === token) return recordModuleName(), !0; if (71 === token || ts.isKeyword(token)) if (token = nextToken(), 142 === token) { if (token = nextToken(), 9 === token) return recordModuleName(), !0 } else if (58 === token) { if (tryConsumeRequireCall(!0)) return !0 } else { if (26 !== token) return !0; token = nextToken() } if (17 === token) { for (token = nextToken(); 18 !== token && 1 !== token;)token = nextToken(); 18 === token && (token = nextToken(), 142 === token && (token = nextToken(), 9 === token && recordModuleName())) } else 39 === token && (token = nextToken(), 118 === token && (token = nextToken(), (71 === token || ts.isKeyword(token)) && (token = nextToken(), 142 === token && (token = nextToken(), 9 === token && recordModuleName())))) } return !0 } return !1 } function tryConsumeExport() { var token = ts.scanner.getToken(); if (84 === token) { if (markAsExternalModuleIfTopLevel(), token = nextToken(), 17 === token) { for (token = nextToken(); 18 !== token && 1 !== token;)token = nextToken(); 18 === token && (token = nextToken(), 142 === token && (token = nextToken(), 9 === token && recordModuleName())) } else if (39 === token) token = nextToken(), 142 === token && (token = nextToken(), 9 === token && recordModuleName()); else if (91 === token && (token = nextToken(), (71 === token || ts.isKeyword(token)) && (token = nextToken(), 58 === token && tryConsumeRequireCall(!0)))) return !0; return !0 } return !1 } function tryConsumeRequireCall(skipCurrentToken) { var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); return 133 === token && (token = nextToken(), 19 === token && (token = nextToken(), 9 === token && recordModuleName()), !0) } function tryConsumeDefine() { var token = ts.scanner.getToken(); if (71 === token && "define" === ts.scanner.getTokenValue()) { if (token = nextToken(), 19 !== token) return !0; if (token = nextToken(), 9 === token) { if (token = nextToken(), 26 !== token) return !0; token = nextToken() } if (21 !== token) return !0; for (token = nextToken(); 22 !== token && 1 !== token;)9 === token && recordModuleName(), token = nextToken(); return !0 } return !1 } function processImports() { for (ts.scanner.setText(sourceText), nextToken(); ;) { if (1 === ts.scanner.getToken()) break; tryConsumeDeclare() || tryConsumeImport() || tryConsumeExport() || detectJavaScriptImports && (tryConsumeRequireCall(!1) || tryConsumeDefine()) || nextToken() } ts.scanner.setText(void 0) } void 0 === readImportFiles && (readImportFiles = !0), void 0 === detectJavaScriptImports && (detectJavaScriptImports = !1); var ambientExternalModules, lastToken, currentToken, pragmaContext = { languageVersion: 1, pragmas: void 0, checkJsDirective: void 0, referencedFiles: [], typeReferenceDirectives: [], amdDependencies: [], hasNoDefaultLib: void 0, moduleName: void 0 }, importedFiles = [], braceNesting = 0, externalModule = !1; if (readImportFiles && processImports(), ts.processCommentPragmas(pragmaContext, sourceText), ts.processPragmasIntoFields(pragmaContext, ts.noop), externalModule) { if (ambientExternalModules) for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { var decl = ambientExternalModules_1[_i]; importedFiles.push(decl.ref) } return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, importedFiles: importedFiles, isLibFile: pragmaContext.hasNoDefaultLib, ambientExternalModules: void 0 } } var ambientModuleNames = void 0; if (ambientExternalModules) for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { var decl = ambientExternalModules_2[_a]; 0 === decl.depth ? (ambientModuleNames || (ambientModuleNames = []), ambientModuleNames.push(decl.ref.fileName)) : importedFiles.push(decl.ref) } return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, importedFiles: importedFiles, isLibFile: pragmaContext.hasNoDefaultLib, ambientExternalModules: ambientModuleNames } } ts.preProcessFile = preProcessFile }(ts || (ts = {})); var ts; !function (ts) { var Rename; !function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { function isDefinedInLibraryFile(declaration) { if (!defaultLibFileName) return !1; var sourceFile = declaration.getSourceFile(), canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); return canonicalName === getCanonicalDefaultLibName() } var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)) }), node = ts.getTouchingPropertyName(sourceFile, position, !0), renameInfo = node && nodeIsEligibleForRename(node) ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) : void 0; return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element) } function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var declarations = symbol.declarations; if (declarations && declarations.length > 0) { if (declarations.some(isDefinedInLibraryFile)) return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); if (ts.isIdentifier(node) && 79 === node.originalKeywordKind && 1536 & symbol.parent.flags) return; if (ts.isStringLiteralLike(node) && ts.tryGetImportFromModuleSpecifier(node)) return; var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node), specifierName = ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteral(node) && 146 === node.parent.kind ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : void 0, displayName = specifierName || typeChecker.symbolToString(symbol), fullDisplayName = specifierName || typeChecker.getFullyQualifiedName(symbol); return getRenameInfoSuccess(displayName, fullDisplayName, kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) } } else if (ts.isStringLiteral(node)) return isDefinedInLibraryFile(node) ? getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library) : getRenameInfoSuccess(node.text, node.text, "var", "", node, sourceFile) } function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { return { canRename: !0, kind: kind, displayName: displayName, localizedErrorMessage: void 0, fullDisplayName: fullDisplayName, kindModifiers: kindModifiers, triggerSpan: createTriggerSpanForNode(node, sourceFile) } } function getRenameInfoError(diagnostic) { return { canRename: !1, localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), displayName: void 0, fullDisplayName: void 0, kind: void 0, kindModifiers: void 0, triggerSpan: void 0 } } function createTriggerSpanForNode(node, sourceFile) { var start = node.getStart(sourceFile), width = node.getWidth(sourceFile); return 9 === node.kind && (start += 1, width -= 2), ts.createTextSpan(start, width) } function nodeIsEligibleForRename(node) { switch (node.kind) { case 71: case 9: case 99: return !0; case 8: return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node); default: return !1 } } Rename.getRenameInfo = getRenameInfo }(Rename = ts.Rename || (ts.Rename = {})) }(ts || (ts = {})); var ts; !function (ts) { var SignatureHelp; !function (SignatureHelp) { function getSignatureHelpItems(program, sourceFile, position, cancellationToken) { var typeChecker = program.getTypeChecker(), startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position); if (startingToken) { var argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile); if (argumentInfo) { cancellationToken.throwIfCancellationRequested(); var call = argumentInfo.invocation, candidates = [], resolvedSignature = typeChecker.getResolvedSignature(call, candidates, argumentInfo.argumentCount); if (cancellationToken.throwIfCancellationRequested(), candidates.length) return typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo, typeChecker) }); if (ts.isSourceFileJavaScript(sourceFile)) return createJavaScriptSignatureHelpItems(argumentInfo, program, cancellationToken) } } } function createJavaScriptSignatureHelpItems(argumentInfo, program, cancellationToken) { if (186 === argumentInfo.invocation.kind) { var callExpression = argumentInfo.invocation, expression = callExpression.expression, name = ts.isIdentifier(expression) ? expression : ts.isPropertyAccessExpression(expression) ? expression.name : void 0; if (name && name.escapedText) for (var typeChecker = program.getTypeChecker(), _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i], nameToDeclarations = sourceFile.getNamedDeclarations(), declarations = nameToDeclarations.get(name.text); if (declarations) for (var _loop_17 = function (declaration) { var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); if (type) { var callSignatures_1 = type.getCallSignatures(); if (callSignatures_1 && callSignatures_1.length) return { value: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return createSignatureHelpItems(callSignatures_1, callSignatures_1[0], argumentInfo, typeChecker) }) } } } }, _b = 0, declarations_13 = declarations; _b < declarations_13.length; _b++) { var declaration = declarations_13[_b], state_5 = _loop_17(declaration); if ("object" == typeof state_5) return state_5.value } } } } function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { if (ts.isCallOrNewExpression(node.parent)) { var invocation = node.parent, list = void 0, argumentIndex = void 0; if (27 === node.kind || 19 === node.kind) list = getChildListThatStartsWithOpenerToken(invocation, node, sourceFile), ts.Debug.assert(void 0 !== list), argumentIndex = 0; else { if (list = ts.findContainingList(node), !list) return; argumentIndex = getArgumentIndex(list, node) } var kind = invocation.typeArguments && invocation.typeArguments.pos === list.pos ? 0 : 1, argumentCount = getArgumentCount(list); 0 !== argumentIndex && ts.Debug.assertLessThan(argumentIndex, argumentCount); var argumentsSpan = getApplicableSpanForArguments(list, sourceFile); return { kind: kind, invocation: invocation, argumentsSpan: argumentsSpan, argumentIndex: argumentIndex, argumentCount: argumentCount } } if (13 === node.kind && 188 === node.parent.kind) { if (ts.isInsideTemplateLiteral(node, position)) return getArgumentListInfoForTemplate(node.parent, 0, sourceFile) } else { if (14 === node.kind && 188 === node.parent.parent.kind) { var templateExpression = node.parent, tagExpression = templateExpression.parent; ts.Debug.assert(201 === templateExpression.kind); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) } if (210 === node.parent.kind && 188 === node.parent.parent.parent.kind) { var templateSpan = node.parent, templateExpression = templateSpan.parent, tagExpression = templateExpression.parent; if (ts.Debug.assert(201 === templateExpression.kind), 16 === node.kind && !ts.isInsideTemplateLiteral(node, position)) return; var spanIndex = templateExpression.templateSpans.indexOf(templateSpan), argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position); return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) } if (node.parent && ts.isJsxOpeningLikeElement(node.parent)) { var attributeSpanStart = node.parent.attributes.getFullStart(), attributeSpanEnd = ts.skipTrivia(sourceFile.text, node.parent.attributes.getEnd(), !1); return { kind: 3, invocation: node.parent, argumentsSpan: ts.createTextSpan(attributeSpanStart, attributeSpanEnd - attributeSpanStart), argumentIndex: 0, argumentCount: 1 } } } } function getArgumentIndex(argumentsList, node) { for (var argumentIndex = 0, _i = 0, _a = argumentsList.getChildren(); _i < _a.length; _i++) { var child = _a[_i]; if (child === node) break; 26 !== child.kind && argumentIndex++ } return argumentIndex } function getArgumentCount(argumentsList) { var listChildren = argumentsList.getChildren(), argumentCount = ts.countWhere(listChildren, function (arg) { return 26 !== arg.kind }); return listChildren.length > 0 && 26 === ts.lastOrUndefined(listChildren).kind && argumentCount++ , argumentCount } function getArgumentIndexForTemplatePiece(spanIndex, node, position) { return ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."), ts.isTemplateLiteralKind(node.kind) ? ts.isInsideTemplateLiteral(node, position) ? 0 : spanIndex + 2 : spanIndex + 1 } function getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) { var argumentCount = ts.isNoSubstitutionTemplateLiteral(tagExpression.template) ? 1 : tagExpression.template.templateSpans.length + 1; return 0 !== argumentIndex && ts.Debug.assertLessThan(argumentIndex, argumentCount), { kind: 2, invocation: tagExpression, argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile), argumentIndex: argumentIndex, argumentCount: argumentCount } } function getApplicableSpanForArguments(argumentsList, sourceFile) { var applicableSpanStart = argumentsList.getFullStart(), applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), !1); return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart) } function getApplicableSpanForTaggedTemplate(taggedTemplate, sourceFile) { var template = taggedTemplate.template, applicableSpanStart = template.getStart(), applicableSpanEnd = template.getEnd(); if (201 === template.kind) { var lastSpan = ts.lastOrUndefined(template.templateSpans); 0 === lastSpan.literal.getFullWidth() && (applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, !1)) } return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart) } function getContainingArgumentInfo(node, position, sourceFile) { for (var n = node; 273 !== n.kind; n = n.parent) { if (ts.isFunctionBlock(n)) return; (n.pos < n.parent.pos || n.end > n.parent.end) && ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); var argumentInfo = getImmediatelyContainingArgumentInfo(n, position, sourceFile); if (argumentInfo) return argumentInfo } } function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) { var children = parent.getChildren(sourceFile), indexOfOpenerToken = children.indexOf(openerToken); return ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1), children[indexOfOpenerToken + 1] } function createSignatureHelpItems(candidates, resolvedSignature, argumentListInfo, typeChecker) { function createSignatureHelpParameterForParameter(parameter) { var displayParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.symbolToParameterDeclaration(parameter, invocation, signatureHelpNodeBuilderFlags); printer.writeNode(4, param, ts.getSourceFileOfNode(ts.getParseTreeNode(invocation)), writer) }); return { name: parameter.name, documentation: parameter.getDocumentationComment(typeChecker), displayParts: displayParts, isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration) } } function createSignatureHelpParameterForTypeParameter(typeParameter) { var displayParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(typeParameter, invocation); printer.writeNode(4, param, ts.getSourceFileOfNode(ts.getParseTreeNode(invocation)), writer) }); return { name: typeParameter.symbol.name, documentation: ts.emptyArray, displayParts: displayParts, isOptional: !1 } } var argumentCount = argumentListInfo.argumentCount, applicableSpan = argumentListInfo.argumentsSpan, invocation = argumentListInfo.invocation, argumentIndex = argumentListInfo.argumentIndex, isTypeParameterList = 0 === argumentListInfo.kind, callTarget = ts.getInvokedExpression(invocation), callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget), callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, void 0, void 0), printer = ts.createPrinter({ removeComments: !0 }), items = ts.map(candidates, function (candidateSignature) { var signatureHelpParameters, prefixDisplayParts = [], suffixDisplayParts = []; callTargetDisplayParts && ts.addRange(prefixDisplayParts, callTargetDisplayParts); var isVariadic; if (isTypeParameterList) { isVariadic = !1, prefixDisplayParts.push(ts.punctuationPart(27)); var typeParameters = (candidateSignature.target || candidateSignature).typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : ts.emptyArray, suffixDisplayParts.push(ts.punctuationPart(29)); var parameterParts = ts.mapToDisplayParts(function (writer) { var thisParameter = candidateSignature.thisParameter ? [typeChecker.symbolToParameterDeclaration(candidateSignature.thisParameter, invocation, signatureHelpNodeBuilderFlags)] : [], params = ts.createNodeArray(thisParameter.concat(ts.map(candidateSignature.parameters, function (param) { return typeChecker.symbolToParameterDeclaration(param, invocation, signatureHelpNodeBuilderFlags) }))); printer.writeList(1296, params, ts.getSourceFileOfNode(ts.getParseTreeNode(invocation)), writer) }); ts.addRange(suffixDisplayParts, parameterParts) } else { isVariadic = candidateSignature.hasRestParameter; var typeParameterParts = ts.mapToDisplayParts(function (writer) { if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) { var args = ts.createNodeArray(ts.map(candidateSignature.typeParameters, function (p) { return typeChecker.typeParameterToDeclaration(p, invocation) })); printer.writeList(26896, args, ts.getSourceFileOfNode(ts.getParseTreeNode(invocation)), writer) } }); ts.addRange(prefixDisplayParts, typeParameterParts), prefixDisplayParts.push(ts.punctuationPart(19)), signatureHelpParameters = ts.map(candidateSignature.parameters, createSignatureHelpParameterForParameter), suffixDisplayParts.push(ts.punctuationPart(20)) } var returnTypeParts = ts.mapToDisplayParts(function (writer) { writer.writePunctuation(":"), writer.writeSpace(" "); var predicate = typeChecker.getTypePredicateOfSignature(candidateSignature); predicate ? typeChecker.writeTypePredicate(predicate, invocation, void 0, writer) : typeChecker.writeType(typeChecker.getReturnTypeOfSignature(candidateSignature), invocation, void 0, writer) }); return ts.addRange(suffixDisplayParts, returnTypeParts), { isVariadic: isVariadic, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, separatorDisplayParts: [ts.punctuationPart(26), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment(typeChecker), tags: candidateSignature.getJsDocTags() } }); 0 !== argumentIndex && ts.Debug.assertLessThan(argumentIndex, argumentCount); var selectedItemIndex = candidates.indexOf(resolvedSignature); return ts.Debug.assert(selectedItemIndex !== -1), { items: items, applicableSpan: applicableSpan, selectedItemIndex: selectedItemIndex, argumentIndex: argumentIndex, argumentCount: argumentCount } } var ArgumentListKind; !function (ArgumentListKind) { ArgumentListKind[ArgumentListKind.TypeArguments = 0] = "TypeArguments", ArgumentListKind[ArgumentListKind.CallArguments = 1] = "CallArguments", ArgumentListKind[ArgumentListKind.TaggedTemplateArguments = 2] = "TaggedTemplateArguments", ArgumentListKind[ArgumentListKind.JSXAttributesArguments = 3] = "JSXAttributesArguments" }(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {})), SignatureHelp.getSignatureHelpItems = getSignatureHelpItems, SignatureHelp.getImmediatelyContainingArgumentInfo = getImmediatelyContainingArgumentInfo, SignatureHelp.getContainingArgumentInfo = getContainingArgumentInfo; var signatureHelpNodeBuilderFlags = 3137536 }(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {})) }(ts || (ts = {})); var ts; !function (ts) { function computeSuggestionDiagnostics(sourceFile, program) { function check(node) { switch (node.kind) { case 233: case 191: if (isJsFile) { var symbol = node.symbol; symbol.members && symbol.members.size > 0 && diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration)) } }!isJsFile && ts.codefix.parameterShouldGetTypeFromJSDoc(node) && diags.push(ts.createDiagnosticForNode(node.name || node, ts.Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types)), node.forEachChild(check) } program.getSemanticDiagnostics(sourceFile); var checker = program.getDiagnosticsProducingTypeChecker(), diags = []; sourceFile.commonJsModuleIndicator && (ts.programContainsEs6Modules(program) || ts.compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile) && diags.push(ts.createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), ts.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module)); var isJsFile = ts.isSourceFileJavaScript(sourceFile); if (check(sourceFile), !isJsFile) for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; if (ts.isVariableStatement(statement) && 2 & statement.declarationList.flags && 1 === statement.declarationList.declarations.length) { var init = statement.declarationList.declarations[0].initializer; init && ts.isRequireCall(init, !0) && diags.push(ts.createDiagnosticForNode(init, ts.Diagnostics.require_call_may_be_converted_to_an_import)) } } if (ts.getAllowSyntheticDefaultImports(program.getCompilerOptions())) for (var _b = 0, _c = sourceFile.imports; _b < _c.length; _b++) { var moduleSpecifier = _c[_b], importNode = ts.importFromModuleSpecifier(moduleSpecifier), name = importNameForConvertToDefaultImport(importNode); if (name) { var module_2 = ts.getResolvedModule(sourceFile, moduleSpecifier.text), resolvedFile = module_2 && program.getSourceFile(module_2.resolvedFileName); resolvedFile && resolvedFile.externalModuleIndicator && ts.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals && diags.push(ts.createDiagnosticForNode(name, ts.Diagnostics.Import_may_be_converted_to_a_default_import)) } } return ts.addRange(diags, sourceFile.bindSuggestionDiagnostics), diags.concat(checker.getSuggestionDiagnostics(sourceFile)).sort(function (d1, d2) { return d1.start - d2.start }) } function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { case 213: return statement.declarationList.declarations.some(function (decl) { return ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), !0) }); case 215: var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, !0); var kind = ts.getSpecialPropertyAssignmentKind(expression); return 1 === kind || 2 === kind; default: return !1 } }) } function propertyAccessLeftHandSide(node) { return ts.isPropertyAccessExpression(node) ? propertyAccessLeftHandSide(node.expression) : node } function importNameForConvertToDefaultImport(node) { switch (node.kind) { case 243: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; return importClause && !importClause.name && 245 === importClause.namedBindings.kind && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : void 0; case 242: return node.name; default: return } } function getErrorNodeFromCommonJsIndicator(commonJsModuleIndicator) { return ts.isBinaryExpression(commonJsModuleIndicator) ? commonJsModuleIndicator.left : commonJsModuleIndicator } ts.computeSuggestionDiagnostics = computeSuggestionDiagnostics }(ts || (ts = {})); var ts; !function (ts) { var SymbolDisplay; !function (SymbolDisplay) { function getSymbolKind(typeChecker, symbol, location) { var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); if ("" !== result) return result; var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); return 32 & flags ? ts.getDeclarationOfKind(symbol, 204) ? "local class" : "class" : 384 & flags ? "enum" : 524288 & flags ? "type" : 64 & flags ? "interface" : 262144 & flags ? "type parameter" : 262144 & flags ? "type parameter" : 8 & flags ? "enum member" : 2097152 & flags ? "alias" : 1536 & flags ? "module" : result } function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) { var roots = typeChecker.getRootSymbols(symbol); if (1 === roots.length && 8192 & ts.first(roots).flags && 0 !== typeChecker.getTypeOfSymbolAtLocation(symbol, location).getNonNullableType().getCallSignatures().length) return "method"; if (typeChecker.isUndefinedSymbol(symbol)) return "var"; if (typeChecker.isArgumentsSymbol(symbol)) return "local var"; if (99 === location.kind && ts.isExpression(location)) return "parameter"; var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (3 & flags) return ts.isFirstDeclarationOfSymbolParameter(symbol) ? "parameter" : symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration) ? "const" : ts.forEach(symbol.declarations, ts.isLet) ? "let" : isLocalVariableOrFunction(symbol) ? "local var" : "var"; if (16 & flags) return isLocalVariableOrFunction(symbol) ? "local function" : "function"; if (32768 & flags) return "getter"; if (65536 & flags) return "setter"; if (8192 & flags) return "method"; if (16384 & flags) return "constructor"; if (4 & flags) { if (33554432 & flags && 6 & symbol.checkFlags) { var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); return 98311 & rootSymbolFlags ? "property" : void ts.Debug.assert(!!(8208 & rootSymbolFlags)) }); if (!unionPropertyKind) { var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); return typeOfUnionProperty.getCallSignatures().length ? "method" : "property" } return unionPropertyKind } switch (location.parent && location.parent.kind) { case 256: case 254: case 255: return 71 === location.kind ? "property" : "JSX attribute"; case 261: return "JSX attribute"; default: return "property" } } return "" } function getSymbolModifiers(symbol) { var nodeModifiers = symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : "", symbolModifiers = symbol && 16777216 & symbol.flags ? "optional" : ""; return nodeModifiers && symbolModifiers ? nodeModifiers + "," + symbolModifiers : nodeModifiers || symbolModifiers } function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning, alias) { function getPrinter() { return printer || (printer = ts.createPrinter({ removeComments: !0 })), printer } function prefixNextMeaning() { displayParts.length && displayParts.push(ts.lineBreakPart()), addAliasPrefixIfNecessary() } function addAliasPrefixIfNecessary() { alias && (pushSymbolKind("alias"), displayParts.push(ts.spacePart())) } function addInPrefix() { displayParts.push(ts.spacePart()), displayParts.push(ts.keywordPart(92)), displayParts.push(ts.spacePart()) } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { alias && symbolToDisplay === symbol && (symbolToDisplay = alias); var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, void 0, 7); ts.addRange(displayParts, fullSymbolDisplayParts), 16777216 & symbol.flags && displayParts.push(ts.punctuationPart(55)) } function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { prefixNextMeaning(), symbolKind && (pushSymbolKind(symbolKind), symbol && !ts.some(symbol.declarations, function (d) { return ts.isArrowFunction(d) || (ts.isFunctionExpression(d) || ts.isClassExpression(d)) && !d.name }) && (displayParts.push(ts.spacePart()), addFullSymbolName(symbol))) } function pushSymbolKind(symbolKind) { switch (symbolKind) { case "var": case "function": case "let": case "const": case "constructor": return void displayParts.push(ts.textOrKeywordPart(symbolKind)); default: return displayParts.push(ts.punctuationPart(19)), displayParts.push(ts.textOrKeywordPart(symbolKind)), void displayParts.push(ts.punctuationPart(20)) } } function addSignatureDisplayParts(signature, allSignatures, flags) { ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, 32 | flags)), allSignatures.length > 1 && (displayParts.push(ts.spacePart()), displayParts.push(ts.punctuationPart(19)), displayParts.push(ts.operatorPart(37)), displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), ts.SymbolDisplayPartKind.numericLiteral)), displayParts.push(ts.spacePart()), displayParts.push(ts.textPart(2 === allSignatures.length ? "overload" : "overloads")), displayParts.push(ts.punctuationPart(20))), documentation = signature.getDocumentationComment(typeChecker), tags = signature.getJsDocTags() } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var params = typeChecker.symbolToTypeParameterDeclarations(symbol, enclosingDeclaration); getPrinter().writeList(26896, params, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer) }); ts.addRange(displayParts, typeParameterParts) } void 0 === semanticMeaning && (semanticMeaning = ts.getMeaningFromLocation(location)); var documentation, tags, hasAddedSymbolInfo, type, printer, documentationFromAlias, tagsFromAlias, displayParts = [], symbolFlags = ts.getCombinedLocalAndExportSymbolFlags(symbol), symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location), isThisExpression = 99 === location.kind && ts.isExpression(location); if ("" !== symbolKind || 32 & symbolFlags || 2097152 & symbolFlags) { "getter" !== symbolKind && "setter" !== symbolKind || (symbolKind = "property"); var signature = void 0; if (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location), location.parent && 184 === location.parent.kind) { var right = location.parent.name; (right === location || right && 0 === right.getFullWidth()) && (location = location.parent) } var callExpressionLike = void 0; if (ts.isCallOrNewExpression(location) ? callExpressionLike = location : ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location) ? callExpressionLike = location.parent : location.parent && ts.isJsxOpeningLikeElement(location.parent) && ts.isFunctionLike(symbol.valueDeclaration) && (callExpressionLike = location.parent), callExpressionLike) { var candidateSignatures = []; signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); var useConstructSignatures = 187 === callExpressionLike.kind || ts.isCallExpression(callExpressionLike) && 97 === callExpressionLike.expression.kind, allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (ts.contains(allSignatures, signature.target) || ts.contains(allSignatures, signature) || (signature = allSignatures.length ? allSignatures[0] : void 0), signature) { switch (useConstructSignatures && 32 & symbolFlags ? (symbolKind = "constructor", addPrefixForAnyFunctionOrVar(type.symbol, symbolKind)) : 2097152 & symbolFlags ? (symbolKind = "alias", pushSymbolKind(symbolKind), displayParts.push(ts.spacePart()), useConstructSignatures && (displayParts.push(ts.keywordPart(94)), displayParts.push(ts.spacePart())), addFullSymbolName(symbol)) : addPrefixForAnyFunctionOrVar(symbol, symbolKind), symbolKind) { case "JSX attribute": case "property": case "var": case "const": case "let": case "parameter": case "local var": displayParts.push(ts.punctuationPart(56)), displayParts.push(ts.spacePart()), 16 & ts.getObjectFlags(type) || !type.symbol || (ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, void 0, 5)), displayParts.push(ts.lineBreakPart())), useConstructSignatures && (displayParts.push(ts.keywordPart(94)), displayParts.push(ts.spacePart())), addSignatureDisplayParts(signature, allSignatures, 262144); break; default: addSignatureDisplayParts(signature, allSignatures) }hasAddedSymbolInfo = !0 } } else if (ts.isNameOfFunctionDeclaration(location) && !(98304 & symbolFlags) || 123 === location.kind && 154 === location.parent.kind) { var functionDeclaration_1 = location.parent, locationIsSymbolDeclaration = ts.find(symbol.declarations, function (declaration) { return declaration === (123 === location.kind ? functionDeclaration_1.parent : functionDeclaration_1) }); if (locationIsSymbolDeclaration) { var allSignatures = 154 === functionDeclaration_1.kind ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); signature = typeChecker.isImplementationOfOverload(functionDeclaration_1) ? allSignatures[0] : typeChecker.getSignatureFromDeclaration(functionDeclaration_1), 154 === functionDeclaration_1.kind ? (symbolKind = "constructor", addPrefixForAnyFunctionOrVar(type.symbol, symbolKind)) : addPrefixForAnyFunctionOrVar(157 !== functionDeclaration_1.kind || 2048 & type.symbol.flags || 4096 & type.symbol.flags ? symbol : type.symbol, symbolKind), addSignatureDisplayParts(signature, allSignatures), hasAddedSymbolInfo = !0 } } } if (32 & symbolFlags && !hasAddedSymbolInfo && !isThisExpression && (addAliasPrefixIfNecessary(), ts.getDeclarationOfKind(symbol, 204) ? pushSymbolKind("local class") : displayParts.push(ts.keywordPart(75)), displayParts.push(ts.spacePart()), addFullSymbolName(symbol), writeTypeParametersOfSymbol(symbol, sourceFile)), 64 & symbolFlags && 2 & semanticMeaning && (prefixNextMeaning(), displayParts.push(ts.keywordPart(109)), displayParts.push(ts.spacePart()), addFullSymbolName(symbol), writeTypeParametersOfSymbol(symbol, sourceFile)), 524288 & symbolFlags && (prefixNextMeaning(), displayParts.push(ts.keywordPart(139)), displayParts.push(ts.spacePart()), addFullSymbolName(symbol), writeTypeParametersOfSymbol(symbol, sourceFile), displayParts.push(ts.spacePart()), displayParts.push(ts.operatorPart(58)), displayParts.push(ts.spacePart()), ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608))), 384 & symbolFlags && (prefixNextMeaning(), ts.forEach(symbol.declarations, ts.isConstEnumDeclaration) && (displayParts.push(ts.keywordPart(76)), displayParts.push(ts.spacePart())), displayParts.push(ts.keywordPart(83)), displayParts.push(ts.spacePart()), addFullSymbolName(symbol)), 1536 & symbolFlags) { prefixNextMeaning(); var declaration = ts.getDeclarationOfKind(symbol, 238), isNamespace = declaration && declaration.name && 71 === declaration.name.kind; displayParts.push(ts.keywordPart(isNamespace ? 130 : 129)), displayParts.push(ts.spacePart()), addFullSymbolName(symbol) } if (262144 & symbolFlags && 2 & semanticMeaning) if (prefixNextMeaning(), displayParts.push(ts.punctuationPart(19)), displayParts.push(ts.textPart("type parameter")), displayParts.push(ts.punctuationPart(20)), displayParts.push(ts.spacePart()), addFullSymbolName(symbol), symbol.parent) addInPrefix(), addFullSymbolName(symbol.parent, enclosingDeclaration), writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); else { var decl = ts.getDeclarationOfKind(symbol, 147); ts.Debug.assert(void 0 !== decl); var declaration = decl.parent; if (declaration) if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); 158 === declaration.kind ? (displayParts.push(ts.keywordPart(94)), displayParts.push(ts.spacePart())) : 157 !== declaration.kind && declaration.name && addFullSymbolName(declaration.symbol), ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)) } else 236 === declaration.kind && (addInPrefix(), displayParts.push(ts.keywordPart(139)), displayParts.push(ts.spacePart()), addFullSymbolName(declaration.symbol), writeTypeParametersOfSymbol(declaration.symbol, sourceFile)) } if (8 & symbolFlags) { symbolKind = "enum member", addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; if (272 === declaration.kind) { var constantValue = typeChecker.getConstantValue(declaration); void 0 !== constantValue && (displayParts.push(ts.spacePart()), displayParts.push(ts.operatorPart(58)), displayParts.push(ts.spacePart()), displayParts.push(ts.displayPart(ts.getTextOfConstantValue(constantValue), "number" == typeof constantValue ? ts.SymbolDisplayPartKind.numericLiteral : ts.SymbolDisplayPartKind.stringLiteral))) } } if (2097152 & symbolFlags) { if (prefixNextMeaning(), !hasAddedSymbolInfo) { var resolvedSymbol = typeChecker.getAliasedSymbol(symbol); if (resolvedSymbol !== symbol && resolvedSymbol.declarations && resolvedSymbol.declarations.length > 0) { var resolvedNode = resolvedSymbol.declarations[0], declarationName = ts.getNameOfDeclaration(resolvedNode); if (declarationName) { var isExternalModuleDeclaration = ts.isModuleWithStringLiteralName(resolvedNode) && ts.hasModifier(resolvedNode, 2), shouldUseAliasName = "default" !== symbol.name && !isExternalModuleDeclaration, resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, resolvedSymbol, ts.getSourceFileOfNode(resolvedNode), resolvedNode, declarationName, semanticMeaning, shouldUseAliasName ? symbol : resolvedSymbol); displayParts.push.apply(displayParts, resolvedInfo.displayParts), displayParts.push(ts.lineBreakPart()), documentationFromAlias = resolvedInfo.documentation, tagsFromAlias = resolvedInfo.tags } } } switch (symbol.declarations[0].kind) { case 241: displayParts.push(ts.keywordPart(84)), displayParts.push(ts.spacePart()), displayParts.push(ts.keywordPart(130)); break; case 248: displayParts.push(ts.keywordPart(84)), displayParts.push(ts.spacePart()), displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 58 : 79)); break; case 251: displayParts.push(ts.keywordPart(84)); break; default: displayParts.push(ts.keywordPart(91)) }displayParts.push(ts.spacePart()), addFullSymbolName(symbol), ts.forEach(symbol.declarations, function (declaration) { if (242 === declaration.kind) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) displayParts.push(ts.spacePart()), displayParts.push(ts.operatorPart(58)), displayParts.push(ts.spacePart()), displayParts.push(ts.keywordPart(133)), displayParts.push(ts.punctuationPart(19)), displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)), displayParts.push(ts.punctuationPart(20)); else { var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); internalAliasSymbol && (displayParts.push(ts.spacePart()), displayParts.push(ts.operatorPart(58)), displayParts.push(ts.spacePart()), addFullSymbolName(internalAliasSymbol, enclosingDeclaration)) } return !0 } }) } if (!hasAddedSymbolInfo) if ("" !== symbolKind) { if (type) if (isThisExpression ? (prefixNextMeaning(), displayParts.push(ts.keywordPart(99))) : addPrefixForAnyFunctionOrVar(symbol, symbolKind), "property" === symbolKind || "JSX attribute" === symbolKind || 3 & symbolFlags || "local var" === symbolKind || isThisExpression) if (displayParts.push(ts.punctuationPart(56)), displayParts.push(ts.spacePart()), type.symbol && 262144 & type.symbol.flags) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration); getPrinter().writeNode(4, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer) }); ts.addRange(displayParts, typeParameterParts) } else ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration)); else if (16 & symbolFlags || 8192 & symbolFlags || 16384 & symbolFlags || 131072 & symbolFlags || 98304 & symbolFlags || "method" === symbolKind) { var allSignatures = type.getNonNullableType().getCallSignatures(); allSignatures.length && addSignatureDisplayParts(allSignatures[0], allSignatures) } } else symbolKind = getSymbolKind(typeChecker, symbol, location); if (!documentation && (documentation = symbol.getDocumentationComment(typeChecker), tags = symbol.getJsDocTags(), 0 === documentation.length && 4 & symbolFlags && symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return 273 === declaration.kind }))) for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (declaration.parent && 199 === declaration.parent.kind) { var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); if (rhsSymbol && (documentation = rhsSymbol.getDocumentationComment(typeChecker), tags = rhsSymbol.getJsDocTags(), documentation.length > 0)) break } } return 0 === documentation.length && documentationFromAlias && (documentation = documentationFromAlias), 0 === tags.length && tagsFromAlias && (tags = tagsFromAlias), { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags } } function isLocalVariableOrFunction(symbol) { return !symbol.parent && ts.forEach(symbol.declarations, function (declaration) { if (191 === declaration.kind) return !0; if (231 !== declaration.kind && 233 !== declaration.kind) return !1; for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent)if (273 === parent.kind || 239 === parent.kind) return !1; return !0 }) } SymbolDisplay.getSymbolKind = getSymbolKind, SymbolDisplay.getSymbolModifiers = getSymbolModifiers, SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind }(SymbolDisplay = ts.SymbolDisplay || (ts.SymbolDisplay = {})) }(ts || (ts = {})); var ts; !function (ts) { function transpileModule(input, transpileOptions) { var diagnostics = [], options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions(); options.isolatedModules = !0, options.suppressOutputPathCheck = !0, options.allowNonTsExtensions = !0, options.noLib = !0, options.lib = void 0, options.types = void 0, options.noEmit = void 0, options.noEmitOnError = void 0, options.paths = void 0, options.rootDirs = void 0, options.declaration = void 0, options.declarationDir = void 0, options.out = void 0, options.outFile = void 0, options.noResolve = !0; var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"), sourceFile = ts.createSourceFile(inputFileName, input, options.target); transpileOptions.moduleName && (sourceFile.moduleName = transpileOptions.moduleName), transpileOptions.renamedDependencies && (sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies)); var outputText, sourceMapText, newLine = ts.getNewLineCharacter(options), compilerHost = { getSourceFile: function (fileName) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : void 0 }, writeFile: function (name, text) { ts.fileExtensionIs(name, ".map") ? (ts.Debug.assertEqual(sourceMapText, void 0, "Unexpected multiple source map outputs, file:", name), sourceMapText = text) : (ts.Debug.assertEqual(outputText, void 0, "Unexpected multiple outputs, file:", name), outputText = text) }, getDefaultLibFileName: function () { return "lib.d.ts" }, useCaseSensitiveFileNames: function () { return !1 }, getCanonicalFileName: function (fileName) { return fileName }, getCurrentDirectory: function () { return "" }, getNewLine: function () { return newLine }, fileExists: function (fileName) { return fileName === inputFileName }, readFile: function () { return "" }, directoryExists: function () { return !0 }, getDirectories: function () { return [] } }, program = ts.createProgram([inputFileName], options, compilerHost); return transpileOptions.reportDiagnostics && (ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile)), ts.addRange(diagnostics, program.getOptionsDiagnostics())), program.emit(void 0, void 0, void 0, void 0, transpileOptions.transformers), ts.Debug.assert(void 0 !== outputText, "Output generation failed"), { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText } } function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName }); return ts.addRange(diagnostics, output.diagnostics), output.outputText } function fixupCompilerOptions(options, diagnostics) { commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { return "object" == typeof o.type && !ts.forEachEntry(o.type, function (v) { return "number" != typeof v }) }), options = ts.cloneCompilerOptions(options); for (var _loop_18 = function (opt) { if (!ts.hasProperty(options, opt.name)) return "continue"; var value = options[opt.name]; ts.isString(value) ? options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics) : ts.forEachEntry(opt.type, function (v) { return v === value }) || diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)) }, _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; _loop_18(opt) } return options } ts.transpileModule = transpileModule, ts.transpile = transpile; var commandLineOptionsStringToEnum; ts.fixupCompilerOptions = fixupCompilerOptions }(ts || (ts = {})); var ts; !function (ts) { var formatting; !function (formatting) { var FormattingRequestKind; !function (FormattingRequestKind) { FormattingRequestKind[FormattingRequestKind.FormatDocument = 0] = "FormatDocument", FormattingRequestKind[FormattingRequestKind.FormatSelection = 1] = "FormatSelection", FormattingRequestKind[FormattingRequestKind.FormatOnEnter = 2] = "FormatOnEnter", FormattingRequestKind[FormattingRequestKind.FormatOnSemicolon = 3] = "FormatOnSemicolon", FormattingRequestKind[FormattingRequestKind.FormatOnOpeningCurlyBrace = 4] = "FormatOnOpeningCurlyBrace", FormattingRequestKind[FormattingRequestKind.FormatOnClosingCurlyBrace = 5] = "FormatOnClosingCurlyBrace" }(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); var FormattingContext = function () { function FormattingContext(sourceFile, formattingRequestKind, options) { this.sourceFile = sourceFile, this.formattingRequestKind = formattingRequestKind, this.options = options } return FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) { ts.Debug.assert(void 0 !== currentRange, "currentTokenSpan is null"), ts.Debug.assert(void 0 !== currentTokenParent, "currentTokenParent is null"), ts.Debug.assert(void 0 !== nextRange, "nextTokenSpan is null"), ts.Debug.assert(void 0 !== nextTokenParent, "nextTokenParent is null"), ts.Debug.assert(void 0 !== commonParent, "commonParent is null"), this.currentTokenSpan = currentRange, this.currentTokenParent = currentTokenParent, this.nextTokenSpan = nextRange, this.nextTokenParent = nextTokenParent, this.contextNode = commonParent, this.contextNodeAllOnSameLine = void 0, this.nextNodeAllOnSameLine = void 0, this.tokensAreOnSameLine = void 0, this.contextNodeBlockIsOnOneLine = void 0, this.nextNodeBlockIsOnOneLine = void 0 }, FormattingContext.prototype.ContextNodeAllOnSameLine = function () { return void 0 === this.contextNodeAllOnSameLine && (this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode)), this.contextNodeAllOnSameLine }, FormattingContext.prototype.NextNodeAllOnSameLine = function () { return void 0 === this.nextNodeAllOnSameLine && (this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent)), this.nextNodeAllOnSameLine }, FormattingContext.prototype.TokensAreOnSameLine = function () { if (void 0 === this.tokensAreOnSameLine) { var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line, endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = startLine === endLine } return this.tokensAreOnSameLine }, FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () { return void 0 === this.contextNodeBlockIsOnOneLine && (this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode)), this.contextNodeBlockIsOnOneLine }, FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () { return void 0 === this.nextNodeBlockIsOnOneLine && (this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent)), this.nextNodeBlockIsOnOneLine }, FormattingContext.prototype.NodeIsOnOneLine = function (node) { var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line, endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine === endLine }, FormattingContext.prototype.BlockIsOnOneLine = function (node) { var openBrace = ts.findChildOfKind(node, 17, this.sourceFile), closeBrace = ts.findChildOfKind(node, 18, this.sourceFile); if (openBrace && closeBrace) { var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line, endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine } return !1 }, FormattingContext }(); formatting.FormattingContext = FormattingContext }(formatting = ts.formatting || (ts.formatting = {})) }(ts || (ts = {})); var ts; !function (ts) { var formatting; !function (formatting) { function getFormattingScanner(text, languageVariant, startPos, endPos, cb) { function advance() { lastTokenInfo = void 0; var isStarted = scanner.getStartPos() !== startPos; isStarted ? wasNewLine = trailingTrivia && 4 === ts.lastOrUndefined(trailingTrivia).kind : scanner.scan(), leadingTrivia = void 0, trailingTrivia = void 0; for (var pos = scanner.getStartPos(); pos < endPos;) { var t = scanner.getToken(); if (!ts.isTrivia(t)) break; scanner.scan(); var item = { pos: pos, end: scanner.getStartPos(), kind: t }; pos = scanner.getStartPos(), leadingTrivia = ts.append(leadingTrivia, item) } savedPos = scanner.getStartPos() } function shouldRescanGreaterThanToken(node) { switch (node.kind) { case 31: case 66: case 67: case 47: case 46: return !0 }return !1 } function shouldRescanJsxIdentifier(node) { if (node.parent) switch (node.parent.kind) { case 261: case 256: case 257: case 255: return ts.isKeyword(node.kind) || 71 === node.kind }return !1 } function shouldRescanJsxText(node) { return 10 === node.kind } function shouldRescanSlashToken(container) { return 12 === container.kind } function shouldRescanTemplateToken(container) { return 15 === container.kind || 16 === container.kind } function startsWithSlashToken(t) { return 41 === t || 63 === t } function readTokenInfo(n) { ts.Debug.assert(isOnToken()); var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : shouldRescanJsxIdentifier(n) ? 4 : shouldRescanJsxText(n) ? 5 : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) return fixTokenKind(lastTokenInfo, n); scanner.getStartPos() !== savedPos && (ts.Debug.assert(void 0 !== lastTokenInfo), scanner.setTextPos(savedPos), scanner.scan()); var currentToken = getNextToken(n, expectedScanAction), token = { pos: scanner.getStartPos(), end: scanner.getTextPos(), kind: currentToken }; for (trailingTrivia && (trailingTrivia = void 0); scanner.getStartPos() < endPos && (currentToken = scanner.scan(), ts.isTrivia(currentToken));) { var trivia = { pos: scanner.getStartPos(), end: scanner.getTextPos(), kind: currentToken }; if (trailingTrivia || (trailingTrivia = []), trailingTrivia.push(trivia), 4 === currentToken) { scanner.scan(); break } } return lastTokenInfo = { leadingTrivia: leadingTrivia, trailingTrivia: trailingTrivia, token: token }, fixTokenKind(lastTokenInfo, n) } function getNextToken(n, expectedScanAction) { var token = scanner.getToken(); switch (lastScanAction = 0, expectedScanAction) { case 1: if (29 === token) { lastScanAction = 1; var newToken = scanner.reScanGreaterToken(); return ts.Debug.assert(n.kind === newToken), newToken } break; case 2: if (startsWithSlashToken(token)) { lastScanAction = 2; var newToken = scanner.reScanSlashToken(); return ts.Debug.assert(n.kind === newToken), newToken } break; case 3: if (18 === token) return lastScanAction = 3, scanner.reScanTemplateToken(); break; case 4: return lastScanAction = 4, scanner.scanJsxIdentifier(); case 5: return lastScanAction = 5, scanner.reScanJsxToken(); case 0: break; default: ts.Debug.assertNever(expectedScanAction) }return token } function isOnToken() { var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken(), startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos(); return startPos < endPos && 1 !== current && !ts.isTrivia(current) } function fixTokenKind(tokenInfo, container) { return ts.isToken(container) && tokenInfo.token.kind !== container.kind && (tokenInfo.token.kind = container.kind), tokenInfo } function skipToEndOf(node) { scanner.setTextPos(node.end), savedPos = scanner.getStartPos(), lastScanAction = void 0, lastTokenInfo = void 0, wasNewLine = !1, leadingTrivia = void 0, trailingTrivia = void 0 } var scanner = 1 === languageVariant ? jsxScanner : standardScanner; scanner.setText(text), scanner.setTextPos(startPos); var leadingTrivia, trailingTrivia, savedPos, lastScanAction, lastTokenInfo, wasNewLine = !0, res = cb({ advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, getCurrentLeadingTrivia: function () { return leadingTrivia }, lastTrailingTriviaWasNewLine: function () { return wasNewLine }, skipToEndOf: skipToEndOf }); return lastTokenInfo = void 0, scanner.setText(void 0), res } var ScanAction, standardScanner = ts.createScanner(6, !1, 0), jsxScanner = ts.createScanner(6, !1, 1); !function (ScanAction) { ScanAction[ScanAction.Scan = 0] = "Scan", ScanAction[ScanAction.RescanGreaterThanToken = 1] = "RescanGreaterThanToken", ScanAction[ScanAction.RescanSlashToken = 2] = "RescanSlashToken", ScanAction[ScanAction.RescanTemplateToken = 3] = "RescanTemplateToken", ScanAction[ScanAction.RescanJsxIdentifier = 4] = "RescanJsxIdentifier", ScanAction[ScanAction.RescanJsxText = 5] = "RescanJsxText" }(ScanAction || (ScanAction = {})), formatting.getFormattingScanner = getFormattingScanner }(formatting = ts.formatting || (ts.formatting = {})) }(ts || (ts = {})); var ts; !function (ts) { var formatting; !function (formatting) { formatting.anyContext = ts.emptyArray; var RuleAction; !function (RuleAction) { RuleAction[RuleAction.Ignore = 1] = "Ignore", RuleAction[RuleAction.Space = 2] = "Space", RuleAction[RuleAction.NewLine = 4] = "NewLine", RuleAction[RuleAction.Delete = 8] = "Delete" }(RuleAction = formatting.RuleAction || (formatting.RuleAction = {})); var RuleFlags; !function (RuleFlags) { RuleFlags[RuleFlags.None = 0] = "None", RuleFlags[RuleFlags.CanDeleteNewLines = 1] = "CanDeleteNewLines" }(RuleFlags = formatting.RuleFlags || (formatting.RuleFlags = {})) }(formatting = ts.formatting || (ts.formatting = {})) }(ts || (ts = {})); var ts; !function (ts) { var formatting; !function (formatting) { function getAllRules() { function anyTokenExcept() { for (var tokens = [], _i = 0; _i < arguments.length; _i++)tokens[_i] = arguments[_i]; return { tokens: allTokens.filter(function (t) { return !tokens.some(function (t2) { return t2 === t }) }), isSpecific: !1 } } for (var allTokens = [], token = 0; token <= 144; token++)allTokens.push(token); var anyToken = { tokens: allTokens, isSpecific: !1 }, anyTokenIncludingMultilineComments = tokenRangeFrom(allTokens.concat([3])), keywords = tokenRangeFromRange(72, 144), binaryOperators = tokenRangeFromRange(27, 70), binaryKeywordOperators = [92, 93, 144, 118, 127], unaryPrefixOperators = [43, 44, 52, 51], unaryPrefixExpressions = [8, 71, 19, 21, 17, 99, 94], unaryPreincrementExpressions = [71, 19, 99, 94], unaryPostincrementExpressions = [71, 20, 22, 94], unaryPredecrementExpressions = [71, 19, 99, 94], unaryPostdecrementExpressions = [71, 20, 22, 94], comments = [2, 3], typeNames = [71].concat(ts.typeKeywords), functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments, typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([71, 3, 75, 84, 91]), controlOpenBraceLeftTokenRange = tokenRangeFrom([20, 3, 81, 102, 87, 82]), highPriorityCommonRules = [rule("IgnoreBeforeComment", anyToken, comments, formatting.anyContext, 1), rule("IgnoreAfterLineComment", 2, anyToken, formatting.anyContext, 1), rule("NotSpaceBeforeColon", anyToken, 56, [isNonJsxSameLineTokenContext, isNotBinaryOpContext, isNotTypeAnnotationContext], 8), rule("SpaceAfterColon", 56, anyToken, [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 2), rule("NoSpaceBeforeQuestionMark", anyToken, 55, [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8), rule("SpaceAfterQuestionMarkInConditionalOperator", 55, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 2), rule("NoSpaceAfterQuestionMark", 55, anyToken, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeDot", anyToken, 23, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterDot", 23, anyToken, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceBetweenImportParenInImportType", 91, 19, [isNonJsxSameLineTokenContext, isImportTypeContext], 8), rule("NoSpaceAfterUnaryPrefixOperator", unaryPrefixOperators, unaryPrefixExpressions, [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8), rule("NoSpaceAfterUnaryPreincrementOperator", 43, unaryPreincrementExpressions, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterUnaryPredecrementOperator", 44, unaryPredecrementExpressions, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeUnaryPostincrementOperator", unaryPostincrementExpressions, 43, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeUnaryPostdecrementOperator", unaryPostdecrementExpressions, 44, [isNonJsxSameLineTokenContext], 8), rule("SpaceAfterPostincrementWhenFollowedByAdd", 43, 37, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterAddWhenFollowedByUnaryPlus", 37, 37, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterAddWhenFollowedByPreincrement", 37, 43, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterPostdecrementWhenFollowedBySubtract", 44, 38, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterSubtractWhenFollowedByUnaryMinus", 38, 38, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterSubtractWhenFollowedByPredecrement", 38, 44, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("NoSpaceAfterCloseBrace", 18, [26, 25], [isNonJsxSameLineTokenContext], 8), rule("NewLineBeforeCloseBraceInBlockContext", anyTokenIncludingMultilineComments, 18, [isMultilineBlockContext], 4), rule("SpaceAfterCloseBrace", 18, anyTokenExcept(20), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 2), rule("SpaceBetweenCloseBraceAndElse", 18, 82, [isNonJsxSameLineTokenContext], 2), rule("SpaceBetweenCloseBraceAndWhile", 18, 106, [isNonJsxSameLineTokenContext], 2), rule("NoSpaceBetweenEmptyBraceBrackets", 17, 18, [isNonJsxSameLineTokenContext, isObjectContext], 8), rule("SpaceAfterConditionalClosingParen", 20, 21, [isControlDeclContext], 2), rule("NoSpaceBetweenFunctionKeywordAndStar", 89, 39, [isFunctionDeclarationOrFunctionExpressionContext], 8), rule("SpaceAfterStarInGeneratorDeclaration", 39, [71, 19], [isFunctionDeclarationOrFunctionExpressionContext], 2), rule("SpaceAfterFunctionInFuncDecl", 89, anyToken, [isFunctionDeclContext], 2), rule("NewLineAfterOpenBraceInBlockContext", 17, anyToken, [isMultilineBlockContext], 4), rule("SpaceAfterGetSetInMember", [125, 136], 71, [isFunctionDeclContext], 2), rule("NoSpaceBetweenYieldKeywordAndStar", 116, 39, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8), rule("SpaceBetweenYieldOrYieldStarAndOperand", [116, 39], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2), rule("NoSpaceBetweenReturnAndSemicolon", 96, 25, [isNonJsxSameLineTokenContext], 8), rule("SpaceAfterCertainKeywords", [104, 100, 94, 80, 96, 103, 121], anyToken, [isNonJsxSameLineTokenContext], 2), rule("SpaceAfterLetConstInVariableDeclaration", [110, 76], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 19, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 8), rule("SpaceBeforeBinaryKeywordOperator", anyToken, binaryKeywordOperators, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterVoidOperator", 105, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2), rule("SpaceBetweenAsyncAndOpenParen", 120, 19, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2), rule("SpaceBetweenAsyncAndFunctionKeyword", 120, 89, [isNonJsxSameLineTokenContext], 2), rule("NoSpaceBetweenTagAndTemplateString", [71, 20], [13, 14], [isNonJsxSameLineTokenContext], 8), rule("SpaceBeforeJsxAttribute", anyToken, 71, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2), rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 41, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 2), rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 41, 29, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 58, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterEqualInJsxAttribute", 58, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterModuleImport", [129, 133], 19, [isNonJsxSameLineTokenContext], 8), rule("SpaceAfterCertainTypeScriptKeywords", [117, 75, 124, 79, 83, 84, 85, 125, 108, 91, 109, 129, 130, 112, 114, 113, 132, 136, 115, 139, 142, 128, 126], anyToken, [isNonJsxSameLineTokenContext], 2), rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [85, 108, 142], [isNonJsxSameLineTokenContext], 2), rule("SpaceAfterModuleName", 9, 17, [isModuleDeclContext], 2), rule("SpaceBeforeArrow", anyToken, 36, [isNonJsxSameLineTokenContext], 2), rule("SpaceAfterArrow", 36, anyToken, [isNonJsxSameLineTokenContext], 2), rule("NoSpaceAfterEllipsis", 24, 71, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterOptionalParameters", 55, [20, 26], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8), rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 17, 18, [isNonJsxSameLineTokenContext, isObjectTypeContext], 8), rule("NoSpaceBeforeOpenAngularBracket", typeNames, 27, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), rule("NoSpaceBetweenCloseParenAndAngularBracket", 20, 27, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), rule("NoSpaceAfterOpenAngularBracket", 27, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), rule("NoSpaceBeforeCloseAngularBracket", anyToken, 29, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8), rule("NoSpaceAfterCloseAngularBracket", 29, [19, 21, 29, 26], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext], 8), rule("SpaceBeforeAt", [20, 71], 57, [isNonJsxSameLineTokenContext], 2), rule("NoSpaceAfterAt", 57, anyToken, [isNonJsxSameLineTokenContext], 8), rule("SpaceAfterDecorator", anyToken, [117, 71, 84, 79, 75, 115, 114, 112, 113, 125, 136, 21, 39], [isEndOfDecoratorContextOnSameLine], 2), rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 51, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 8), rule("NoSpaceAfterNewKeywordOnConstructorSignature", 94, 19, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8)], userConfigurableRules = [rule("SpaceAfterConstructor", 123, 19, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2), rule("NoSpaceAfterConstructor", 123, 19, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8), rule("SpaceAfterComma", 26, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket], 2), rule("NoSpaceAfterComma", 26, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 8), rule("SpaceAfterAnonymousFunctionKeyword", 89, 19, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2), rule("NoSpaceAfterAnonymousFunctionKeyword", 89, 19, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8), rule("SpaceAfterKeywordInControl", keywords, 19, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 2), rule("NoSpaceAfterKeywordInControl", keywords, 19, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 8), rule("SpaceAfterOpenParen", 19, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 2), rule("SpaceBeforeCloseParen", anyToken, 20, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 2), rule("SpaceBetweenOpenParens", 19, 19, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 2), rule("NoSpaceBetweenParens", 19, 20, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterOpenParen", 19, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeCloseParen", anyToken, 20, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 8), rule("SpaceAfterOpenBracket", 21, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 2), rule("SpaceBeforeCloseBracket", anyToken, 22, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 2), rule("NoSpaceBetweenBrackets", 21, 22, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterOpenBracket", 21, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeCloseBracket", anyToken, 22, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 8), rule("SpaceAfterOpenBrace", 17, anyToken, [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], 2), rule("SpaceBeforeCloseBrace", anyToken, 18, [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], 2), rule("NoSpaceBetweenEmptyBraceBrackets", 17, 18, [isNonJsxSameLineTokenContext, isObjectContext], 8), rule("NoSpaceAfterOpenBrace", 17, anyToken, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeCloseBrace", anyToken, 18, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], 8), rule("SpaceAfterTemplateHeadAndMiddle", [14, 15], anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 2), rule("SpaceBeforeTemplateMiddleAndTail", anyToken, [15, 16], [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 2), rule("NoSpaceAfterTemplateHeadAndMiddle", [14, 15], anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeTemplateMiddleAndTail", anyToken, [15, 16], [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 8), rule("SpaceAfterOpenBraceInJsxExpression", 17, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 2), rule("SpaceBeforeCloseBraceInJsxExpression", anyToken, 18, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 2), rule("NoSpaceAfterOpenBraceInJsxExpression", 17, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 8), rule("NoSpaceBeforeCloseBraceInJsxExpression", anyToken, 18, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 8), rule("SpaceAfterSemicolonInFor", 25, anyToken, [isOptionEnabled("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], 2), rule("NoSpaceAfterSemicolonInFor", 25, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], 8), rule("SpaceBeforeBinaryOperator", anyToken, binaryOperators, [isOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("SpaceAfterBinaryOperator", binaryOperators, anyToken, [isOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 2), rule("NoSpaceBeforeBinaryOperator", anyToken, binaryOperators, [isOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 8), rule("NoSpaceAfterBinaryOperator", binaryOperators, anyToken, [isOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 8), rule("SpaceBeforeOpenParenInFuncDecl", anyToken, 19, [isOptionEnabled("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], 2), rule("NoSpaceBeforeOpenParenInFuncDecl", anyToken, 19, [isOptionDisabledOrUndefined("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], 8), rule("NewLineBeforeOpenBraceInControl", controlOpenBraceLeftTokenRange, 17, [isOptionEnabled("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isBeforeMultilineBlockContext], 4, 1), rule("NewLineBeforeOpenBraceInFunction", functionOpenBraceLeftTokenRange, 17, [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeMultilineBlockContext], 4, 1), rule("NewLineBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 17, [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isBeforeMultilineBlockContext], 4, 1), rule("SpaceAfterTypeAssertion", 29, anyToken, [isOptionEnabled("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], 2), rule("NoSpaceAfterTypeAssertion", 29, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], 8), rule("SpaceBeforeTypeAnnotation", anyToken, 56, [isOptionEnabled("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], 2), rule("NoSpaceBeforeTypeAnnotation", anyToken, 56, [isOptionDisabledOrUndefined("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], 8)], lowPriorityCommonRules = [rule("NoSpaceBeforeSemicolon", anyToken, 25, [isNonJsxSameLineTokenContext], 8), rule("SpaceBeforeOpenBraceInControl", controlOpenBraceLeftTokenRange, 17, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2, 1), rule("SpaceBeforeOpenBraceInFunction", functionOpenBraceLeftTokenRange, 17, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2, 1), rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 17, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2, 1), rule("NoSpaceBeforeComma", anyToken, 26, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceBeforeOpenBracket", anyTokenExcept(120, 73), 21, [isNonJsxSameLineTokenContext], 8), rule("NoSpaceAfterCloseBracket", 22, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 8), rule("SpaceAfterSemicolon", 25, anyToken, [isNonJsxSameLineTokenContext], 2), rule("SpaceBetweenForAndAwaitKeyword", 88, 121, [isNonJsxSameLineTokenContext], 2), rule("SpaceBetweenStatements", [20, 81, 82, 73], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2), rule("SpaceAfterTryFinally", [102, 87], 17, [isNonJsxSameLineTokenContext], 2)]; return highPriorityCommonRules.concat(userConfigurableRules, lowPriorityCommonRules) } function rule(debugName, left, right, context, action, flags) { return void 0 === flags && (flags = 0), { leftTokenRange: toTokenRange(left), rightTokenRange: toTokenRange(right), rule: { debugName: debugName, context: context, action: action, flags: flags } } } function tokenRangeFrom(tokens) { return { tokens: tokens, isSpecific: !0 } } function toTokenRange(arg) { return "number" == typeof arg ? tokenRangeFrom([arg]) : ts.isArray(arg) ? tokenRangeFrom(arg) : arg } function tokenRangeFromRange(from, to, except) { void 0 === except && (except = []); for (var tokens = [], token = from; token <= to; token++)ts.contains(except, token) || tokens.push(token); return tokenRangeFrom(tokens) } function isOptionEnabled(optionName) { return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName] } } function isOptionDisabled(optionName) { return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName] } } function isOptionDisabledOrUndefined(optionName) { return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] } } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine() } } function isOptionEnabledOrUndefined(optionName) { return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName] } } function isForContext(context) { return 219 === context.contextNode.kind } function isNotForContext(context) { return !isForContext(context) } function isBinaryOpContext(context) { switch (context.contextNode.kind) { case 199: case 200: case 170: case 207: case 251: case 247: case 160: case 168: case 169: return !0; case 181: case 236: case 242: case 231: case 148: case 272: case 151: case 150: return 58 === context.currentTokenSpan.kind || 58 === context.nextTokenSpan.kind; case 220: case 147: return 92 === context.currentTokenSpan.kind || 92 === context.nextTokenSpan.kind; case 221: return 144 === context.currentTokenSpan.kind || 144 === context.nextTokenSpan.kind }return !1 } function isNotBinaryOpContext(context) { return !isBinaryOpContext(context) } function isNotTypeAnnotationContext(context) { return !isTypeAnnotationContext(context) } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; return 151 === contextKind || 150 === contextKind || 148 === contextKind || 231 === contextKind || ts.isFunctionLikeKind(contextKind) } function isConditionalOperatorContext(context) { return 200 === context.contextNode.kind || 170 === context.contextNode.kind } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context) } function isBraceWrappedContext(context) { return 179 === context.contextNode.kind || 176 === context.contextNode.kind || isSingleLineBlockContext(context) } function isBeforeMultilineBlockContext(context) { return isBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()) } function isMultilineBlockContext(context) { return isBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()) } function isSingleLineBlockContext(context) { return isBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()) } function isBlockContext(context) { return nodeIsBlockContext(context.contextNode) } function isBeforeBlockContext(context) { return nodeIsBlockContext(context.nextTokenParent) } function nodeIsBlockContext(node) { if (nodeIsTypeScriptDeclWithBlockContext(node)) return !0; switch (node.kind) { case 212: case 240: case 183: case 239: return !0 }return !1 } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { case 233: case 153: case 152: case 155: case 156: case 157: case 191: case 154: case 192: case 235: return !0 }return !1 } function isNotFunctionDeclContext(context) { return !isFunctionDeclContext(context) } function isFunctionDeclarationOrFunctionExpressionContext(context) { return 233 === context.contextNode.kind || 191 === context.contextNode.kind } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode) } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { case 234: case 204: case 235: case 237: case 165: case 238: case 249: case 250: case 243: case 246: return !0 }return !1 } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { case 234: case 238: case 237: case 268: case 239: case 226: return !0; case 212: var blockParent = context.currentTokenParent.parent; if (!blockParent || 192 !== blockParent.kind && 191 !== blockParent.kind) return !0 }return !1 } function isControlDeclContext(context) { switch (context.contextNode.kind) { case 216: case 226: case 219: case 220: case 221: case 218: case 229: case 217: case 225: case 268: return !0; default: return !1 } } function isObjectContext(context) { return 183 === context.contextNode.kind } function isFunctionCallContext(context) { return 186 === context.contextNode.kind } function isNewContext(context) { return 187 === context.contextNode.kind } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context) } function isPreviousTokenNotComma(context) { return 26 !== context.currentTokenSpan.kind } function isNextTokenNotCloseBracket(context) { return 22 !== context.nextTokenSpan.kind } function isArrowFunctionContext(context) { return 192 === context.contextNode.kind } function isImportTypeContext(context) { return 178 === context.contextNode.kind } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && 10 !== context.contextNode.kind } function isNonJsxElementOrFragmentContext(context) { return 254 !== context.contextNode.kind && 258 !== context.contextNode.kind } function isJsxExpressionContext(context) { return 264 === context.contextNode.kind || 263 === context.contextNode.kind } function isNextTokenParentJsxAttribute(context) { return 261 === context.nextTokenParent.kind } function isJsxAttributeContext(context) { return 261 === context.contextNode.kind } function isJsxSelfClosingElementContext(context) { return 255 === context.contextNode.kind } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context) } function isEndOfDecoratorContextOnSameLine(context) { return context.TokensAreOnSameLine() && context.contextNode.decorators && nodeIsInDecoratorContext(context.currentTokenParent) && !nodeIsInDecoratorContext(context.nextTokenParent) } function nodeIsInDecoratorContext(node) { for (; ts.isExpressionNode(node);)node = node.parent; return 149 === node.kind } function isStartOfVariableDeclarationList(context) { return 232 === context.currentTokenParent.kind && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos } function isNotFormatOnEnter(context) { return 2 !== context.formattingRequestKind } function isModuleDeclContext(context) { return 238 === context.contextNode.kind } function isObjectTypeContext(context) { return 165 === context.contextNode.kind } function isConstructorSignatureContext(context) { return 158 === context.contextNode.kind } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (27 !== token.kind && 29 !== token.kind) return !1; switch (parent.kind) { case 161: case 189: case 236: case 234: case 204: case 235: case 233: case 191: case 192: case 153: case 152: case 157: case 158: case 186: case 187: case 206: return !0; default: return !1 } } function isTypeArgumentOrParameterOrAssertionContext(context) { return isTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent) } function isTypeAssertionContext(context) { return 189 === context.contextNode.kind } function isVoidOpContext(context) { return 105 === context.currentTokenSpan.kind && 195 === context.currentTokenParent.kind } function isYieldOrYieldStarWithOperand(context) { return 202 === context.contextNode.kind && void 0 !== context.contextNode.expression } function isNonNullAssertionContext(context) { return 208 === context.contextNode.kind } formatting.getAllRules = getAllRules }(formatting = ts.formatting || (ts.formatting = {})) }(ts || (ts = {})); var ts; !function (ts) { var formatting; !function (formatting) { function getFormatContext(options) { return { options: options, getRule: getRulesMap() } } function getRulesMap() { return void 0 === rulesMapCache && (rulesMapCache = createRulesMap(formatting.getAllRules())), rulesMapCache } function createRulesMap(rules) { var map = buildMap(rules); return function (context) { var bucket = map[getRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind)]; return bucket && ts.find(bucket, function (rule) { return ts.every(rule.context, function (c) { return c(context) }) }) } } function buildMap(rules) { for (var map = new Array(mapRowLength * mapRowLength), rulesBucketConstructionStateList = new Array(map.length), _i = 0, rules_1 = rules; _i < rules_1.length; _i++)for (var rule_1 = rules_1[_i], specificRule = rule_1.leftTokenRange.isSpecific && rule_1.rightTokenRange.isSpecific, _a = 0, _b = rule_1.leftTokenRange.tokens; _a < _b.length; _a++)for (var left = _b[_a], _c = 0, _d = rule_1.rightTokenRange.tokens; _c < _d.length; _c++) { var right = _d[_c], index = getRuleBucketIndex(left, right), rulesBucket = map[index]; void 0 === rulesBucket && (rulesBucket = map[index] = []), addRule(rulesBucket, rule_1.rule, specificRule, rulesBucketConstructionStateList, index) } return map } function getRuleBucketIndex(row, column) { return ts.Debug.assert(row <= 144 && column <= 144, "Must compute formatting context from tokens"), row * mapRowLength + column } function addRule(rules, rule, specificTokens, constructionState, rulesBucketIndex) { var position = 1 === rule.action ? specificTokens ? RulesPosition.IgnoreRulesSpecific : RulesPosition.IgnoreRulesAny : rule.context !== formatting.anyContext ? specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny : specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny, state = constructionState[rulesBucketIndex] || 0; rules.splice(getInsertionIndex(state, position), 0, rule), constructionState[rulesBucketIndex] = increaseInsertionIndex(state, position) } function getInsertionIndex(indexBitmap, maskPosition) { for (var index = 0, pos = 0; pos <= maskPosition; pos += maskBitSize)index += indexBitmap & mask, indexBitmap >>= maskBitSize; return index } function increaseInsertionIndex(indexBitmap, maskPosition) { var value = (indexBitmap >> maskPosition & mask) + 1; return ts.Debug.assert((value & mask) === value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."), indexBitmap & ~(mask << maskPosition) | value << maskPosition } formatting.getFormatContext = getFormatContext; var rulesMapCache, RulesPosition, maskBitSize = 5, mask = 31, mapRowLength = 145; !function (RulesPosition) { RulesPosition[RulesPosition.IgnoreRulesSpecific = 0] = "IgnoreRulesSpecific", RulesPosition[RulesPosition.IgnoreRulesAny = 1 * maskBitSize] = "IgnoreRulesAny", RulesPosition[RulesPosition.ContextRulesSpecific = 2 * maskBitSize] = "ContextRulesSpecific", RulesPosition[RulesPosition.ContextRulesAny = 3 * maskBitSize] = "ContextRulesAny", RulesPosition[RulesPosition.NoContextRulesSpecific = 4 * maskBitSize] = "NoContextRulesSpecific", RulesPosition[RulesPosition.NoContextRulesAny = 5 * maskBitSize] = "NoContextRulesAny" }(RulesPosition || (RulesPosition = {})) }(formatting = ts.formatting || (ts.formatting = {})) }(ts || (ts = {})); var ts; !function (ts) { var formatting; !function (formatting) { function formatOnEnter(position, sourceFile, formatContext) { var line = sourceFile.getLineAndCharacterOfPosition(position).line; if (0 === line) return []; for (var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(endOfFormatSpan));)endOfFormatSpan--; ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan)) && endOfFormatSpan--; var span = { pos: ts.getStartPositionOfLine(line - 1, sourceFile), end: endOfFormatSpan + 1 }; return formatSpan(span, sourceFile, formatContext, 2) } function formatOnSemicolon(position, sourceFile, formatContext) { var semicolon = findImmediatelyPrecedingTokenOfKind(position, 25, sourceFile); return formatNodeLines(findOutermostNodeWithinListLevel(semicolon), sourceFile, formatContext, 3) } function formatOnOpeningCurly(position, sourceFile, formatContext) { var openingCurly = findImmediatelyPrecedingTokenOfKind(position, 17, sourceFile); if (!openingCurly) return []; var curlyBraceRange = openingCurly.parent, outermostNode = findOutermostNodeWithinListLevel(curlyBraceRange), textRange = { pos: ts.getLineStartPositionForPosition(outermostNode.getStart(sourceFile), sourceFile), end: position }; return formatSpan(textRange, sourceFile, formatContext, 4) } function formatOnClosingCurly(position, sourceFile, formatContext) { var precedingToken = findImmediatelyPrecedingTokenOfKind(position, 18, sourceFile); return formatNodeLines(findOutermostNodeWithinListLevel(precedingToken), sourceFile, formatContext, 5) } function formatDocument(sourceFile, formatContext) { var span = { pos: 0, end: sourceFile.text.length }; return formatSpan(span, sourceFile, formatContext, 0) } function formatSelection(start, end, sourceFile, formatContext) { var span = { pos: ts.getLineStartPositionForPosition(start, sourceFile), end: end }; return formatSpan(span, sourceFile, formatContext, 1) } function findImmediatelyPrecedingTokenOfKind(end, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(end, sourceFile); return precedingToken && precedingToken.kind === expectedTokenKind && end === precedingToken.getEnd() ? precedingToken : void 0 } function findOutermostNodeWithinListLevel(node) { for (var current = node; current && current.parent && current.parent.end === node.end && !isListElement(current.parent, current);)current = current.parent; return current } function isListElement(parent, node) { switch (parent.kind) { case 234: case 235: return ts.rangeContainsRange(parent.members, node); case 238: var body = parent.body; return body && 239 === body.kind && ts.rangeContainsRange(body.statements, node); case 273: case 212: case 239: return ts.rangeContainsRange(parent.statements, node); case 268: return ts.rangeContainsRange(parent.block.statements, node) }return !1 } function findEnclosingNode(range, sourceFile) { function find(n) { var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c }); if (candidate) { var result = find(candidate); if (result) return result } return n } return find(sourceFile) } function prepareRangeContainsErrorFunction(errors, originalRange) { function rangeHasNoErrors() { return !1 } if (!errors.length) return rangeHasNoErrors; var sorted = errors.filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length) }).sort(function (e1, e2) { return e1.start - e2.start }); if (!sorted.length) return rangeHasNoErrors; var index = 0; return function (r) { for (; ;) { if (index >= sorted.length) return !1; var error = sorted[index]; if (r.end <= error.start) return !1; if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) return !0; index++ } } } function getScanStartPosition(enclosingNode, originalRange, sourceFile) { var start = enclosingNode.getStart(sourceFile); if (start === originalRange.pos && enclosingNode.end === originalRange.end) return start; var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile); return precedingToken ? precedingToken.end >= originalRange.pos ? enclosingNode.pos : precedingToken.end : enclosingNode.pos } function getOwnOrInheritedDelta(n, options, sourceFile) { for (var child, previousLine = -1; n;) { var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== -1 && line !== previousLine) break; if (formatting.SmartIndenter.shouldIndentChildNode(options, n, child, sourceFile)) return options.indentSize; previousLine = line, child = n, n = n.parent } return 0 } function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) { var range = { pos: 0, end: sourceFileLike.text.length }; return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1, function (_) { return !1 }, sourceFileLike) }) } function formatNodeLines(node, sourceFile, formatContext, requestKind) { if (!node) return []; var span = { pos: ts.getLineStartPositionForPosition(node.getStart(sourceFile), sourceFile), end: node.end }; return formatSpan(span, sourceFile, formatContext, requestKind) } function formatSpan(originalRange, sourceFile, formatContext, requestKind) { var enclosingNode = findEnclosingNode(originalRange, sourceFile); return formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end, function (scanner) { return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, formatContext.options), getOwnOrInheritedDelta(enclosingNode, formatContext.options, sourceFile), scanner, formatContext, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile) }) } function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, _a, requestKind, rangeContainsError, sourceFile) { function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) || ts.rangeContainsStartEnd(range, startPos, endPos)) { if (inheritedIndentation !== -1) return inheritedIndentation } else { var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line, startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile), column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { var baseIndentSize = formatting.SmartIndenter.getBaseIndentation(options); return baseIndentSize > column ? baseIndentSize : column } } return -1 } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { var delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; return effectiveParentStartLine === startLine ? { indentation: startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(), delta: Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta) } : inheritedIndentation === -1 ? 19 === node.kind && startLine === lastIndentedLine ? { indentation: indentationOnLastIndentedLine, delta: parentDynamicIndentation.getDelta(node) } : formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile) ? { indentation: parentDynamicIndentation.getIndentation(), delta: delta } : { indentation: parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node), delta: delta } : { indentation: inheritedIndentation, delta: delta } } function getFirstNonDecoratorTokenOfNode(node) { if (node.modifiers && node.modifiers.length) return node.modifiers[0].kind; switch (node.kind) { case 234: return 75; case 235: return 109; case 233: return 89; case 237: return 237; case 155: return 125; case 156: return 136; case 153: if (node.asteriskToken) return 39; case 151: case 148: return ts.getNameOfDeclaration(node).kind } } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { function shouldAddDelta(line, kind, container) { switch (kind) { case 17: case 18: case 19: case 20: case 82: case 106: case 57: return !1; case 41: case 29: switch (container.kind) { case 256: case 257: case 255: return !1 }break; case 21: case 22: if (176 !== container.kind) return !1 }return nodeStartLine !== line && !(node.decorators && kind === getFirstNonDecoratorTokenOfNode(node)) } function getDelta(child) { return formatting.SmartIndenter.nodeWillIndentChild(options, node, child, sourceFile, !0) ? delta : 0 } return { getIndentationForComment: function (kind, tokenIndentation, container) { switch (kind) { case 18: case 22: case 20: return indentation + getDelta(container) }return tokenIndentation !== -1 ? tokenIndentation : indentation }, getIndentationForToken: function (line, kind, container) { return shouldAddDelta(line, kind, container) ? indentation + getDelta(container) : indentation }, getIndentation: function () { return indentation }, getDelta: getDelta, recomputeIndentation: function (lineAdded) { node.parent && formatting.SmartIndenter.shouldIndentChildNode(options, node.parent, node, sourceFile) && (indentation += lineAdded ? options.indentSize : -options.indentSize, delta = formatting.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0) } } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile), childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line, undecoratedChildStartLine = childStartLine; child.decorators && (undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(child, sourceFile)).line); var childIndentationAmount = -1; if (isListItem && ts.rangeContainsRange(originalRange, parent) && (childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation), childIndentationAmount !== -1 && (inheritedIndentation = childIndentationAmount)), !ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) return child.end < originalRange.pos && formattingScanner.skipToEndOf(child), inheritedIndentation; if (0 === child.getFullWidth()) return inheritedIndentation; for (; formattingScanner.isOnToken();) { var tokenInfo = formattingScanner.readTokenInfo(node); if (tokenInfo.token.end > childStartPos) break; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node) } if (!formattingScanner.isOnToken()) return inheritedIndentation; if (ts.isToken(child) && 10 !== child.kind) { var tokenInfo = formattingScanner.readTokenInfo(child); return ts.Debug.assert(tokenInfo.token.end === child.end, "Token end is child end"), consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child), inheritedIndentation } var effectiveParentStartLine = 149 === child.kind ? childStartLine : undecoratedParentStartLine, childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); if (processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta), 10 === child.kind) { var range = { pos: child.getStart(), end: child.getEnd() }; indentMultilineCommentOrJsxText(range, childIndentation.indentation, !0, !1) } return childContextNode = node, isFirstListItem && 182 === parent.kind && inheritedIndentation === -1 && (inheritedIndentation = childIndentation.indentation), inheritedIndentation } function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { ts.Debug.assert(ts.isNodeArray(nodes)); var listStartToken = getOpenTokenForList(parent, nodes), listEndToken = getCloseTokenForOpenToken(listStartToken), listDynamicIndentation = parentDynamicIndentation, startLine = parentStartLine; if (0 !== listStartToken) for (; formattingScanner.isOnToken();) { var tokenInfo = formattingScanner.readTokenInfo(parent); if (tokenInfo.token.end > nodes.pos) break; if (tokenInfo.token.kind === listStartToken) { startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_2 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_2.indentation, indentation_2.delta), consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent) } else consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent) } for (var inheritedIndentation = -1, i = 0; i < nodes.length; i++) { var child = nodes[i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, !0, 0 === i) } if (0 !== listEndToken && formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token) && consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent) } } function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation, container) { ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(), indentToken = !1; currentTokenInfo.leadingTrivia && processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation); var lineAction = 0, isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token), tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token), savePreviousRange = previousRange; if (lineAction = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation), !rangeHasError) if (0 === lineAction) { var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line; indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine } else indentToken = 1 === lineAction } if (currentTokenInfo.trailingTrivia && processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation), indentToken) { var tokenIndentation = isTokenInRange && !rangeContainsError(currentTokenInfo.token) ? dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : -1, indentNextTokenOrTrivia = !0; if (currentTokenInfo.leadingTrivia) for (var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container), _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i], triviaInRange = ts.rangeContainsRange(originalRange, triviaItem); switch (triviaItem.kind) { case 3: triviaInRange && indentMultilineCommentOrJsxText(triviaItem, commentIndentation, !indentNextTokenOrTrivia), indentNextTokenOrTrivia = !1; break; case 2: indentNextTokenOrTrivia && triviaInRange && insertIndentation(triviaItem.pos, commentIndentation, !1), indentNextTokenOrTrivia = !1; break; case 4: indentNextTokenOrTrivia = !0 } } tokenIndentation !== -1 && indentNextTokenOrTrivia && (insertIndentation(currentTokenInfo.token.pos, tokenIndentation, 1 === lineAction), lastIndentedLine = tokenStart.line, indentationOnLastIndentedLine = tokenIndentation) } formattingScanner.advance(), childContextNode = parent } if (ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta), childContextNode = contextNode; for (ts.forEachChild(node, function (child) { processChildNode(child, -1, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, !1) }, function (nodes) { processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation) }); formattingScanner.isOnToken();) { var tokenInfo = formattingScanner.readTokenInfo(node); if (tokenInfo.token.end > node.end) break; consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node) } } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) { var triviaItem = trivia_1[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation) } } } function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) { var rangeHasError = rangeContainsError(range), lineAction = 0; if (!rangeHasError) if (previousRange) lineAction = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); else { var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line) } return previousRange = range, previousParent = parent, previousRangeStartLine = rangeStart.line, lineAction } function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) { formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode); var trimTrailingWhitespaces, rule = getRule(formattingContext), lineAction = 0; if (rule) { switch (lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine)) { case 2: currentParent.getStart(sourceFile) === currentItem.pos && dynamicIndentation.recomputeIndentation(!1); break; case 1: currentParent.getStart(sourceFile) === currentItem.pos && dynamicIndentation.recomputeIndentation(!0); break; default: ts.Debug.assert(0 === lineAction) }trimTrailingWhitespaces = !(8 & rule.action) && 1 !== rule.flags } else trimTrailingWhitespaces = !0; return currentStartLine !== previousStartLine && trimTrailingWhitespaces && trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem), lineAction } function insertIndentation(pos, indentation, lineAdded) { var indentationString = getIndentationString(indentation, options); if (lineAdded) recordReplace(pos, 0, indentationString); else { var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos), startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) && recordReplace(startLinePosition, tokenStart.character, indentationString) } } function characterToColumn(startLinePosition, characterInLine) { for (var column = 0, i = 0; i < characterInLine; i++)9 === sourceFile.text.charCodeAt(startLinePosition + i) ? column += options.tabSize - column % options.tabSize : column++; return column } function indentationIsDifferent(indentationString, startLinePosition) { return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length) } function indentMultilineCommentOrJsxText(commentRange, indentation, firstLineIsIndented, indentFinalLine) { void 0 === indentFinalLine && (indentFinalLine = !0); var parts, startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line, endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) return void (firstLineIsIndented || insertIndentation(commentRange.pos, indentation, !1)); parts = []; for (var startPos = commentRange.pos, line = startLine; line < endLine; line++) { var endOfLine = ts.getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, end: endOfLine }), startPos = ts.getStartPositionOfLine(line + 1, sourceFile) } indentFinalLine && parts.push({ pos: startPos, end: commentRange.end }); var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile), nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); if (indentation !== nonWhitespaceColumnInFirstPart.column) { var startIndex = 0; firstLineIsIndented && (startIndex = 1, startLine++); for (var delta = indentation - nonWhitespaceColumnInFirstPart.column, i = startIndex; i < parts.length; i++ , startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile), nonWhitespaceCharacterAndColumn = 0 === i ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options), newIndentation = nonWhitespaceCharacterAndColumn.column + delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); recordReplace(startLinePos_1, nonWhitespaceCharacterAndColumn.character, indentationString) } else recordDelete(startLinePos_1, nonWhitespaceCharacterAndColumn.character) } } } function trimTrailingWhitespacesForLines(line1, line2, range) { for (var line = line1; line < line2; line++) { var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile), lineEndPosition = ts.getEndLinePosition(line, sourceFile); if (!(range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition)) { var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition); whitespaceStart !== -1 && (ts.Debug.assert(whitespaceStart === lineStartPosition || !ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(whitespaceStart - 1))), recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart)) } } } function getTrailingWhitespaceStartPosition(start, end) { for (var pos = end; pos >= start && ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos));)pos--; return pos !== end ? pos + 1 : -1 } function trimTrailingWhitespacesForRemainingRange() { var startPosition = previousRange ? previousRange.end : originalRange.pos, startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line, endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line; trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange) } function recordDelete(start, len) { len && edits.push(ts.createTextChangeFromStartLength(start, len, "")) } function recordReplace(start, len, newText) { (len || newText) && edits.push(ts.createTextChangeFromStartLength(start, len, newText)) } function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) { var onLaterLine = currentStartLine !== previousStartLine; switch (rule.action) { case 1: return 0; case 8: if (previousRange.end !== currentRange.pos) return recordDelete(previousRange.end, currentRange.pos - previousRange.end), onLaterLine ? 2 : 0; break; case 4: if (1 !== rule.flags && previousStartLine !== currentStartLine) return 0; var lineDelta = currentStartLine - previousStartLine; if (1 !== lineDelta) return recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter), onLaterLine ? 0 : 1; break; case 2: if (1 !== rule.flags && previousStartLine !== currentStartLine) return 0; var posDelta = currentRange.pos - previousRange.end; if (1 !== posDelta || 32 !== sourceFile.text.charCodeAt(previousRange.end)) return recordReplace(previousRange.end, currentRange.pos - previousRange.end, " "), onLaterLine ? 2 : 0 }return 0 } var previousRange, previousParent, previousRangeStartLine, lastIndentedLine, indentationOnLastIndentedLine, options = _a.options, getRule = _a.getRule, formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options), edits = []; if (formattingScanner.advance(), formattingScanner.isOnToken()) { var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line, undecoratedStartLine = startLine; enclosingNode.decorators && (undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line), processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta) } if (!formattingScanner.isOnToken()) { var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); leadingTrivia && (processTrivia(leadingTrivia, enclosingNode, enclosingNode, void 0), trimTrailingWhitespacesForRemainingRange()) } return edits } function getRangeOfEnclosingComment(sourceFile, position, onlyMultiLine, precedingToken, tokenAtPosition, predicate) { void 0 === tokenAtPosition && (tokenAtPosition = ts.getTokenAtPosition(sourceFile, position, !1)); var tokenStart = tokenAtPosition.getStart(sourceFile); if (!(tokenStart <= position && position < tokenAtPosition.getEnd())) { void 0 === precedingToken && (precedingToken = ts.findPrecedingToken(position, sourceFile)); var trailingRangesOfPreviousToken = precedingToken && ts.getTrailingCommentRanges(sourceFile.text, precedingToken.end), leadingCommentRangesOfNextToken = ts.getLeadingCommentRangesOfNode(tokenAtPosition, sourceFile), commentRanges = trailingRangesOfPreviousToken && leadingCommentRangesOfNextToken ? trailingRangesOfPreviousToken.concat(leadingCommentRangesOfNextToken) : trailingRangesOfPreviousToken || leadingCommentRangesOfNextToken; if (commentRanges) for (var _i = 0, commentRanges_1 = commentRanges; _i < commentRanges_1.length; _i++) { var range = commentRanges_1[_i]; if (range.pos < position && position < range.end || position === range.end && (2 === range.kind || position === sourceFile.getFullWidth())) return 3 !== range.kind && onlyMultiLine || predicate && !predicate(range) ? void 0 : range } } } function getOpenTokenForList(node, list) { switch (node.kind) { case 154: case 233: case 191: case 153: case 152: case 192: if (node.typeParameters === list) return 27; if (node.parameters === list) return 19; break; case 186: case 187: if (node.typeArguments === list) return 27; if (node.arguments === list) return 19; break; case 161: if (node.typeArguments === list) return 27 }return 0 } function getCloseTokenForOpenToken(kind) { switch (kind) { case 19: return 20; case 27: return 29 }return 0 } function getIndentationString(indentation, options) { var resetInternedStrings = !internedSizes || internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize; if (resetInternedStrings && (internedSizes = { tabSize: options.tabSize, indentSize: options.indentSize }, internedTabsIndentation = internedSpacesIndentation = void 0), options.convertTabsToSpaces) { var spacesString = void 0, quotient = Math.floor(indentation / options.indentSize), remainder = indentation % options.indentSize; return internedSpacesIndentation || (internedSpacesIndentation = []), void 0 === internedSpacesIndentation[quotient] ? (spacesString = ts.repeatString(" ", options.indentSize * quotient), internedSpacesIndentation[quotient] = spacesString) : spacesString = internedSpacesIndentation[quotient], remainder ? spacesString + ts.repeatString(" ", remainder) : spacesString } var tabs = Math.floor(indentation / options.tabSize), spaces = indentation - tabs * options.tabSize, tabString = void 0; return internedTabsIndentation || (internedTabsIndentation = []), void 0 === internedTabsIndentation[tabs] ? internedTabsIndentation[tabs] = tabString = ts.repeatString("\t", tabs) : tabString = internedTabsIndentation[tabs], spaces ? tabString + ts.repeatString(" ", spaces) : tabString } var Constants; !function (Constants) { Constants[Constants.Unknown = -1] = "Unknown" }(Constants || (Constants = {})), formatting.formatOnEnter = formatOnEnter, formatting.formatOnSemicolon = formatOnSemicolon, formatting.formatOnOpeningCurly = formatOnOpeningCurly, formatting.formatOnClosingCurly = formatOnClosingCurly, formatting.formatDocument = formatDocument, formatting.formatSelection = formatSelection, formatting.formatNodeGivenIndentation = formatNodeGivenIndentation; var LineAction; !function (LineAction) { LineAction[LineAction.None = 0] = "None", LineAction[LineAction.LineAdded = 1] = "LineAdded", LineAction[LineAction.LineRemoved = 2] = "LineRemoved" }(LineAction || (LineAction = {})), formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; var internedSizes, internedTabsIndentation, internedSpacesIndentation; formatting.getIndentationString = getIndentationString }(formatting = ts.formatting || (ts.formatting = {})) }(ts || (ts = {})); var ts; !function (ts) { var formatting; !function (formatting) { var SmartIndenter; !function (SmartIndenter) { function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { if (void 0 === assumeNewLineBeforeCloseBrace && (assumeNewLineBeforeCloseBrace = !1), position > sourceFile.text.length) return getBaseIndentation(options); if (options.indentStyle === ts.IndentStyle.None) return 0; var precedingToken = ts.findPrecedingToken(position, sourceFile), enclosingCommentRange = formatting.getRangeOfEnclosingComment(sourceFile, position, !0, precedingToken || null); if (enclosingCommentRange) return getCommentIndent(sourceFile, position, options, enclosingCommentRange); if (!precedingToken) return getBaseIndentation(options); var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind); if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && position < precedingToken.end) return 0; var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if (options.indentStyle === ts.IndentStyle.Block) return getBlockIndent(sourceFile, position, options); if (26 === precedingToken.kind && 199 !== precedingToken.parent.kind) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) return actualIndentation } return getSmartIndent(sourceFile, position, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options) } function getCommentIndent(sourceFile, position, options, enclosingCommentRange) { var previousLine = ts.getLineAndCharacterOfPosition(sourceFile, position).line - 1, commentStartLine = ts.getLineAndCharacterOfPosition(sourceFile, enclosingCommentRange.pos).line; if (ts.Debug.assert(commentStartLine >= 0), previousLine <= commentStartLine) return findFirstNonWhitespaceColumn(ts.getStartPositionOfLine(commentStartLine, sourceFile), position, sourceFile, options); var startPostionOfLine = ts.getStartPositionOfLine(previousLine, sourceFile), _a = findFirstNonWhitespaceCharacterAndColumn(startPostionOfLine, position, sourceFile, options), column = _a.column, character = _a.character; if (0 === column) return column; var firstNonWhitespaceCharacterCode = sourceFile.text.charCodeAt(startPostionOfLine + character); return 42 === firstNonWhitespaceCharacterCode ? column - 1 : column } function getBlockIndent(sourceFile, position, options) { for (var current = position; current > 0;) { var char = sourceFile.text.charCodeAt(current); if (!ts.isWhiteSpaceLike(char)) break; current-- } var lineStart = ts.getLineStartPositionForPosition(current, sourceFile); return findFirstNonWhitespaceColumn(lineStart, current, sourceFile, options) } function getSmartIndent(sourceFile, position, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options) { for (var previous, current = precedingToken; current;) { if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(options, current, previous, sourceFile, !0)) { var currentStart = getStartLineAndCharacterForNode(current, sourceFile), nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile), indentationDelta = 0 !== nextTokenKind ? assumeNewLineBeforeCloseBrace && 2 === nextTokenKind ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0; return getIndentationForNodeWorker(current, currentStart, void 0, indentationDelta, sourceFile, !0, options) } var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); if (actualIndentation !== -1) return actualIndentation; if (actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options), actualIndentation !== -1) return actualIndentation + options.indentSize; previous = current, current = current.parent } return getBaseIndentation(options) } function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, !1, options) } function getBaseIndentation(options) { return options.baseIndentSize || 0 } function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, isNextChild, options) { for (var parent = current.parent; parent;) { var useActualIndentation = !0; if (ignoreActualIndentationRange) { var start = current.getStart(sourceFile); useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end } if (useActualIndentation) { var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); if (actualIndentation !== -1) return actualIndentation + indentationDelta } var containingListOrParentStart = getContainingListOrParentStart(parent, current, sourceFile), parentAndChildShareLine = containingListOrParentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); if (actualIndentation !== -1) return actualIndentation + indentationDelta; if (actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options), actualIndentation !== -1) return actualIndentation + indentationDelta } shouldIndentChildNode(options, parent, current, sourceFile, isNextChild) && !parentAndChildShareLine && (indentationDelta += options.indentSize); var useTrueStart = isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, current, currentStart.line, sourceFile); current = parent, parent = current.parent, currentStart = useTrueStart ? sourceFile.getLineAndCharacterOfPosition(current.getStart(sourceFile)) : containingListOrParentStart } return indentationDelta + getBaseIndentation(options) } function getContainingListOrParentStart(parent, child, sourceFile) { var containingList = getContainingList(child, sourceFile), startPos = containingList ? containingList.pos : parent.getStart(sourceFile); return sourceFile.getLineAndCharacterOfPosition(startPos) } function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { var commaItemInfo = ts.findListItemInfo(commaToken); return commaItemInfo && commaItemInfo.listItemIndex > 0 ? deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options) : -1 } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && (273 === parent.kind || !parentAndChildShareLine); return useActualIndentation ? findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options) : -1 } function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { var nextToken = ts.findNextToken(precedingToken, current, sourceFile); if (!nextToken) return 0; if (17 === nextToken.kind) return 1; if (18 === nextToken.kind) { var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine ? 2 : 0 } return 0 } function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)) } function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, child, childStartLine, sourceFile) { if (!ts.isCallExpression(parent) || !ts.contains(parent.arguments, child)) return !1; var expressionOfCallExpressionEnd = parent.expression.getEnd(), expressionOfCallExpressionEndLine = ts.getLineAndCharacterOfPosition(sourceFile, expressionOfCallExpressionEnd).line; return expressionOfCallExpressionEndLine === childStartLine } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { if (216 === parent.kind && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 82, sourceFile); ts.Debug.assert(void 0 !== elseKeyword); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine } return !1 } function getListIfStartEndIsInListRange(list, start, end) { return list && ts.rangeContainsStartEnd(list, start, end) ? list : void 0 } function getContainingList(node, sourceFile) { if (node.parent) { var end = node.end; switch (node.parent.kind) { case 161: return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), end); case 183: return node.parent.properties; case 182: return node.parent.elements; case 233: case 191: case 192: case 153: case 152: case 157: case 154: case 163: case 158: var start = node.getStart(sourceFile); return getListIfStartEndIsInListRange(node.parent.typeParameters, start, end) || getListIfStartEndIsInListRange(node.parent.parameters, start, end); case 234: return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), end); case 187: case 186: var start = node.getStart(sourceFile); return getListIfStartEndIsInListRange(node.parent.typeArguments, start, end) || getListIfStartEndIsInListRange(node.parent.arguments, start, end); case 232: return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), end); case 246: case 250: return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), end); case 179: case 180: return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), end) } } } function getActualIndentationForListItem(node, sourceFile, options) { var containingList = getContainingList(node, sourceFile); if (containingList) { var index = containingList.indexOf(node); if (index !== -1) return deriveActualIndentationFromList(containingList, index, sourceFile, options) } return -1 } function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) { function getStartingExpression(node) { for (; ;)switch (node.kind) { case 186: case 187: case 184: case 185: node = node.expression; break; default: return node } } if (20 === node.kind) return -1; if (node.parent && ts.isCallOrNewExpression(node.parent) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression, startingExpression = getStartingExpression(fullCallOrNewExpression); if (fullCallOrNewExpression === startingExpression) return -1; var fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end), startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end); return fullCallOrNewExpressionEnd.line === startingExpressionEnd.line ? -1 : findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options) } return -1 } function deriveActualIndentationFromList(list, index, sourceFile, options) { ts.Debug.assert(index >= 0 && index < list.length); for (var node = list[index], lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile), i = index - 1; i >= 0; i--)if (26 !== list[i].kind) { var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile) } return -1 } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options) } function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) { for (var character = 0, column = 0, pos = startPos; pos < endPos; pos++) { var ch = sourceFile.text.charCodeAt(pos); if (!ts.isWhiteSpaceSingleLine(ch)) break; 9 === ch ? column += options.tabSize + column % options.tabSize : column++ , character++ } return { column: column, character: character } } function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column } function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { case 215: case 234: case 204: case 235: case 237: case 236: case 182: case 212: case 239: case 183: case 165: case 176: case 167: case 240: case 266: case 265: case 190: case 184: case 186: case 187: case 213: case 248: case 224: case 200: case 180: case 179: case 256: case 259: case 255: case 264: case 152: case 157: case 158: case 148: case 162: case 163: case 172: case 188: case 196: case 250: case 246: case 251: case 247: case 151: return !0; case 231: case 269: return !(!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && 183 === childKind) || rangeIsOnOneLine(sourceFile, child); case 217: case 218: case 220: case 221: case 219: case 216: case 233: case 191: case 153: case 192: case 154: case 155: case 156: return 212 !== childKind; case 249: return 250 !== childKind; case 243: return 244 !== childKind || !!child.namedBindings && 246 !== child.namedBindings.kind; case 254: return 257 !== childKind; case 258: return 260 !== childKind; case 169: case 168: if (165 === childKind) return !1 }return indentByDefault } function isControlFlowEndingStatement(kind, parent) { switch (kind) { case 224: case 228: if (212 !== parent.kind) return !0; var grandParent = parent.parent; return !(grandParent && 191 === grandParent.kind || 233 === grandParent.kind); case 222: case 223: return !0; default: return !1 } } function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { return void 0 === isNextChild && (isNextChild = !1), nodeWillIndentChild(settings, parent, child, sourceFile, !1) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)) } function rangeIsOnOneLine(sourceFile, range) { var rangeStart = ts.skipTrivia(sourceFile.text, range.pos), startLine = sourceFile.getLineAndCharacterOfPosition(rangeStart).line, endLine = sourceFile.getLineAndCharacterOfPosition(range.end).line; return startLine === endLine } var Value; !function (Value) { Value[Value.Unknown = -1] = "Unknown" }(Value || (Value = {})), SmartIndenter.getIndentation = getIndentation, SmartIndenter.getIndentationForNode = getIndentationForNode, SmartIndenter.getBaseIndentation = getBaseIndentation; var NextTokenKind; !function (NextTokenKind) { NextTokenKind[NextTokenKind.Unknown = 0] = "Unknown", NextTokenKind[NextTokenKind.OpenBrace = 1] = "OpenBrace", NextTokenKind[NextTokenKind.CloseBrace = 2] = "CloseBrace" }(NextTokenKind || (NextTokenKind = {})), SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled, SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement, SmartIndenter.getContainingList = getContainingList, SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn, SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn, SmartIndenter.nodeWillIndentChild = nodeWillIndentChild, SmartIndenter.shouldIndentChildNode = shouldIndentChildNode }(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})) }(formatting = ts.formatting || (ts.formatting = {})) }(ts || (ts = {})); var ts; !function (ts) { var textChanges; !function (textChanges_3) { function getPos(n) { var result = n.__pos; return ts.Debug.assert("number" == typeof result), result } function setPos(n, pos) { ts.Debug.assert("number" == typeof pos), n.__pos = pos } function getEnd(n) { var result = n.__end; return ts.Debug.assert("number" == typeof result), result } function setEnd(n, end) { ts.Debug.assert("number" == typeof end), n.__end = end } function skipWhitespacesAndLineBreaks(text, start) { return ts.skipTrivia(text, start, !1, !0) } function hasCommentsBeforeLineBreak(text, start) { for (var i = start; i < text.length;) { var ch = text.charCodeAt(i); { if (!ts.isWhiteSpaceSingleLine(ch)) return 47 === ch; i++ } } return !1 } function getAdjustedRange(sourceFile, startNode, endNode, options) { return { pos: getAdjustedStartPosition(sourceFile, startNode, options, Position.Start), end: getAdjustedEndPosition(sourceFile, endNode, options) } } function getAdjustedStartPosition(sourceFile, node, options, position) { if (options.useNonAdjustedStartPosition) return node.getStart(sourceFile); var fullStart = node.getFullStart(), start = node.getStart(sourceFile); if (fullStart === start) return start; var fullStartLine = ts.getLineStartPositionForPosition(fullStart, sourceFile), startLine = ts.getLineStartPositionForPosition(start, sourceFile); if (startLine === fullStartLine) return position === Position.Start ? start : fullStart; var nextLineStart = fullStart > 0 ? 1 : 0, adjustedStartPosition = ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, fullStartLine) + nextLineStart, sourceFile); return adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition), ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile) } function getAdjustedEndPosition(sourceFile, node, options) { var end = node.end; if (options.useNonAdjustedEndPosition || ts.isExpression(node)) return end; var newEnd = ts.skipTrivia(sourceFile.text, end, !0); return newEnd !== end && ts.isLineBreak(sourceFile.text.charCodeAt(newEnd - 1)) ? newEnd : end } function isSeparator(node, candidate) { return candidate && node.parent && (26 === candidate.kind || 25 === candidate.kind && 183 === node.parent.kind) } function spaces(count) { for (var s = "", i = 0; i < count; i++)s += " "; return s } function startPositionToDeleteNodeInList(sourceFile, node) { return ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), !1, !0) } function getClassBraceEnds(cls, sourceFile) { return [ts.findChildOfKind(cls, 17, sourceFile).end, ts.findChildOfKind(cls, 18, sourceFile).end] } function applyChanges(text, changes) { for (var i = changes.length - 1; i >= 0; i--) { var change = changes[i]; text = "" + text.substring(0, change.span.start) + change.newText + text.substring(ts.textSpanEnd(change.span)) } return text } function isTrivia(s) { return ts.skipTrivia(s, 0) === s.length } function assignPositionsToNode(node) { var visited = ts.visitEachChild(node, assignPositionsToNode, ts.nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode), newNode = ts.nodeIsSynthesized(visited) ? visited : Object.create(visited); return newNode.pos = getPos(node), newNode.end = getEnd(node), newNode } function assignPositionsToNodeArray(nodes, visitor, test, start, count) { var visited = ts.visitNodes(nodes, visitor, test, start, count); if (!visited) return visited; var nodeArray = visited === nodes ? ts.createNodeArray(visited.slice(0)) : visited; return nodeArray.pos = getPos(nodes), nodeArray.end = getEnd(nodes), nodeArray } function getInsertionPositionAtSourceFileTop(_a) { function advancePastLineBreak() { if (position < text.length) { var charCode = text.charCodeAt(position); ts.isLineBreak(charCode) && (position++ , position < text.length && 13 === charCode && 10 === text.charCodeAt(position) && position++) } } var text = _a.text, shebang = ts.getShebang(text), position = 0; void 0 !== shebang && (position = shebang.length, advancePastLineBreak()); var ranges = ts.getLeadingCommentRanges(text, position); if (!ranges) return position; ranges.length && 3 === ranges[0].kind && ts.isPinnedComment(text, ranges[0].pos) && (position = ranges[0].end, advancePastLineBreak(), ranges = ranges.slice(1)); for (var _i = 0, ranges_1 = ranges; _i < ranges_1.length; _i++) { var range = ranges_1[_i]; { if (2 !== range.kind || !ts.isRecognizedTripleSlashComment(text, range.pos, range.end)) break; position = range.end, advancePastLineBreak() } } return position } function isValidLocationToAddComment(sourceFile, position) { return !ts.isInComment(sourceFile, position) && !ts.isInString(sourceFile, position) && !ts.isInTemplateString(sourceFile, position) } function needSemicolonBetween(a, b) { return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && 146 === b.name.kind || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b) } var Position; !function (Position) { Position[Position.FullStart = 0] = "FullStart", Position[Position.Start = 1] = "Start" }(Position = textChanges_3.Position || (textChanges_3.Position = {})), textChanges_3.useNonAdjustedPositions = { useNonAdjustedStartPosition: !0, useNonAdjustedEndPosition: !0 }; var ChangeKind; !function (ChangeKind) { ChangeKind[ChangeKind.Remove = 0] = "Remove", ChangeKind[ChangeKind.ReplaceWithSingleNode = 1] = "ReplaceWithSingleNode", ChangeKind[ChangeKind.ReplaceWithMultipleNodes = 2] = "ReplaceWithMultipleNodes", ChangeKind[ChangeKind.Text = 3] = "Text" }(ChangeKind || (ChangeKind = {})); var ChangeTracker = function () { function ChangeTracker(newLineCharacter, formatContext) { this.newLineCharacter = newLineCharacter, this.formatContext = formatContext, this.changes = [], this.newFiles = [], this.deletedNodesInLists = new ts.NodeSet, this.classesWithNodesInsertedAtStart = ts.createMap() } return ChangeTracker.fromContext = function (context) { return new ChangeTracker(ts.getNewLineOrDefaultFromHost(context.host, context.formatContext.options), context.formatContext) }, ChangeTracker.with = function (context, cb) { var tracker = ChangeTracker.fromContext(context); return cb(tracker), tracker.getChanges() }, ChangeTracker.prototype.deleteRange = function (sourceFile, range) { return this.changes.push({ kind: ChangeKind.Remove, sourceFile: sourceFile, range: range }), this }, ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { void 0 === options && (options = {}); var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart), endPosition = getAdjustedEndPosition(sourceFile, node, options); return this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }), this }, ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { void 0 === options && (options = {}); var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart), endPosition = getAdjustedEndPosition(sourceFile, endNode, options); return this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }), this }, ChangeTracker.prototype.deleteNodeRangeExcludingEnd = function (sourceFile, startNode, afterEndNode, options) { void 0 === options && (options = {}); var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart), endPosition = void 0 === afterEndNode ? sourceFile.text.length : getAdjustedStartPosition(sourceFile, afterEndNode, options, Position.FullStart); this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }) }, ChangeTracker.prototype.deleteNodeInList = function (sourceFile, node) { var containingList = ts.formatting.SmartIndenter.getContainingList(node, sourceFile); if (!containingList) return ts.Debug.fail("node is not a list element"), this; var index = ts.indexOfNode(containingList, node); return index < 0 ? this : 1 === containingList.length ? (this.deleteNode(sourceFile, node), this) : (ts.Debug.assert(!this.deletedNodesInLists.has(node), "Deleting a node twice"), this.deletedNodesInLists.add(node), this.deleteRange(sourceFile, { pos: startPositionToDeleteNodeInList(sourceFile, node), end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]) }), this) }, ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { return void 0 === options && (options = {}), this.changes.push({ kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: range, options: options, node: newNode }), this }, ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { return void 0 === options && (options = textChanges_3.useNonAdjustedPositions), this.replaceRange(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNode, options) }, ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { void 0 === options && (options = textChanges_3.useNonAdjustedPositions), this.replaceRange(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNode, options) }, ChangeTracker.prototype.replaceRangeWithNodes = function (sourceFile, range, newNodes, options) { return void 0 === options && (options = {}), this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile: sourceFile, range: range, options: options, nodes: newNodes }), this }, ChangeTracker.prototype.replaceNodeWithNodes = function (sourceFile, oldNode, newNodes, options) { return void 0 === options && (options = textChanges_3.useNonAdjustedPositions), this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNodes, options) }, ChangeTracker.prototype.replaceNodeRangeWithNodes = function (sourceFile, startNode, endNode, newNodes, options) { return void 0 === options && (options = textChanges_3.useNonAdjustedPositions), this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options) }, ChangeTracker.prototype.nextCommaToken = function (sourceFile, node) { var next = ts.findNextToken(node, node.parent, sourceFile); return next && 26 === next.kind ? next : void 0 }, ChangeTracker.prototype.replacePropertyAssignment = function (sourceFile, oldNode, newNode) { var suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : "," + this.newLineCharacter; return this.replaceNode(sourceFile, oldNode, newNode, { suffix: suffix }) }, ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { void 0 === options && (options = {}), this.replaceRange(sourceFile, ts.createTextRange(pos), newNode, options) }, ChangeTracker.prototype.insertNodesAt = function (sourceFile, pos, newNodes, options) { void 0 === options && (options = {}), this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile: sourceFile, options: options, nodes: newNodes, range: { pos: pos, end: pos } }) }, ChangeTracker.prototype.insertNodeAtTopOfFile = function (sourceFile, newNode, blankLineBetween) { var pos = getInsertionPositionAtSourceFileTop(sourceFile); this.insertNodeAt(sourceFile, pos, newNode, { prefix: 0 === pos ? void 0 : this.newLineCharacter, suffix: (ts.isLineBreak(sourceFile.text.charCodeAt(pos)) ? "" : this.newLineCharacter) + (blankLineBetween ? this.newLineCharacter : "") }) }, ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween) { void 0 === blankLineBetween && (blankLineBetween = !1), this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, {}, Position.Start), newNode, this.getOptionsForInsertNodeBefore(before, blankLineBetween)) }, ChangeTracker.prototype.insertModifierBefore = function (sourceFile, modifier, before) { var pos = before.getStart(sourceFile); this.replaceRange(sourceFile, { pos: pos, end: pos }, ts.createToken(modifier), { suffix: " " }) }, ChangeTracker.prototype.insertCommentBeforeLine = function (sourceFile, lineNumber, position, commentText) { var lineStartPosition = ts.getStartPositionOfLine(lineNumber, sourceFile), startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition), insertAtLineStart = isValidLocationToAddComment(sourceFile, startPosition), token = ts.getTouchingToken(sourceFile, insertAtLineStart ? startPosition : position, !1), indent = sourceFile.text.slice(lineStartPosition, startPosition), text = (insertAtLineStart ? "" : this.newLineCharacter) + "//" + commentText + this.newLineCharacter + indent; this.insertText(sourceFile, token.getStart(sourceFile), text) }, ChangeTracker.prototype.replaceRangeWithText = function (sourceFile, range, text) { this.changes.push({ kind: ChangeKind.Text, sourceFile: sourceFile, range: range, text: text }) }, ChangeTracker.prototype.insertText = function (sourceFile, pos, text) { this.replaceRangeWithText(sourceFile, ts.createTextRange(pos), text) }, ChangeTracker.prototype.tryInsertTypeAnnotation = function (sourceFile, node, type) { var endNode; if (ts.isFunctionLike(node)) { if (endNode = ts.findChildOfKind(node, 20, sourceFile), !endNode) { if (!ts.isArrowFunction(node)) return; endNode = ts.first(node.parameters) } } else endNode = 231 !== node.kind && node.questionToken ? node.questionToken : node.name; this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }) }, ChangeTracker.prototype.insertTypeParameters = function (sourceFile, node, typeParameters) { var start = (ts.findChildOfKind(node, 19, sourceFile) || ts.first(node.parameters)).getStart(sourceFile); this.insertNodesAt(sourceFile, start, typeParameters, { prefix: "<", suffix: ">" }) }, ChangeTracker.prototype.getOptionsForInsertNodeBefore = function (before, doubleNewlines) { return ts.isStatement(before) || ts.isClassElement(before) ? { suffix: doubleNewlines ? this.newLineCharacter + this.newLineCharacter : this.newLineCharacter } : ts.isVariableDeclaration(before) ? { suffix: ", " } : ts.isParameter(before) ? {} : ts.Debug.failBadSyntaxKind(before) }, ChangeTracker.prototype.insertNodeAtConstructorStart = function (sourceFile, ctr, newStatement) { var firstStatement = ts.firstOrUndefined(ctr.body.statements); firstStatement && ctr.body.multiLine ? this.insertNodeBefore(sourceFile, firstStatement, newStatement) : this.replaceConstructorBody(sourceFile, ctr, [newStatement].concat(ctr.body.statements)) }, ChangeTracker.prototype.insertNodeAtConstructorEnd = function (sourceFile, ctr, newStatement) { var lastStatement = ts.lastOrUndefined(ctr.body.statements); lastStatement && ctr.body.multiLine ? this.insertNodeAfter(sourceFile, lastStatement, newStatement) : this.replaceConstructorBody(sourceFile, ctr, ctr.body.statements.concat([newStatement])) }, ChangeTracker.prototype.replaceConstructorBody = function (sourceFile, ctr, statements) { this.replaceNode(sourceFile, ctr.body, ts.createBlock(statements, !0)) }, ChangeTracker.prototype.insertNodeAtEndOfScope = function (sourceFile, scope, newNode) { var pos = getAdjustedStartPosition(sourceFile, scope.getLastToken(), {}, Position.Start); this.replaceRange(sourceFile, { pos: pos, end: pos }, newNode, { prefix: ts.isLineBreak(sourceFile.text.charCodeAt(scope.getLastToken().pos)) ? this.newLineCharacter : this.newLineCharacter + this.newLineCharacter, suffix: this.newLineCharacter }) }, ChangeTracker.prototype.insertNodeAtClassStart = function (sourceFile, cls, newElement) { var clsStart = cls.getStart(sourceFile), indentation = ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(ts.getLineStartPositionForPosition(clsStart, sourceFile), clsStart, sourceFile, this.formatContext.options) + this.formatContext.options.indentSize; this.insertNodeAt(sourceFile, cls.members.pos, newElement, __assign({ indentation: indentation }, this.getInsertNodeAtClassStartPrefixSuffix(sourceFile, cls))) }, ChangeTracker.prototype.getInsertNodeAtClassStartPrefixSuffix = function (sourceFile, cls) { if (0 === cls.members.length) { if (ts.addToSeen(this.classesWithNodesInsertedAtStart, ts.getNodeId(cls), cls)) { var shouldSuffix = ts.positionsAreOnSameLine.apply(void 0, getClassBraceEnds(cls, sourceFile).concat([sourceFile])); return { prefix: this.newLineCharacter, suffix: shouldSuffix ? this.newLineCharacter : "" } } return { prefix: "", suffix: this.newLineCharacter } } return { prefix: this.newLineCharacter, suffix: "" } }, ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) { var endPosition = this.insertNodeAfterWorker(sourceFile, this.nextCommaToken(sourceFile, after) || after, newNode); this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after)) }, ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) { var endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode); this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after)) }, ChangeTracker.prototype.insertNodesAfter = function (sourceFile, after, newNodes) { var endPosition = this.insertNodeAfterWorker(sourceFile, after, ts.first(newNodes)); this.insertNodesAt(sourceFile, endPosition, newNodes, this.getInsertNodeAfterOptions(sourceFile, after)) }, ChangeTracker.prototype.insertNodeAfterWorker = function (sourceFile, after, newNode) { needSemicolonBetween(after, newNode) && 59 !== sourceFile.text.charCodeAt(after.end - 1) && this.replaceRange(sourceFile, ts.createTextRange(after.end), ts.createToken(25)); var endPosition = getAdjustedEndPosition(sourceFile, after, {}); return endPosition }, ChangeTracker.prototype.getInsertNodeAfterOptions = function (sourceFile, after) { var options = this.getInsertNodeAfterOptionsWorker(after); return __assign({}, options, { prefix: after.end === sourceFile.end && ts.isStatement(after) ? options.prefix ? "\n" + options.prefix : "\n" : options.prefix }) }, ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { return ts.isClassDeclaration(node) || ts.isModuleDeclaration(node) ? { prefix: this.newLineCharacter, suffix: this.newLineCharacter } : ts.isStatement(node) || ts.isClassOrTypeElement(node) ? { suffix: this.newLineCharacter } : ts.isVariableDeclaration(node) || ts.isStringLiteral(node) ? { prefix: ", " } : ts.isPropertyAssignment(node) ? { suffix: "," + this.newLineCharacter } : ts.isParameter(node) ? {} : ts.Debug.failBadSyntaxKind(node) }, ChangeTracker.prototype.insertName = function (sourceFile, node, name) { if (ts.Debug.assert(!node.name), 192 === node.kind) { var arrow = ts.findChildOfKind(node, 36, sourceFile), lparen = ts.findChildOfKind(node, 19, sourceFile); lparen ? (this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(89), ts.createIdentifier(name)], { joiner: " " }), this.deleteNode(sourceFile, arrow)) : (this.insertText(sourceFile, ts.first(node.parameters).getStart(sourceFile), "function " + name + "("), this.replaceRange(sourceFile, arrow, ts.createToken(20))), 212 !== node.body.kind && (this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(17), ts.createToken(96)], { joiner: " ", suffix: " " }), this.insertNodesAt(sourceFile, node.body.end, [ts.createToken(25), ts.createToken(18)], { joiner: " " })) } else { var pos = ts.findChildOfKind(node, 191 === node.kind ? 89 : 75, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.createIdentifier(name), { prefix: " " }) } }, ChangeTracker.prototype.insertExportModifier = function (sourceFile, node) { this.insertText(sourceFile, node.getStart(sourceFile), "export ") }, ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode, containingList) { if (void 0 === containingList && (containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile)), !containingList) return ts.Debug.fail("node is not a list element"), this; var index = ts.indexOfNode(containingList, after); if (index < 0) return this; var end = after.getEnd(); if (index !== containingList.length - 1) { var nextToken = ts.getTokenAtPosition(sourceFile, after.end, !1); if (nextToken && isSeparator(after, nextToken)) { var lineAndCharOfNextElement = ts.getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart())), lineAndCharOfNextToken = ts.getLineAndCharacterOfPosition(sourceFile, nextToken.end), prefix = void 0, startPos = void 0; lineAndCharOfNextToken.line === lineAndCharOfNextElement.line ? (startPos = nextToken.end, prefix = spaces(lineAndCharOfNextElement.character - lineAndCharOfNextToken.character)) : startPos = ts.getStartPositionOfLine(lineAndCharOfNextElement.line, sourceFile); var suffix = "" + ts.tokenToString(nextToken.kind) + sourceFile.text.substring(nextToken.end, containingList[index + 1].getStart(sourceFile)); this.replaceRange(sourceFile, ts.createTextRange(startPos, containingList[index + 1].getStart(sourceFile)), newNode, { prefix: prefix, suffix: suffix }) } } else { var afterStart = after.getStart(sourceFile), afterStartLinePosition = ts.getLineStartPositionForPosition(afterStart, sourceFile), separator = void 0, multilineList = !1; if (1 === containingList.length) separator = 26; else { var tokenBeforeInsertPosition = ts.findPrecedingToken(after.pos, sourceFile); separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 26; var afterMinusOneStartLinePosition = ts.getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition } if (hasCommentsBeforeLineBreak(sourceFile.text, after.end) && (multilineList = !0), multilineList) { this.replaceRange(sourceFile, ts.createTextRange(end), ts.createToken(separator)); var indentation = ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(afterStartLinePosition, afterStart, sourceFile, this.formatContext.options), insertPos = ts.skipTrivia(sourceFile.text, end, !0, !1); insertPos !== end && ts.isLineBreak(sourceFile.text.charCodeAt(insertPos - 1)) && insertPos-- , this.replaceRange(sourceFile, ts.createTextRange(insertPos), newNode, { indentation: indentation, prefix: this.newLineCharacter }) } else this.replaceRange(sourceFile, ts.createTextRange(end), newNode, { prefix: ts.tokenToString(separator) + " " }) } return this }, ChangeTracker.prototype.finishClassesWithNodesInsertedAtStart = function () { var _this = this; this.classesWithNodesInsertedAtStart.forEach(function (cls) { var sourceFile = cls.getSourceFile(), _a = getClassBraceEnds(cls, sourceFile), openBraceEnd = _a[0], closeBraceEnd = _a[1]; ts.positionsAreOnSameLine(openBraceEnd, closeBraceEnd, sourceFile) && openBraceEnd !== closeBraceEnd - 1 && _this.deleteRange(sourceFile, ts.createTextRange(openBraceEnd, closeBraceEnd - 1)) }) }, ChangeTracker.prototype.finishTrailingCommaAfterDeletingNodesInList = function () { var _this = this; this.deletedNodesInLists.forEach(function (node) { var sourceFile = node.getSourceFile(), list = ts.formatting.SmartIndenter.getContainingList(node, sourceFile); if (node === ts.last(list)) { var lastNonDeletedIndex = ts.findLastIndex(list, function (n) { return !_this.deletedNodesInLists.has(n) }, list.length - 2); lastNonDeletedIndex !== -1 && _this.deleteRange(sourceFile, { pos: list[lastNonDeletedIndex].end, end: startPositionToDeleteNodeInList(sourceFile, list[lastNonDeletedIndex + 1]) }) } }) }, ChangeTracker.prototype.getChanges = function (validate) { this.finishClassesWithNodesInsertedAtStart(), this.finishTrailingCommaAfterDeletingNodesInList(); for (var changes = changesToText.getTextChangesFromChanges(this.changes, this.newLineCharacter, this.formatContext, validate), _i = 0, _a = this.newFiles; _i < _a.length; _i++) { var _b = _a[_i], oldFile = _b.oldFile, fileName = _b.fileName, statements = _b.statements; changes.push(changesToText.newFileChanges(oldFile, fileName, statements, this.newLineCharacter, this.formatContext)) } return changes }, ChangeTracker.prototype.createNewFile = function (oldFile, fileName, statements) { this.newFiles.push({ oldFile: oldFile, fileName: fileName, statements: statements }) }, ChangeTracker }(); textChanges_3.ChangeTracker = ChangeTracker; var changesToText; !function (changesToText) { function getTextChangesFromChanges(changes, newLineCharacter, formatContext, validate) { return ts.group(changes, function (c) { return c.sourceFile.path }).map(function (changesInFile) { for (var sourceFile = changesInFile[0].sourceFile, normalized = ts.stableSort(changesInFile, function (a, b) { return a.range.pos - b.range.pos || a.range.end - b.range.end }), _loop_19 = function (i) { ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () { return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range) }) }, i = 0; i < normalized.length - 1; i++)_loop_19(i); var textChanges = normalized.map(function (c) { return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate)) }); return { fileName: sourceFile.fileName, textChanges: textChanges } }) } function newFileChanges(oldFile, fileName, statements, newLineCharacter, formatContext) { var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text }).join(newLineCharacter), sourceFile = ts.createSourceFile(fileName, nonFormattedText, 6, !0), changes = ts.formatting.formatDocument(sourceFile, formatContext), text = applyChanges(nonFormattedText, changes); return { fileName: fileName, textChanges: [ts.createTextChange(ts.createTextSpan(0, 0), text)], isNewFile: !0 } } function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) { if (change.kind === ChangeKind.Remove) return ""; if (change.kind === ChangeKind.Text) return change.text; var _a = change.options, options = void 0 === _a ? {} : _a, pos = change.range.pos, format = function (n) { return getFormattedTextOfNode(n, sourceFile, pos, options, newLineCharacter, formatContext, validate) }, text = change.kind === ChangeKind.ReplaceWithMultipleNodes ? change.nodes.map(function (n) { return ts.removeSuffix(format(n), newLineCharacter) }).join(change.options.joiner || newLineCharacter) : format(change.node), noIndent = options.preserveLeadingWhitespace || void 0 !== options.indentation || ts.getLineStartPositionForPosition(pos, sourceFile) === pos ? text : text.replace(/^\s+/, ""); return (options.prefix || "") + noIndent + (options.suffix || "") } function getFormattedTextOfNode(nodeIn, sourceFile, pos, _a, newLineCharacter, formatContext, validate) { var indentation = _a.indentation, prefix = _a.prefix, delta = _a.delta, _b = getNonformattedText(nodeIn, sourceFile, newLineCharacter), node = _b.node, text = _b.text; validate && validate(node, text); var formatOptions = formatContext.options, initialIndentation = void 0 !== indentation ? indentation : ts.formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || ts.getLineStartPositionForPosition(pos, sourceFile) === pos); void 0 === delta && (delta = ts.formatting.SmartIndenter.shouldIndentChildNode(formatContext.options, nodeIn) ? formatOptions.indentSize || 0 : 0); var file = { text: text, getLineAndCharacterOfPosition: function (pos) { return ts.getLineAndCharacterOfPosition(this, pos) } }, changes = ts.formatting.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, formatContext); return applyChanges(text, changes) } function getNonformattedText(node, sourceFile, newLineCharacter) { var writer = new Writer(newLineCharacter), newLine = "\n" === newLineCharacter ? 1 : 0; return ts.createPrinter({ newLine: newLine }, writer).writeNode(4, node, sourceFile, writer), { text: writer.getText(), node: assignPositionsToNode(node) } } changesToText.getTextChangesFromChanges = getTextChangesFromChanges, changesToText.newFileChanges = newFileChanges }(changesToText || (changesToText = {})), textChanges_3.applyChanges = applyChanges; var Writer = function () { function Writer(newLine) { var _this = this; this.lastNonTriviaPosition = 0, this.writer = ts.createTextWriter(newLine), this.onEmitNode = function (hint, node, printCallback) { node && setPos(node, _this.lastNonTriviaPosition), printCallback(hint, node), node && setEnd(node, _this.lastNonTriviaPosition) }, this.onBeforeEmitNodeArray = function (nodes) { nodes && setPos(nodes, _this.lastNonTriviaPosition) }, this.onAfterEmitNodeArray = function (nodes) { nodes && setEnd(nodes, _this.lastNonTriviaPosition) }, this.onBeforeEmitToken = function (node) { node && setPos(node, _this.lastNonTriviaPosition) }, this.onAfterEmitToken = function (node) { node && setEnd(node, _this.lastNonTriviaPosition) } } return Writer.prototype.setLastNonTriviaPosition = function (s, force) { if (force || !isTrivia(s)) { this.lastNonTriviaPosition = this.writer.getTextPos(); for (var i = 0; ts.isWhiteSpaceLike(s.charCodeAt(s.length - i - 1));)i++; this.lastNonTriviaPosition -= i } }, Writer.prototype.write = function (s) { this.writer.write(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeKeyword = function (s) { this.writer.writeKeyword(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeOperator = function (s) { this.writer.writeOperator(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writePunctuation = function (s) { this.writer.writePunctuation(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeParameter = function (s) { this.writer.writeParameter(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeProperty = function (s) { this.writer.writeProperty(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeSpace = function (s) { this.writer.writeSpace(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeStringLiteral = function (s) { this.writer.writeStringLiteral(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeSymbol = function (s, sym) { this.writer.writeSymbol(s, sym), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeTextOfNode = function (text, node) { this.writer.writeTextOfNode(text, node) }, Writer.prototype.writeLine = function () { this.writer.writeLine() }, Writer.prototype.increaseIndent = function () { this.writer.increaseIndent() }, Writer.prototype.decreaseIndent = function () { this.writer.decreaseIndent() }, Writer.prototype.getText = function () { return this.writer.getText() }, Writer.prototype.rawWrite = function (s) { this.writer.rawWrite(s), this.setLastNonTriviaPosition(s, !1) }, Writer.prototype.writeLiteral = function (s) { this.writer.writeLiteral(s), this.setLastNonTriviaPosition(s, !0) }, Writer.prototype.getTextPos = function () { return this.writer.getTextPos() }, Writer.prototype.getLine = function () { return this.writer.getLine() }, Writer.prototype.getColumn = function () { return this.writer.getColumn() }, Writer.prototype.getIndent = function () { return this.writer.getIndent() }, Writer.prototype.isAtStartOfLine = function () { return this.writer.isAtStartOfLine() }, Writer.prototype.clear = function () { this.writer.clear(), this.lastNonTriviaPosition = 0 }, Writer }(); textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment }(textChanges = ts.textChanges || (ts.textChanges = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function diagnosticToString(diag) { return ts.isArray(diag) ? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1)) : ts.getLocaleSpecificMessage(diag) } function createCodeFixActionNoFixId(fixName, changes, description) { return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, void 0, void 0) } function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) { return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command) } function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) { return { fixName: fixName, description: description, changes: changes, fixId: fixId, fixAllDescription: fixAllDescription, commands: command ? [command] : void 0 } } function registerCodeFix(reg) { for (var _i = 0, _a = reg.errorCodes; _i < _a.length; _i++) { var error = _a[_i]; errorCodeToFixes.add(String(error), reg) } if (reg.fixIds) for (var _b = 0, _c = reg.fixIds; _b < _c.length; _b++) { var fixId = _c[_b]; ts.Debug.assert(!fixIdToRegistration.has(fixId)), fixIdToRegistration.set(fixId, reg) } } function getSupportedErrorCodes() { return ts.arrayFrom(errorCodeToFixes.keys()) } function getFixes(context) { return ts.flatMap(errorCodeToFixes.get(String(context.errorCode)) || ts.emptyArray, function (f) { return f.getCodeActions(context) }) } function getAllFixes(context) { return fixIdToRegistration.get(ts.cast(context.fixId, ts.isString)).getAllCodeActions(context) } function createCombinedCodeActions(changes, commands) { return { changes: changes, commands: commands } } function createFileTextChanges(fileName, textChanges) { return { fileName: fileName, textChanges: textChanges } } function codeFixAll(context, errorCodes, use) { var commands = [], changes = ts.textChanges.ChangeTracker.with(context, function (t) { return eachDiagnostic(context, errorCodes, function (diag) { return use(t, diag, commands) }) }); return createCombinedCodeActions(changes, 0 === commands.length ? void 0 : commands) } function eachDiagnostic(_a, errorCodes, cb) { for (var program = _a.program, sourceFile = _a.sourceFile, _i = 0, _b = program.getSemanticDiagnostics(sourceFile).concat(ts.computeSuggestionDiagnostics(sourceFile, program)); _i < _b.length; _i++) { var diag = _b[_i]; ts.contains(errorCodes, diag.code) && cb(diag) } } var errorCodeToFixes = ts.createMultiMap(), fixIdToRegistration = ts.createMap(); codefix.createCodeFixActionNoFixId = createCodeFixActionNoFixId, codefix.createCodeFixAction = createCodeFixAction, codefix.registerCodeFix = registerCodeFix, codefix.getSupportedErrorCodes = getSupportedErrorCodes, codefix.getFixes = getFixes, codefix.getAllFixes = getAllFixes, codefix.createFileTextChanges = createFileTextChanges, codefix.codeFixAll = codeFixAll }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { function getRefactorContextSpan(_a) { var startPosition = _a.startPosition, endPosition = _a.endPosition; return ts.createTextSpanFromBounds(startPosition, void 0 === endPosition ? startPosition : endPosition) } var refactor; !function (refactor_1) { function registerRefactor(name, refactor) { refactors.set(name, refactor) } function getApplicableRefactors(context) { return ts.arrayFrom(ts.flatMapIterator(refactors.values(), function (refactor) { return context.cancellationToken && context.cancellationToken.isCancellationRequested() ? void 0 : refactor.getAvailableActions(context) })) } function getEditsForRefactor(context, refactorName, actionName) { var refactor = refactors.get(refactorName); return refactor && refactor.getEditsForAction(context, actionName) } var refactors = ts.createMap(); refactor_1.registerRefactor = registerRefactor, refactor_1.getApplicableRefactors = getApplicableRefactors, refactor_1.getEditsForRefactor = getEditsForRefactor }(refactor = ts.refactor || (ts.refactor = {})), ts.getRefactorContextSpan = getRefactorContextSpan }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function makeChange(changeTracker, sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos, !1), decorator = ts.findAncestor(token, ts.isDecorator); ts.Debug.assert(!!decorator, "Expected position to be owned by a decorator."); var replacement = ts.createCall(decorator.expression, void 0, void 0); changeTracker.replaceNode(sourceFile, decorator.expression, replacement) } var fixId = "addMissingInvocationForDecorator", errorCodes = [ts.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Call_decorator_expression, fixId, ts.Diagnostics.Add_to_all_uncalled_decorators)] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return makeChange(changes, diag.file, diag.start) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getDeclaration(file, pos) { var name = ts.getTokenAtPosition(file, pos, !1); return ts.tryCast(ts.isParameter(name.parent) ? name.parent.parent : name.parent, parameterShouldGetTypeFromJSDoc) } function parameterShouldGetTypeFromJSDoc(node) { return isDeclarationWithType(node) && hasUsableJSDoc(node) } function hasUsableJSDoc(decl) { return ts.isFunctionLikeDeclaration(decl) ? decl.parameters.some(hasUsableJSDoc) || !decl.type && !!ts.getJSDocReturnType(decl) : !decl.type && !!ts.getJSDocType(decl) } function doChange(changes, sourceFile, decl) { if (ts.isFunctionLikeDeclaration(decl) && (ts.getJSDocReturnType(decl) || decl.parameters.some(function (p) { return !!ts.getJSDocType(p) }))) { if (!decl.typeParameters) { var typeParameters = ts.getJSDocTypeParameterDeclarations(decl); typeParameters.length && changes.insertTypeParameters(sourceFile, decl, typeParameters) } var needParens = ts.isArrowFunction(decl) && !ts.findChildOfKind(decl, 19, sourceFile); needParens && changes.insertNodeBefore(sourceFile, ts.first(decl.parameters), ts.createToken(19)); for (var _i = 0, _a = decl.parameters; _i < _a.length; _i++) { var param = _a[_i]; if (!param.type) { var paramType = ts.getJSDocType(param); paramType && changes.tryInsertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)) } } if (needParens && changes.insertNodeAfter(sourceFile, ts.last(decl.parameters), ts.createToken(20)), !decl.type) { var returnType = ts.getJSDocReturnType(decl); returnType && changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)) } } else { var jsdocType = ts.Debug.assertDefined(ts.getJSDocType(decl)); ts.Debug.assert(!decl.type), changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)) } } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || 231 === node.kind || 150 === node.kind || 151 === node.kind } function transformJSDocType(node) { switch (node.kind) { case 278: case 279: return ts.createTypeReferenceNode("any", ts.emptyArray); case 282: return transformJSDocOptionalType(node); case 281: return transformJSDocType(node.type); case 280: return transformJSDocNullableType(node); case 284: return transformJSDocVariadicType(node); case 283: return transformJSDocFunctionType(node); case 161: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, void 0); return ts.setEmitFlags(visited, 1), visited } } function transformJSDocOptionalType(node) { return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("undefined", ts.emptyArray)]) } function transformJSDocNullableType(node) { return ts.createUnionTypeNode([ts.visitNode(node.type, transformJSDocType), ts.createTypeReferenceNode("null", ts.emptyArray)]) } function transformJSDocVariadicType(node) { return ts.createArrayTypeNode(ts.visitNode(node.type, transformJSDocType)) } function transformJSDocFunctionType(node) { return ts.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), node.type) } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node), isRest = 284 === node.type.kind && index === node.parent.parameters.length - 1, name = node.name || (isRest ? "rest" : "arg" + index), dotdotdot = isRest ? ts.createToken(24) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer) } function transformJSDocTypeReference(node) { var name = node.typeName, args = node.typeArguments; if (ts.isIdentifier(node.typeName)) { if (ts.isJSDocIndexSignature(node)) return transformJSDocIndexSignature(node); var text = node.typeName.text; switch (node.typeName.text) { case "String": case "Boolean": case "Object": case "Number": text = text.toLowerCase(); break; case "array": case "date": case "promise": text = text[0].toUpperCase() + text.slice(1) }name = ts.createIdentifier(text), args = "Array" !== text && "Promise" !== text || node.typeArguments ? ts.visitNodes(node.typeArguments, transformJSDocType) : ts.createNodeArray([ts.createTypeReferenceNode("any", ts.emptyArray)]) } return ts.createTypeReferenceNode(name, args) } function transformJSDocIndexSignature(node) { var index = ts.createParameter(void 0, void 0, void 0, 134 === node.typeArguments[0].kind ? "n" : "s", void 0, ts.createTypeReferenceNode(134 === node.typeArguments[0].kind ? "number" : "string", []), void 0), indexSignature = ts.createTypeLiteralNode([ts.createIndexSignature(void 0, void 0, [index], node.typeArguments[1])]); return ts.setEmitFlags(indexSignature, 1), indexSignature } var fixId = "annotateWithTypeFromJSDoc", errorCodes = [ts.Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var decl = getDeclaration(context.sourceFile, context.span.start); if (decl) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, decl) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Annotate_with_type_from_JSDoc, fixId, ts.Diagnostics.Annotate_everything_with_types_from_JSDoc)] } }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var decl = getDeclaration(diag.file, diag.start); decl && doChange(changes, diag.file, decl) }) } }), codefix.parameterShouldGetTypeFromJSDoc = parameterShouldGetTypeFromJSDoc }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function doChange(changes, sourceFile, position, checker) { function deleteNode(node, inList) { void 0 === inList && (inList = !1), deletedNodes.some(function (n) { return ts.isNodeDescendantOf(node, n.node) }) || deletedNodes.push({ node: node, inList: inList }) } function createClassElementsFromSymbol(symbol) { function shouldConvertDeclaration(_target, source) { return ts.isFunctionLike(source) } function createClassElement(symbol, modifiers) { if (8192 & symbol.flags) { var memberDeclaration = symbol.valueDeclaration, assignmentBinaryExpression = memberDeclaration.parent; if (shouldConvertDeclaration(memberDeclaration, assignmentBinaryExpression.right)) { var nodeToDelete = assignmentBinaryExpression.parent && 215 === assignmentBinaryExpression.parent.kind ? assignmentBinaryExpression.parent : assignmentBinaryExpression; if (deleteNode(nodeToDelete), !assignmentBinaryExpression.right) return ts.createProperty([], modifiers, symbol.name, void 0, void 0, void 0); switch (assignmentBinaryExpression.right.kind) { case 191: var functionExpression = assignmentBinaryExpression.right, fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 120)), method = ts.createMethod(void 0, fullModifiers, void 0, memberDeclaration.name, void 0, void 0, functionExpression.parameters, void 0, functionExpression.body); return copyComments(assignmentBinaryExpression, method, sourceFile), method; case 192: var arrowFunction = assignmentBinaryExpression.right, arrowFunctionBody = arrowFunction.body, bodyBlock = void 0; bodyBlock = 212 === arrowFunctionBody.kind ? arrowFunctionBody : ts.createBlock([ts.createReturn(arrowFunctionBody)]); var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 120)), method = ts.createMethod(void 0, fullModifiers, void 0, memberDeclaration.name, void 0, void 0, arrowFunction.parameters, void 0, bodyBlock); return copyComments(assignmentBinaryExpression, method, sourceFile), method; default: if (ts.isSourceFileJavaScript(sourceFile)) return; var prop = ts.createProperty(void 0, modifiers, memberDeclaration.name, void 0, void 0, assignmentBinaryExpression.right); return copyComments(assignmentBinaryExpression.parent, prop, sourceFile), prop } } } } var memberElements = []; return symbol.members && symbol.members.forEach(function (member) { var memberElement = createClassElement(member, void 0); memberElement && memberElements.push(memberElement) }), symbol.exports && symbol.exports.forEach(function (member) { var memberElement = createClassElement(member, [ts.createToken(115)]); memberElement && memberElements.push(memberElement) }), memberElements } function createClassFromVariableDeclaration(node) { var initializer = node.initializer; if (initializer && 191 === initializer.kind && 71 === node.name.kind) { var memberElements = createClassElementsFromSymbol(initializer.symbol); initializer.body && memberElements.unshift(ts.createConstructor(void 0, void 0, initializer.parameters, initializer.body)); var modifiers = getModifierKindFromSource(precedingNode, 84), cls = ts.createClassDeclaration(void 0, modifiers, node.name, void 0, void 0, memberElements); return cls } } function createClassFromFunctionDeclaration(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); node.body && memberElements.unshift(ts.createConstructor(void 0, void 0, node.parameters, node.body)); var modifiers = getModifierKindFromSource(node, 84), cls = ts.createClassDeclaration(void 0, modifiers, node.name, void 0, void 0, memberElements); return cls } var deletedNodes = [], ctorSymbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, position, !1)); if (ctorSymbol && 19 & ctorSymbol.flags) { var precedingNode, newClassDeclaration, ctorDeclaration = ctorSymbol.valueDeclaration; switch (ctorDeclaration.kind) { case 233: precedingNode = ctorDeclaration, deleteNode(ctorDeclaration), newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); break; case 231: precedingNode = ctorDeclaration.parent.parent, newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration), 1 === ctorDeclaration.parent.declarations.length ? (copyComments(precedingNode, newClassDeclaration, sourceFile), deleteNode(precedingNode)) : deleteNode(ctorDeclaration, !0) }if (newClassDeclaration) { copyComments(ctorDeclaration, newClassDeclaration, sourceFile), changes.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration); for (var _i = 0, deletedNodes_1 = deletedNodes; _i < deletedNodes_1.length; _i++) { var _a = deletedNodes_1[_i], node = _a.node, inList = _a.inList; inList ? changes.deleteNodeInList(sourceFile, node) : changes.deleteNode(sourceFile, node) } } } } function copyComments(sourceNode, targetNode, sourceFile) { ts.forEachLeadingCommentRange(sourceFile.text, sourceNode.pos, function (pos, end, kind, htnl) { 3 === kind ? (pos += 2, end -= 2) : pos += 2, ts.addSyntheticLeadingComment(targetNode, kind, sourceFile.text.slice(pos, end), htnl) }) } function getModifierKindFromSource(source, kind) { return ts.filter(source.modifiers, function (modifier) { return modifier.kind === kind }) } var fixId = "convertFunctionToEs6Class", errorCodes = [ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.program.getTypeChecker()) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_function_to_an_ES2015_class, fixId, ts.Diagnostics.Convert_all_constructor_functions_to_classes)] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { return doChange(changes, err.file, err.start, context.program.getTypeChecker()) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) { for (var _i = 0, _a = importingFile.imports; _i < _a.length; _i++) { var moduleSpecifier = _a[_i], imported = ts.getResolvedModule(importingFile, moduleSpecifier.text); if (imported && imported.resolvedFileName === exportingFile.fileName) { var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { case 242: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, void 0, moduleSpecifier, quotePreference)); break; case 186: ts.isRequireCall(importNode, !1) && changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default")) } } } } function convertFileToEs6Module(sourceFile, checker, changes, target, quotePreference) { var identifiers = { original: collectFreeIdentifiers(sourceFile), additional: ts.createMap() }, exports = collectExportRenames(sourceFile, checker, identifiers); convertExportsAccesses(sourceFile, exports, changes); for (var moduleExportsChangedToDefault = !1, _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i], moduleExportsChanged = convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference); moduleExportsChangedToDefault = moduleExportsChangedToDefault || moduleExportsChanged } return moduleExportsChangedToDefault } function collectExportRenames(sourceFile, checker, identifiers) { var res = ts.createMap(); return forEachExportReference(sourceFile, function (node) { var _a = node.name, text = _a.text, originalKeywordKind = _a.originalKeywordKind; !res.has(text) && (void 0 !== originalKeywordKind && ts.isNonContextualKeyword(originalKeywordKind) || checker.resolveName(node.name.text, node, 67216319, !0)) && res.set(text, makeUniqueName("_" + text, identifiers)) }), res } function convertExportsAccesses(sourceFile, exports, changes) { forEachExportReference(sourceFile, function (node, isAssignmentLhs) { if (!isAssignmentLhs) { var text = node.name.text; changes.replaceNode(sourceFile, node, ts.createIdentifier(exports.get(text) || text)) } }) } function forEachExportReference(sourceFile, cb) { sourceFile.forEachChild(function recur(node) { if (ts.isPropertyAccessExpression(node) && ts.isExportsOrModuleExportsOrAlias(sourceFile, node.expression)) { var parent = node.parent; cb(node, ts.isBinaryExpression(parent) && parent.left === node && 58 === parent.operatorToken.kind) } node.forEachChild(recur) }) } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference) { switch (statement.kind) { case 213: return convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference), !1; case 215: var expression = statement.expression; switch (expression.kind) { case 186: return ts.isRequireCall(expression, !0) && changes.replaceNode(sourceFile, statement, ts.makeImport(void 0, void 0, expression.arguments[0], quotePreference)), !1; case 199: var operatorToken = expression.operatorToken; return 58 === operatorToken.kind && convertAssignment(sourceFile, checker, expression, changes, exports) }default: return !1 } } function convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference) { var declarationList = statement.declarationList, foundImport = !1, newNodes = ts.flatMap(declarationList.declarations, function (decl) { var name = decl.name, initializer = decl.initializer; if (initializer) { if (ts.isExportsOrModuleExportsOrAlias(sourceFile, initializer)) return foundImport = !0, []; if (ts.isRequireCall(initializer, !0)) return foundImport = !0, convertSingleImport(sourceFile, name, initializer.arguments[0], changes, checker, identifiers, target, quotePreference); if (ts.isPropertyAccessExpression(initializer) && ts.isRequireCall(initializer.expression, !0)) return foundImport = !0, convertPropertyAccessImport(name, initializer.name.text, initializer.expression.arguments[0], identifiers, quotePreference) } return ts.createVariableStatement(void 0, ts.createVariableDeclarationList([decl], declarationList.flags)) }); foundImport && changes.replaceNodeWithNodes(sourceFile, statement, newNodes) } function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { case 179: case 180: var tmp = makeUniqueName(propertyName, identifiers); return [makeSingleImport(tmp, propertyName, moduleSpecifier, quotePreference), makeConst(void 0, name, ts.createIdentifier(tmp))]; case 71: return [makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)]; default: ts.Debug.assertNever(name) } } function convertAssignment(sourceFile, checker, assignment, changes, exports) { var left = assignment.left, right = assignment.right; if (!ts.isPropertyAccessExpression(left)) return !1; if (ts.isExportsOrModuleExportsOrAlias(sourceFile, left)) { if (!ts.isExportsOrModuleExportsOrAlias(sourceFile, right)) { var replacement = ts.isObjectLiteralExpression(right) ? tryChangeModuleExportsObject(right) : ts.isRequireCall(right, !0) ? convertReExportAll(right.arguments[0], checker) : void 0; return replacement ? (changes.replaceNodeWithNodes(sourceFile, assignment.parent, replacement[0]), replacement[1]) : (changes.replaceRangeWithText(sourceFile, ts.createTextRange(left.getStart(sourceFile), right.pos), "export default"), !0) } changes.deleteNode(sourceFile, assignment.parent) } else ts.isExportsOrModuleExportsOrAlias(sourceFile, left.expression) && convertNamedExport(sourceFile, assignment, changes, exports); return !1 } function tryChangeModuleExportsObject(object) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { case 155: case 156: case 270: case 271: return; case 269: return ts.isIdentifier(prop.name) ? convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer) : void 0; case 153: return ts.isIdentifier(prop.name) ? functionExpressionToDeclaration(prop.name.text, [ts.createToken(84)], prop) : void 0; default: ts.Debug.assertNever(prop) } }); return statements && [statements, !1] } function convertNamedExport(sourceFile, assignment, changes, exports) { var text = assignment.left.name.text, rename = exports.get(text); if (void 0 !== rename) { var newNodes = [makeConst(void 0, rename, assignment.right), makeExportDeclaration([ts.createExportSpecifier(rename, text)])]; changes.replaceNodeWithNodes(sourceFile, assignment.parent, newNodes) } else convertExportsPropertyAssignment(assignment, sourceFile, changes) } function convertReExportAll(reExported, checker) { var moduleSpecifier = reExported.text, moduleSymbol = checker.getSymbolAtLocation(reExported), exports = moduleSymbol ? moduleSymbol.exports : ts.emptyUnderscoreEscapedMap; return exports.has("export=") ? [[reExportDefault(moduleSpecifier)], !0] : exports.has("default") ? exports.size > 1 ? [[reExportStar(moduleSpecifier), reExportDefault(moduleSpecifier)], !0] : [[reExportDefault(moduleSpecifier)], !0] : [[reExportStar(moduleSpecifier)], !1] } function reExportStar(moduleSpecifier) { return makeExportDeclaration(void 0, moduleSpecifier) } function reExportDefault(moduleSpecifier) { return makeExportDeclaration([ts.createExportSpecifier(void 0, "default")], moduleSpecifier) } function convertExportsPropertyAssignment(_a, sourceFile, changes) { var left = _a.left, right = _a.right, parent = _a.parent, name = left.name.text; if (!(ts.isFunctionExpression(right) || ts.isArrowFunction(right) || ts.isClassExpression(right)) || right.name && right.name.text !== name) changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 23, sourceFile), [ts.createToken(84), ts.createToken(76)], { joiner: " ", suffix: " " }); else { changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(84), { suffix: " " }), right.name || changes.insertName(sourceFile, right, name); var semi = ts.findChildOfKind(parent, 25, sourceFile); semi && changes.deleteNode(sourceFile, semi, { useNonAdjustedEndPosition: !0 }) } } function convertExportsDotXEquals_replaceNode(name, exported) { function exportConst() { return makeConst(modifiers, ts.createIdentifier(name), exported) } var modifiers = [ts.createToken(84)]; switch (exported.kind) { case 191: var expressionName = exported.name; if (expressionName && expressionName.text !== name) return exportConst(); case 192: return functionExpressionToDeclaration(name, modifiers, exported); case 204: return classExpressionToDeclaration(name, modifiers, exported); default: return exportConst() } } function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target, quotePreference) { switch (name.kind) { case 179: var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? void 0 : makeImportSpecifier(e.propertyName && e.propertyName.text, e.name.text) }); if (importSpecifiers) return [ts.makeImport(void 0, importSpecifiers, moduleSpecifier, quotePreference)]; case 180: var tmp = makeUniqueName(codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers); return [ts.makeImport(ts.createIdentifier(tmp), void 0, moduleSpecifier, quotePreference), makeConst(void 0, ts.getSynthesizedDeepClone(name), ts.createIdentifier(tmp))]; case 71: return convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference); default: ts.Debug.assertNever(name) } } function convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference) { for (var nameSymbol = checker.getSymbolAtLocation(name), namedBindingsNames = ts.createMap(), needDefaultImport = !1, _i = 0, _a = identifiers.original.get(name.text); _i < _a.length; _i++) { var use = _a[_i]; if (checker.getSymbolAtLocation(use) === nameSymbol && use !== name) { var parent = use.parent; if (ts.isPropertyAccessExpression(parent)) { var expression = parent.expression, propertyName = parent.name.text; ts.Debug.assert(expression === use); var idName = namedBindingsNames.get(propertyName); void 0 === idName && (idName = makeUniqueName(propertyName, identifiers), namedBindingsNames.set(propertyName, idName)), changes.replaceNode(file, parent, ts.createIdentifier(idName)) } else needDefaultImport = !0 } } var namedBindings = 0 === namedBindingsNames.size ? void 0 : ts.arrayFrom(ts.mapIterator(namedBindingsNames.entries(), function (_a) { var propertyName = _a[0], idName = _a[1]; return ts.createImportSpecifier(propertyName === idName ? void 0 : ts.createIdentifier(propertyName), ts.createIdentifier(idName)) })); return namedBindings || (needDefaultImport = !0), [ts.makeImport(needDefaultImport ? ts.getSynthesizedDeepClone(name) : void 0, namedBindings, moduleSpecifier, quotePreference)] } function makeUniqueName(name, identifiers) { for (; identifiers.original.has(name) || identifiers.additional.has(name);)name = "_" + name; return identifiers.additional.set(name, !0), name } function collectFreeIdentifiers(file) { var map = ts.createMultiMap(); return file.forEachChild(function recur(node) { ts.isIdentifier(node) && isFreeIdentifier(node) && map.add(node.text, node), node.forEachChild(recur) }), map } function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { case 184: return parent.name !== node; case 181: return parent.propertyName !== node; default: return !0 } } function functionExpressionToDeclaration(name, additionalModifiers, fn) { return ts.createFunctionDeclaration(ts.getSynthesizedDeepClones(fn.decorators), ts.concatenate(additionalModifiers, ts.getSynthesizedDeepClones(fn.modifiers)), ts.getSynthesizedDeepClone(fn.asteriskToken), name, ts.getSynthesizedDeepClones(fn.typeParameters), ts.getSynthesizedDeepClones(fn.parameters), ts.getSynthesizedDeepClone(fn.type), ts.convertToFunctionBody(ts.getSynthesizedDeepClone(fn.body))) } function classExpressionToDeclaration(name, additionalModifiers, cls) { return ts.createClassDeclaration(ts.getSynthesizedDeepClones(cls.decorators), ts.concatenate(additionalModifiers, ts.getSynthesizedDeepClones(cls.modifiers)), name, ts.getSynthesizedDeepClones(cls.typeParameters), ts.getSynthesizedDeepClones(cls.heritageClauses), ts.getSynthesizedDeepClones(cls.members)) } function makeSingleImport(localName, propertyName, moduleSpecifier, quotePreference) { return "default" === propertyName ? ts.makeImport(ts.createIdentifier(localName), void 0, moduleSpecifier, quotePreference) : ts.makeImport(void 0, [makeImportSpecifier(propertyName, localName)], moduleSpecifier, quotePreference) } function makeImportSpecifier(propertyName, name) { return ts.createImportSpecifier(void 0 !== propertyName && propertyName !== name ? ts.createIdentifier(propertyName) : void 0, ts.createIdentifier(name)) } function makeConst(modifiers, name, init) { return ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([ts.createVariableDeclaration(name, void 0, init)], 2)) } function makeExportDeclaration(exportSpecifiers, moduleSpecifier) { return ts.createExportDeclaration(void 0, void 0, exportSpecifiers && ts.createNamedExports(exportSpecifiers), void 0 === moduleSpecifier ? void 0 : ts.createLiteral(moduleSpecifier)) } codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module.code], getCodeActions: function (context) { var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, changes = ts.textChanges.ChangeTracker.with(context, function (changes) { var moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, program.getCompilerOptions().target, ts.getQuotePreference(sourceFile, preferences)); if (moduleExportsChangedToDefault) for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var importingFile = _a[_i]; fixImportOfModuleExports(importingFile, sourceFile, changes, ts.getQuotePreference(importingFile, preferences)) } }); return [codefix.createCodeFixActionNoFixId("convertToEs6Module", changes, ts.Diagnostics.Convert_to_ES6_module)] } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getQualifiedName(sourceFile, pos) { var qualifiedName = ts.findAncestor(ts.getTokenAtPosition(sourceFile, pos, !0), ts.isQualifiedName); return ts.Debug.assert(!!qualifiedName, "Expected position to be owned by a qualified name."), ts.isIdentifier(qualifiedName.left) ? qualifiedName : void 0 } function doChange(changeTracker, sourceFile, qualifiedName) { var rightText = qualifiedName.right.text, replacement = ts.createIndexedAccessTypeNode(ts.createTypeReferenceNode(qualifiedName.left, void 0), ts.createLiteralTypeNode(ts.createLiteral(rightText))); changeTracker.replaceNode(sourceFile, qualifiedName, replacement) } var fixId = "correctQualifiedNameToIndexedAccessType", errorCodes = [ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var qualifiedName = getQualifiedName(context.sourceFile, context.span.start); if (qualifiedName) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, qualifiedName) }), newText = qualifiedName.left.text + '["' + qualifiedName.right.text + '"]'; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, ts.Diagnostics.Rewrite_all_as_indexed_access_types)] } }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var q = getQualifiedName(diag.file, diag.start); q && doChange(changes, diag.file, q) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getClass(sourceFile, pos) { return ts.Debug.assertDefined(ts.getContainingClass(ts.getTokenAtPosition(sourceFile, pos, !1))) } function addMissingDeclarations(checker, implementedTypeNode, sourceFile, classDeclaration, changeTracker, preferences) { function createMissingIndexSignatureDeclaration(type, kind) { var indexInfoOfKind = checker.getIndexInfoOfType(type, kind); indexInfoOfKind && changeTracker.insertNodeAtClassStart(sourceFile, classDeclaration, checker.indexInfoToIndexSignatureDeclaration(indexInfoOfKind, kind, classDeclaration)) } var implementedType = checker.getTypeAtLocation(implementedTypeNode), implementedTypeSymbols = checker.getPropertiesOfType(implementedType), nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(8 & ts.getModifierFlags(symbol.valueDeclaration)) }), classType = checker.getTypeAtLocation(classDeclaration); classType.getNumberIndexType() || createMissingIndexSignatureDeclaration(implementedType, 1), classType.getStringIndexType() || createMissingIndexSignatureDeclaration(implementedType, 0), codefix.createMissingMemberNodes(classDeclaration, nonPrivateMembers, checker, preferences, function (member) { return changeTracker.insertNodeAtClassStart(sourceFile, classDeclaration, member) }) } var errorCodes = [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code, ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code], fixId = "fixClassIncorrectlyImplementsInterface"; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var program = context.program, sourceFile = context.sourceFile, span = context.span, classDeclaration = getClass(sourceFile, span.start), checker = program.getTypeChecker(); return ts.mapDefined(ts.getClassImplementsHeritageClauseElements(classDeclaration), function (implementedTypeNode) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingDeclarations(checker, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences) }); return 0 === changes.length ? void 0 : codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId, ts.Diagnostics.Implement_all_unimplemented_interfaces) }) }, fixIds: [fixId], getAllCodeActions: function (context) { var seenClassDeclarations = ts.createMap(); return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var classDeclaration = getClass(diag.file, diag.start); if (ts.addToSeen(seenClassDeclarations, ts.getNodeId(classDeclaration))) for (var _i = 0, _a = ts.getClassImplementsHeritageClauseElements(classDeclaration); _i < _a.length; _i++) { var implementedTypeNode = _a[_i]; addMissingDeclarations(context.program.getTypeChecker(), implementedTypeNode, diag.file, classDeclaration, changes, context.preferences) } }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function createCodeAction(descriptionDiagnostic, diagnosticArgs, changes) { return codefix.createCodeFixActionNoFixId("import", changes, [descriptionDiagnostic].concat(diagnosticArgs)) } function convertToImportCodeFixContext(context, symbolToken, symbolName) { var program = context.program, checker = program.getTypeChecker(); return { host: context.host, formatContext: context.formatContext, sourceFile: context.sourceFile, program: program, checker: checker, compilerOptions: program.getCompilerOptions(), cachedImportDeclarations: [], getCanonicalFileName: ts.createGetCanonicalFileName(ts.hostUsesCaseSensitiveFileNames(context.host)), symbolName: symbolName, symbolToken: symbolToken, preferences: context.preferences } } function getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, symbolName, host, program, checker, compilerOptions, allSourceFiles, formatContext, getCanonicalFileName, symbolToken, preferences) { var exportInfos = getAllReExportingModules(exportedSymbol, moduleSymbol, symbolName, sourceFile, checker, allSourceFiles); ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol })); var moduleSpecifier = ts.first(getNewImportInfos(program, sourceFile, exportInfos, host, preferences)).moduleSpecifier, ctx = { host: host, program: program, checker: checker, compilerOptions: compilerOptions, sourceFile: sourceFile, formatContext: formatContext, symbolName: symbolName, getCanonicalFileName: getCanonicalFileName, symbolToken: symbolToken, preferences: preferences }; return { moduleSpecifier: moduleSpecifier, codeAction: ts.first(getCodeActionsForImport(exportInfos, ctx)) } } function getAllReExportingModules(exportedSymbol, exportingModuleSymbol, symbolName, sourceFile, checker, allSourceFiles) { var result = []; return forEachExternalModule(checker, allSourceFiles, function (moduleSymbol, moduleFile) { if (!moduleFile || moduleSymbol === exportingModuleSymbol || !ts.startsWith(sourceFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) for (var _i = 0, _a = checker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) { var exported = _a[_i]; if (("default" === exported.escapedName || exported.name === symbolName) && ts.skipAlias(exported, checker) === exportedSymbol) { var isDefaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol) === exported; result.push({ moduleSymbol: moduleSymbol, importKind: isDefaultExport ? 1 : 0 }) } } }), result } function getCodeActionsForImport(exportInfos, context) { var result = []; return getCodeActionsForImport_separateExistingAndNew(exportInfos, context, result, result), result } function getCodeActionsForImport_separateExistingAndNew(exportInfos, context, useExisting, addNew) { var existingImports = ts.flatMap(exportInfos, function (info) { return getImportDeclarations(info, context.checker, context.sourceFile, context.cachedImportDeclarations) }); if (context.symbolToken && ts.isIdentifier(context.symbolToken)) for (var _i = 0, existingImports_1 = existingImports; _i < existingImports_1.length; _i++) { var declaration = existingImports_1[_i].declaration, namespace_2 = getNamespaceImportName(declaration); if (namespace_2) { var moduleSymbol = context.checker.getAliasedSymbol(context.checker.getSymbolAtLocation(namespace_2)); moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(context.symbolName)) && useExisting.push(getCodeActionForUseExistingNamespaceImport(namespace_2.text, context, context.symbolToken)) } } getCodeActionsForAddImport(exportInfos, context, existingImports, useExisting, addNew) } function getNamespaceImportName(declaration) { if (243 === declaration.kind) { var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings; return namedBindings && 245 === namedBindings.kind ? namedBindings.name : void 0 } return declaration.name } function getImportDeclarations(_a, checker, _b, cachedImportDeclarations) { var moduleSymbol = _a.moduleSymbol, importKind = _a.importKind, imports = _b.imports; void 0 === cachedImportDeclarations && (cachedImportDeclarations = []); var moduleSymbolId = ts.getUniqueSymbolId(moduleSymbol, checker), cached = cachedImportDeclarations[moduleSymbolId]; return cached || (cached = cachedImportDeclarations[moduleSymbolId] = ts.mapDefined(imports, function (moduleSpecifier) { var i = ts.importFromModuleSpecifier(moduleSpecifier); return 243 !== i.kind && 242 !== i.kind || checker.getSymbolAtLocation(moduleSpecifier) !== moduleSymbol ? void 0 : { declaration: i, importKind: importKind } })), cached } function getCodeActionForNewImport(context, _a) { var moduleSpecifier = _a.moduleSpecifier, importKind = _a.importKind, sourceFile = context.sourceFile, symbolName = context.symbolName, preferences = context.preferences, lastImportDeclaration = ts.findLast(sourceFile.statements, ts.isAnyImportSyntax), moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier), quotedModuleSpecifier = ts.makeStringLiteral(moduleSpecifierWithoutQuotes, ts.getQuotePreference(sourceFile, preferences)), importDecl = 3 !== importKind ? ts.createImportDeclaration(void 0, void 0, createImportClauseOfKind(importKind, symbolName), quotedModuleSpecifier) : ts.createImportEqualsDeclaration(void 0, void 0, ts.createIdentifier(symbolName), ts.createExternalModuleReference(quotedModuleSpecifier)), changes = ChangeTracker.with(context, function (changeTracker) { lastImportDeclaration ? changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl) : changeTracker.insertNodeAtTopOfFile(sourceFile, importDecl, !0) }); return createCodeAction(ts.Diagnostics.Import_0_from_module_1, [symbolName, moduleSpecifierWithoutQuotes], changes) } function createImportClauseOfKind(kind, symbolName) { var id = ts.createIdentifier(symbolName); switch (kind) { case 1: return ts.createImportClause(id, void 0); case 2: return ts.createImportClause(void 0, ts.createNamespaceImport(id)); case 0: return ts.createImportClause(void 0, ts.createNamedImports([ts.createImportSpecifier(void 0, id)])); default: ts.Debug.assertNever(kind) } } function getNewImportInfos(program, sourceFile, moduleSymbols, host, preferences) { var choicesForEachExportingModule = ts.flatMap(moduleSymbols, function (_a) { var moduleSymbol = _a.moduleSymbol, importKind = _a.importKind, modulePathsGroups = ts.moduleSpecifiers.getModuleSpecifiers(moduleSymbol, program.getCompilerOptions(), sourceFile, host, program.getSourceFiles(), preferences); return modulePathsGroups.map(function (group) { return group.map(function (moduleSpecifier) { return { moduleSpecifier: moduleSpecifier, importKind: importKind } }) }) }); return ts.flatten(choicesForEachExportingModule.sort(function (a, b) { return ts.first(a).moduleSpecifier.length - ts.first(b).moduleSpecifier.length })) } function getCodeActionsForAddImport(exportInfos, ctx, existingImports, useExisting, addNew) { var fromExistingImport = ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind; if (243 === declaration.kind && declaration.importClause) { var changes = tryUpdateExistingImport(ctx, ts.isImportClause(declaration.importClause) && declaration.importClause || void 0, importKind); if (changes) { var moduleSpecifierWithoutQuotes = ts.stripQuotes(declaration.moduleSpecifier.getText()); return createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [ctx.symbolName, moduleSpecifierWithoutQuotes], changes) } } }); if (fromExistingImport) return void useExisting.push(fromExistingImport); for (var existingDeclaration = ts.firstDefined(existingImports, newImportInfoFromExistingSpecifier), newImportInfos = existingDeclaration ? [existingDeclaration] : getNewImportInfos(ctx.program, ctx.sourceFile, exportInfos, ctx.host, ctx.preferences), _i = 0, newImportInfos_1 = newImportInfos; _i < newImportInfos_1.length; _i++) { var info = newImportInfos_1[_i]; addNew.push(getCodeActionForNewImport(ctx, info)) } } function newImportInfoFromExistingSpecifier(_a) { var declaration = _a.declaration, importKind = _a.importKind, expression = 243 === declaration.kind ? declaration.moduleSpecifier : 253 === declaration.moduleReference.kind ? declaration.moduleReference.expression : void 0; return expression && ts.isStringLiteral(expression) ? { moduleSpecifier: expression.text, importKind: importKind } : void 0 } function tryUpdateExistingImport(context, importClause, importKind) { var symbolName = context.symbolName, sourceFile = context.sourceFile, name = importClause.name, namedBindings = (242 !== importClause.kind && importClause).namedBindings; switch (importKind) { case 1: return name ? void 0 : ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, importClause, ts.createImportClause(ts.createIdentifier(symbolName), namedBindings)) }); case 0: var newImportSpecifier_1 = ts.createImportSpecifier(void 0, ts.createIdentifier(symbolName)); if (namedBindings && 246 === namedBindings.kind && 0 !== namedBindings.elements.length) return ChangeTracker.with(context, function (t) { return t.insertNodeInListAfter(sourceFile, namedBindings.elements[namedBindings.elements.length - 1], newImportSpecifier_1) }); if (!namedBindings || 246 === namedBindings.kind && 0 === namedBindings.elements.length) return ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, importClause, ts.createImportClause(name, ts.createNamedImports([newImportSpecifier_1]))) }); return; case 2: return namedBindings ? void 0 : ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, importClause, ts.createImportClause(name, ts.createNamespaceImport(ts.createIdentifier(symbolName)))) }); case 3: return; default: ts.Debug.assertNever(importKind) } } function getCodeActionForUseExistingNamespaceImport(namespacePrefix, context, symbolToken) { var symbolName = context.symbolName, sourceFile = context.sourceFile, changes = ChangeTracker.with(context, function (tracker) { return tracker.replaceNode(sourceFile, symbolToken, ts.createPropertyAccess(ts.createIdentifier(namespacePrefix), symbolToken)) }); return createCodeAction(ts.Diagnostics.Change_0_to_1, [symbolName, namespacePrefix + "." + symbolName], changes) } function getImportCodeActions(context) { return context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code ? getActionsForUMDImport(context) : getActionsForNonUMDImport(context) } function getActionsForUMDImport(context) { var umdSymbol, token = ts.getTokenAtPosition(context.sourceFile, context.span.start, !1), checker = context.program.getTypeChecker(); if (ts.isIdentifier(token) && (umdSymbol = checker.getSymbolAtLocation(token)), !ts.isUMDExportSymbol(umdSymbol)) { var parent = token.parent, isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(parent); (ts.isJsxOpeningLikeElement && parent.tagName === token || 259 === parent.kind) && (umdSymbol = checker.resolveName(checker.getJsxNamespace(parent), isNodeOpeningLikeElement ? parent.tagName : parent, 67216319, !1)) } if (ts.isUMDExportSymbol(umdSymbol)) { var symbol = checker.getAliasedSymbol(umdSymbol); if (symbol) return getCodeActionsForImport([{ moduleSymbol: symbol, importKind: getUmdImportKind(context.program.getCompilerOptions()) }], convertToImportCodeFixContext(context, token, umdSymbol.name)) } } function getUmdImportKind(compilerOptions) { if (ts.getAllowSyntheticDefaultImports(compilerOptions)) return 1; var moduleKind = ts.getEmitModuleKind(compilerOptions); switch (moduleKind) { case ts.ModuleKind.AMD: case ts.ModuleKind.CommonJS: case ts.ModuleKind.UMD: return 3; case ts.ModuleKind.System: case ts.ModuleKind.ES2015: case ts.ModuleKind.ESNext: case ts.ModuleKind.None: return 2; default: return ts.Debug.assertNever(moduleKind) } } function getActionsForNonUMDImport(context) { function addSymbol(moduleSymbol, exportedSymbol, importKind) { originalSymbolToExportInfos.add(ts.getUniqueSymbolId(exportedSymbol, checker).toString(), { moduleSymbol: moduleSymbol, importKind: importKind }) } var sourceFile = context.sourceFile, span = context.span, program = context.program, cancellationToken = context.cancellationToken, checker = program.getTypeChecker(), symbolToken = ts.getTokenAtPosition(sourceFile, span.start, !1), symbolName = ts.isJsxOpeningLikeElement(symbolToken.parent) && symbolToken.parent.tagName === symbolToken && (!ts.isIdentifier(symbolToken) || ts.isIntrinsicJsxName(symbolToken.text) || checker.resolveName(symbolToken.text, symbolToken, 67108863, !1)) ? checker.getJsxNamespace() : ts.isIdentifier(symbolToken) ? symbolToken.text : void 0; if (symbolName) { ts.Debug.assert("default" !== symbolName); var currentTokenMeaning = ts.getMeaningFromLocation(symbolToken), originalSymbolToExportInfos = ts.createMultiMap(); forEachExternalModuleToImportFrom(checker, sourceFile, program.getSourceFiles(), function (moduleSymbol) { function getEscapedNameForExportDefault(symbol) { return ts.firstDefined(symbol.declarations, function (declaration) { if (ts.isExportAssignment(declaration)) { if (ts.isIdentifier(declaration.expression)) return declaration.expression.escapedText } else if (ts.isExportSpecifier(declaration) && (ts.Debug.assert("default" === declaration.name.escapedText), declaration.propertyName)) return declaration.propertyName.escapedText }) } cancellationToken.throwIfCancellationRequested(); var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); (localSymbol && localSymbol.escapedName === symbolName || getEscapedNameForExportDefault(defaultExport) === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, program.getCompilerOptions().target) === symbolName) && checkSymbolHasMeaning(localSymbol || defaultExport, currentTokenMeaning) && addSymbol(moduleSymbol, localSymbol || defaultExport, 1) } var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName, moduleSymbol); exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning) && addSymbol(moduleSymbol, exportSymbolWithIdenticalName, 0) }); var addToExistingDeclaration = [], addNewDeclaration = []; return originalSymbolToExportInfos.forEach(function (exportInfos) { getCodeActionsForImport_separateExistingAndNew(exportInfos, convertToImportCodeFixContext(context, symbolToken, symbolName), addToExistingDeclaration, addNewDeclaration) }), addToExistingDeclaration.concat(addNewDeclaration) } } function checkSymbolHasMeaning(_a, meaning) { var declarations = _a.declarations; return ts.some(declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning) }) } function forEachExternalModuleToImportFrom(checker, from, allSourceFiles, cb) { forEachExternalModule(checker, allSourceFiles, function (module, sourceFile) { (void 0 === sourceFile || sourceFile !== from && isImportablePath(from.fileName, sourceFile.fileName)) && cb(module) }) } function forEachExternalModule(checker, allSourceFiles, cb) { for (var _i = 0, _a = checker.getAmbientModules(); _i < _a.length; _i++) { var ambient = _a[_i]; cb(ambient, void 0) } for (var _b = 0, allSourceFiles_1 = allSourceFiles; _b < allSourceFiles_1.length; _b++) { var sourceFile = allSourceFiles_1[_b]; ts.isExternalOrCommonJsModule(sourceFile) && cb(checker.getMergedSymbol(sourceFile.symbol), sourceFile) } } function isImportablePath(fromPath, toPath) { var toNodeModules = ts.forEachAncestorDirectory(toPath, function (ancestor) { return "node_modules" === ts.getBaseFileName(ancestor) ? ancestor : void 0 }); return void 0 === toNodeModules || ts.startsWith(fromPath, ts.getDirectoryPath(toNodeModules)) } function moduleSymbolToValidIdentifier(moduleSymbol, target) { return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.stripQuotes(moduleSymbol.name)), target) } function moduleSpecifierToValidIdentifier(moduleSpecifier, target) { var baseName = ts.getBaseFileName(ts.removeSuffix(moduleSpecifier, "/index")), res = "", lastCharWasValid = !0, firstCharCode = baseName.charCodeAt(0); ts.isIdentifierStart(firstCharCode, target) ? res += String.fromCharCode(firstCharCode) : lastCharWasValid = !1; for (var i = 1; i < baseName.length; i++) { var ch = baseName.charCodeAt(i), isValid = ts.isIdentifierPart(ch, target); if (isValid) { var char = String.fromCharCode(ch); lastCharWasValid || (char = char.toUpperCase()), res += char } lastCharWasValid = isValid } return ts.isStringANonContextualKeyword(res) ? "_" + res : res || "_" } var ChangeTracker = ts.textChanges.ChangeTracker; codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.Cannot_find_name_0.code, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, ts.Diagnostics.Cannot_find_namespace_0.code, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code], getCodeActions: getImportCodeActions, fixIds: [], getAllCodeActions: ts.notImplemented }); var ImportKind; !function (ImportKind) { ImportKind[ImportKind.Named = 0] = "Named", ImportKind[ImportKind.Default = 1] = "Default", ImportKind[ImportKind.Namespace = 2] = "Namespace", ImportKind[ImportKind.Equals = 3] = "Equals" }(ImportKind || (ImportKind = {})), codefix.getImportCompletionAction = getImportCompletionAction, codefix.forEachExternalModuleToImportFrom = forEachExternalModuleToImportFrom, codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier, codefix.moduleSpecifierToValidIdentifier = moduleSpecifierToValidIdentifier }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getInfo(sourceFile, pos, context) { var suggestion, node = ts.getTokenAtPosition(sourceFile, pos, !1), checker = context.program.getTypeChecker(); if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { ts.Debug.assert(71 === node.kind); var containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node, containingType) } else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) { ts.Debug.assert(71 === node.kind); var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration), resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); resolvedSourceFile && resolvedSourceFile.symbol && (suggestion = checker.getSuggestionForNonexistentModule(node, resolvedSourceFile.symbol)) } else { var meaning = ts.getMeaningFromLocation(node), name = ts.getTextOfNode(node); ts.Debug.assert(void 0 !== name, "name should be defined"), suggestion = checker.getSuggestionForNonexistentSymbol(node, name, convertSemanticMeaningToSymbolFlags(meaning)) } return void 0 === suggestion ? void 0 : { node: node, suggestion: suggestion } } function doChange(changes, sourceFile, node, suggestion, target) { !ts.isIdentifierText(suggestion, target) && ts.isPropertyAccessExpression(node.parent) ? changes.replaceNode(sourceFile, node.parent, ts.createElementAccess(node.parent.expression, ts.createLiteral(suggestion))) : changes.replaceNode(sourceFile, node, ts.createIdentifier(suggestion)) } function convertSemanticMeaningToSymbolFlags(meaning) { var flags = 0; return 4 & meaning && (flags |= 1920), 2 & meaning && (flags |= 67901928), 1 & meaning && (flags |= 67216319), flags } function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) { if (importDeclaration && ts.isStringLiteralLike(importDeclaration.moduleSpecifier)) { var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text); if (resolvedModule) return context.program.getSourceFile(resolvedModule.resolvedFileName) } } var fixId = "fixSpelling", errorCodes = [ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, info = getInfo(sourceFile, context.span.start, context); if (info) { var node = info.node, suggestion = info.suggestion, target = context.host.getCompilationSettings().target, changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestion, target) }); return [codefix.createCodeFixAction("spelling", changes, [ts.Diagnostics.Change_spelling_to_0, suggestion], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)] } }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var info = getInfo(diag.file, diag.start, context), target = context.host.getCompilationSettings().target; info && doChange(changes, context.sourceFile, info.node, info.suggestion, target) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getInfo(tokenSourceFile, tokenPos, checker) { var token = ts.getTokenAtPosition(tokenSourceFile, tokenPos, !1); if (ts.isIdentifier(token)) { var parent = token.parent; if (ts.isPropertyAccessExpression(parent)) { var leftExpressionType = ts.skipConstraint(checker.getTypeAtLocation(parent.expression)), symbol = leftExpressionType.symbol, classDeclaration = symbol && symbol.declarations && ts.find(symbol.declarations, ts.isClassLike); if (classDeclaration) { var makeStatic = leftExpressionType.target !== checker.getDeclaredTypeOfSymbol(symbol), classDeclarationSourceFile = classDeclaration.getSourceFile(), inJs = ts.isSourceFileJavaScript(classDeclarationSourceFile), call = ts.tryCast(parent.parent, ts.isCallExpression); return { token: token, classDeclaration: classDeclaration, makeStatic: makeStatic, classDeclarationSourceFile: classDeclarationSourceFile, inJs: inJs, call: call } } } } } function getActionsForAddMissingMemberInJavaScriptFile(context, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMemberInJs(t, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) }); return 0 === changes.length ? void 0 : codefix.createCodeFixAction(fixName, changes, [makeStatic ? ts.Diagnostics.Initialize_static_property_0 : ts.Diagnostics.Initialize_property_0_in_the_constructor, tokenName], fixId, ts.Diagnostics.Add_all_missing_members) } function addMissingMemberInJs(changeTracker, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic) { if (makeStatic) { if (204 === classDeclaration.kind) return; var className = classDeclaration.name.getText(), staticInitialization = initializePropertyToUndefined(ts.createIdentifier(className), tokenName); changeTracker.insertNodeAfter(classDeclarationSourceFile, classDeclaration, staticInitialization) } else { var classConstructor = ts.getFirstConstructorWithBody(classDeclaration); if (!classConstructor) return; var propertyInitialization = initializePropertyToUndefined(ts.createThis(), tokenName); changeTracker.insertNodeAtConstructorEnd(classDeclarationSourceFile, classConstructor, propertyInitialization) } } function initializePropertyToUndefined(obj, propertyName) { return ts.createStatement(ts.createAssignment(ts.createPropertyAccess(obj, propertyName), ts.createIdentifier("undefined"))) } function getActionsForAddMissingMemberInTypeScriptFile(context, classDeclarationSourceFile, classDeclaration, token, makeStatic) { var typeNode = getTypeNode(context.program.getTypeChecker(), classDeclaration, token), addProp = createAddPropertyDeclarationAction(context, classDeclarationSourceFile, classDeclaration, makeStatic, token.text, typeNode); return makeStatic ? [addProp] : [addProp, createAddIndexSignatureAction(context, classDeclarationSourceFile, classDeclaration, token.text, typeNode)] } function getTypeNode(checker, classDeclaration, token) { var typeNode; if (199 === token.parent.parent.kind) { var binaryExpression = token.parent.parent, otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left, widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); typeNode = checker.typeToTypeNode(widenedType, classDeclaration) } return typeNode || ts.createKeywordTypeNode(119) } function createAddPropertyDeclarationAction(context, classDeclarationSourceFile, classDeclaration, makeStatic, tokenName, typeNode) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addPropertyDeclaration(t, classDeclarationSourceFile, classDeclaration, tokenName, typeNode, makeStatic) }); return codefix.createCodeFixAction(fixName, changes, [makeStatic ? ts.Diagnostics.Declare_static_property_0 : ts.Diagnostics.Declare_property_0, tokenName], fixId, ts.Diagnostics.Add_all_missing_members) } function addPropertyDeclaration(changeTracker, classDeclarationSourceFile, classDeclaration, tokenName, typeNode, makeStatic) { var property = ts.createProperty(void 0, makeStatic ? [ts.createToken(115)] : void 0, tokenName, void 0, typeNode, void 0), lastProp = getNodeToInsertPropertyAfter(classDeclaration); lastProp ? changeTracker.insertNodeAfter(classDeclarationSourceFile, lastProp, property) : changeTracker.insertNodeAtClassStart(classDeclarationSourceFile, classDeclaration, property) } function getNodeToInsertPropertyAfter(cls) { for (var res, _i = 0, _a = cls.members; _i < _a.length; _i++) { var member = _a[_i]; if (!ts.isPropertyDeclaration(member)) break; res = member } return res } function createAddIndexSignatureAction(context, classDeclarationSourceFile, classDeclaration, tokenName, typeNode) { var stringTypeNode = ts.createKeywordTypeNode(137), indexingParameter = ts.createParameter(void 0, void 0, void 0, "x", void 0, stringTypeNode, void 0), indexSignature = ts.createIndexSignature(void 0, void 0, [indexingParameter], typeNode), changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.insertNodeAtClassStart(classDeclarationSourceFile, classDeclaration, indexSignature) }); return codefix.createCodeFixActionNoFixId(fixName, changes, [ts.Diagnostics.Add_index_signature_for_property_0, tokenName]) } function getActionForMethodDeclaration(context, classDeclarationSourceFile, classDeclaration, token, callExpression, makeStatic, inJs, preferences) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMethodDeclaration(t, classDeclarationSourceFile, classDeclaration, token, callExpression, makeStatic, inJs, preferences) }); return codefix.createCodeFixAction(fixName, changes, [makeStatic ? ts.Diagnostics.Declare_static_method_0 : ts.Diagnostics.Declare_method_0, token.text], fixId, ts.Diagnostics.Add_all_missing_members) } function addMethodDeclaration(changeTracker, classDeclarationSourceFile, classDeclaration, token, callExpression, makeStatic, inJs, preferences) { var methodDeclaration = codefix.createMethodFromCallExpression(callExpression, token.text, inJs, makeStatic, preferences); changeTracker.insertNodeAtClassStart(classDeclarationSourceFile, classDeclaration, methodDeclaration) } var fixName = "addMissingMember", errorCodes = [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code], fixId = "addMissingMember"; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker()); if (info) { var classDeclaration = info.classDeclaration, classDeclarationSourceFile = info.classDeclarationSourceFile, inJs = info.inJs, makeStatic = info.makeStatic, token = info.token, call = info.call, methodCodeAction = call && getActionForMethodDeclaration(context, classDeclarationSourceFile, classDeclaration, token, call, makeStatic, inJs, context.preferences), addMember = inJs ? ts.singleElementArray(getActionsForAddMissingMemberInJavaScriptFile(context, classDeclarationSourceFile, classDeclaration, token.text, makeStatic)) : getActionsForAddMissingMemberInTypeScriptFile(context, classDeclarationSourceFile, classDeclaration, token, makeStatic); return ts.concatenate(ts.singleElementArray(methodCodeAction), addMember) } }, fixIds: [fixId], getAllCodeActions: function (context) { var seenNames = ts.createMap(); return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var program = context.program, preferences = context.preferences, info = getInfo(diag.file, diag.start, program.getTypeChecker()); if (info) { var classDeclaration = info.classDeclaration, classDeclarationSourceFile = info.classDeclarationSourceFile, inJs = info.inJs, makeStatic = info.makeStatic, token = info.token, call = info.call; if (ts.addToSeen(seenNames, token.text)) if (call) addMethodDeclaration(changes, classDeclarationSourceFile, classDeclaration, token, call, makeStatic, inJs, preferences); else if (inJs) addMissingMemberInJs(changes, classDeclarationSourceFile, classDeclaration, token.text, makeStatic); else { var typeNode = getTypeNode(program.getTypeChecker(), classDeclaration, token); addPropertyDeclaration(changes, classDeclarationSourceFile, classDeclaration, token.text, typeNode, makeStatic) } } }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getCommand(fileName, packageName) { return { type: "install package", file: fileName, packageName: packageName } } function getTypesPackageNameToInstall(host, sourceFile, pos, diagCode) { var moduleName = ts.cast(ts.getTokenAtPosition(sourceFile, pos, !1), ts.isStringLiteral).text, packageName = ts.getPackageName(moduleName).packageName; return diagCode === errorCodeCannotFindModule ? ts.JsTyping.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : host.isKnownTypesPackageName(packageName) ? ts.getTypesPackageName(packageName) : void 0 } var fixId = "fixCannotFindModule", errorCodeCannotFindModule = ts.Diagnostics.Cannot_find_module_0.code, errorCodes = [errorCodeCannotFindModule, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var host = context.host, sourceFile = context.sourceFile, start = context.span.start, packageName = getTypesPackageNameToInstall(host, sourceFile, start, context.errorCode); return void 0 === packageName ? [] : [codefix.createCodeFixAction(fixId, [], [ts.Diagnostics.Install_0, packageName], fixId, ts.Diagnostics.Install_all_missing_types_packages, getCommand(sourceFile.fileName, packageName))] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (_, diag, commands) { var pkg = getTypesPackageNameToInstall(context.host, diag.file, diag.start, diag.code); pkg && commands.push(getCommand(diag.file.fileName, pkg)) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getClass(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos, !1); return ts.cast(token.parent, ts.isClassLike) } function addMissingMembers(classDeclaration, sourceFile, checker, changeTracker, preferences) { var extendsNode = ts.getClassExtendsHeritageClauseElement(classDeclaration), instantiatedExtendsType = checker.getTypeAtLocation(extendsNode), abstractAndNonPrivateExtendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType).filter(symbolPointsToNonPrivateAndAbstractMember); codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, checker, preferences, function (member) { return changeTracker.insertNodeAtClassStart(sourceFile, classDeclaration, member) }) } function symbolPointsToNonPrivateAndAbstractMember(symbol) { var flags = ts.getModifierFlags(ts.first(symbol.getDeclarations())); return !(8 & flags || !(128 & flags)) } var errorCodes = [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], fixId = "fixClassDoesntImplementInheritedAbstractMember"; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var program = context.program, sourceFile = context.sourceFile, span = context.span, changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingMembers(getClass(sourceFile, span.start), sourceFile, program.getTypeChecker(), t, context.preferences) }); return 0 === changes.length ? void 0 : [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Implement_inherited_abstract_class, fixId, ts.Diagnostics.Implement_all_inherited_abstract_classes)] }, fixIds: [fixId], getAllCodeActions: function (context) { var seenClassDeclarations = ts.createMap(); return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var classDeclaration = getClass(diag.file, diag.start); ts.addToSeen(seenClassDeclarations, ts.getNodeId(classDeclaration)) && addMissingMembers(classDeclaration, context.sourceFile, context.program.getTypeChecker(), changes, context.preferences) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function doChange(changes, sourceFile, constructor, superCall) { changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall), changes.deleteNode(sourceFile, superCall) } function getNodes(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos, !1); if (99 === token.kind) { var constructor = ts.getContainingFunction(token), superCall = findSuperCall(constructor.body); return superCall && !superCall.expression.arguments.some(function (arg) { return ts.isPropertyAccessExpression(arg) && arg.expression === token }) ? { constructor: constructor, superCall: superCall } : void 0 } } function findSuperCall(n) { return ts.isExpressionStatement(n) && ts.isSuperCall(n.expression) ? n : ts.isFunctionLike(n) ? void 0 : ts.forEachChild(n, findSuperCall) } var fixId = "classSuperMustPrecedeThisAccess", errorCodes = [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, span = context.span, nodes = getNodes(sourceFile, span.start); if (nodes) { var constructor = nodes.constructor, superCall = nodes.superCall, changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, constructor, superCall) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId, ts.Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)] } }, fixIds: [fixId], getAllCodeActions: function (context) { var sourceFile = context.sourceFile, seenClasses = ts.createMap(); return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var nodes = getNodes(diag.file, diag.start); if (nodes) { var constructor = nodes.constructor, superCall = nodes.superCall; ts.addToSeen(seenClasses, ts.getNodeId(constructor.parent)) && doChange(changes, sourceFile, constructor, superCall) } }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos, !1); return ts.Debug.assert(123 === token.kind), token.parent } function doChange(changes, sourceFile, ctr) { var superCall = ts.createStatement(ts.createCall(ts.createSuper(), void 0, ts.emptyArray)); changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall) } var fixId = "constructorForDerivedNeedSuperCall", errorCodes = [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, span = context.span, ctr = getNode(sourceFile, span.start), changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, ctr) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_super_call, fixId, ts.Diagnostics.Add_all_missing_super_calls)] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return doChange(changes, context.sourceFile, getNode(diag.file, diag.start)) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getNodes(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos, !1), heritageClauses = ts.getContainingClass(token).heritageClauses, extendsToken = heritageClauses[0].getFirstToken(); return 85 === extendsToken.kind ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : void 0 } function doChanges(changes, sourceFile, extendsToken, heritageClauses) { if (changes.replaceNode(sourceFile, extendsToken, ts.createToken(108)), 2 === heritageClauses.length && 85 === heritageClauses[0].token && 108 === heritageClauses[1].token) { var implementsToken = heritageClauses[1].getFirstToken(), implementsFullStart = implementsToken.getFullStart(); changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, ts.createToken(26)); for (var text = sourceFile.text, end = implementsToken.end; end < text.length && ts.isWhiteSpaceSingleLine(text.charCodeAt(end));)end++; changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end: end }) } } var fixId = "extendsInterfaceBecomesImplements", errorCodes = [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, nodes = getNodes(sourceFile, context.span.start); if (nodes) { var extendsToken = nodes.extendsToken, heritageClauses = nodes.heritageClauses, changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChanges(t, sourceFile, extendsToken, heritageClauses) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Change_extends_to_implements, fixId, ts.Diagnostics.Change_all_extended_interfaces_to_implements)] } }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var nodes = getNodes(diag.file, diag.start); nodes && doChanges(changes, diag.file, nodes.extendsToken, nodes.heritageClauses) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getInfo(sourceFile, pos, diagCode) { var node = ts.getTokenAtPosition(sourceFile, pos, !1); if (ts.isIdentifier(node)) return { node: node, className: diagCode === didYouMeanStaticMemberCode ? ts.getContainingClass(node).name.text : void 0 } } function doChange(changes, sourceFile, _a) { var node = _a.node, className = _a.className; ts.suppressLeadingAndTrailingTrivia(node), changes.replaceNode(sourceFile, node, ts.createPropertyAccess(className ? ts.createIdentifier(className) : ts.createThis(), node)) } var fixId = "forgottenThisPropertyAccess", didYouMeanStaticMemberCode = ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code, errorCodes = [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, didYouMeanStaticMemberCode]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, info = getInfo(sourceFile, context.span.start, context.errorCode); if (info) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info) }); return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId, ts.Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)] } }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { doChange(changes, context.sourceFile, getInfo(diag.file, diag.start, diag.code)) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function tryGetFullImport(startToken) { return 91 === startToken.kind ? ts.tryCast(startToken.parent, ts.isImportDeclaration) : void 0 } function tryDeleteFullDestructure(changes, sourceFile, startToken, deletedAncestors) { if (17 !== startToken.kind || !ts.isObjectBindingPattern(startToken.parent)) return !1; var decl = ts.cast(startToken.parent, ts.isObjectBindingPattern).parent; switch (decl.kind) { case 231: tryDeleteVariableDeclaration(changes, sourceFile, decl, deletedAncestors); break; case 148: deletedAncestors && deletedAncestors.add(decl), changes.deleteNodeInList(sourceFile, decl); break; case 181: deletedAncestors && deletedAncestors.add(decl), changes.deleteNode(sourceFile, decl); break; default: return ts.Debug.assertNever(decl) }return !0 } function tryDeleteFullVariableStatement(changes, sourceFile, startToken, deletedAncestors) { var declarationList = ts.tryCast(startToken.parent, ts.isVariableDeclarationList); return !(!declarationList || declarationList.getChildren(sourceFile)[0] !== startToken) && (deletedAncestors && deletedAncestors.add(declarationList), changes.deleteNode(sourceFile, 213 === declarationList.parent.kind ? declarationList.parent : declarationList), !0) } function getToken(sourceFile, pos) { var token = ts.findPrecedingToken(pos, sourceFile, void 0, !0); return 22 === token.kind ? ts.findPrecedingToken(pos - 1, sourceFile) : token } function tryPrefixDeclaration(changes, errorCode, sourceFile, token) { errorCode !== ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code && ts.isIdentifier(token) && canPrefix(token) && changes.replaceNode(sourceFile, token, ts.createIdentifier("_" + token.text)) } function canPrefix(token) { switch (token.parent.kind) { case 148: return !0; case 231: var varDecl = token.parent; switch (varDecl.parent.parent.kind) { case 221: case 220: return !0 } }return !1 } function tryDeleteDeclaration(changes, sourceFile, token, deletedAncestors) { switch (token.kind) { case 71: tryDeleteIdentifier(changes, sourceFile, token, deletedAncestors); break; case 151: case 245: deletedAncestors && deletedAncestors.add(token.parent), changes.deleteNode(sourceFile, token.parent); break; default: tryDeleteDefault(changes, sourceFile, token, deletedAncestors) } } function tryDeleteDefault(changes, sourceFile, token, deletedAncestors) { ts.isDeclarationName(token) ? (deletedAncestors && deletedAncestors.add(token.parent), changes.deleteNode(sourceFile, token.parent)) : ts.isLiteralComputedPropertyDeclarationName(token) && (deletedAncestors && deletedAncestors.add(token.parent.parent), changes.deleteNode(sourceFile, token.parent.parent)) } function tryDeleteIdentifier(changes, sourceFile, identifier, deletedAncestors) { var parent = identifier.parent; switch (parent.kind) { case 231: tryDeleteVariableDeclaration(changes, sourceFile, parent, deletedAncestors); break; case 147: var typeParameters = ts.getEffectiveTypeParameterDeclarations(parent.parent); if (1 === typeParameters.length) { var _a = ts.cast(typeParameters, ts.isNodeArray), pos = _a.pos, end = _a.end, previousToken = ts.getTokenAtPosition(sourceFile, pos - 1, !1), nextToken = ts.getTokenAtPosition(sourceFile, end, !1); ts.Debug.assert(27 === previousToken.kind), ts.Debug.assert(29 === nextToken.kind), changes.deleteNodeRange(sourceFile, previousToken, nextToken) } else changes.deleteNodeInList(sourceFile, parent); break; case 148: var oldFunction = parent.parent; if (ts.isSetAccessor(oldFunction)) break; if (ts.isArrowFunction(oldFunction) && 1 === oldFunction.parameters.length) { var newFunction = ts.updateArrowFunction(oldFunction, oldFunction.modifiers, oldFunction.typeParameters, void 0, oldFunction.type, oldFunction.equalsGreaterThanToken, oldFunction.body); ts.suppressLeadingAndTrailingTrivia(newFunction), changes.replaceNode(sourceFile, oldFunction, newFunction) } else changes.deleteNodeInList(sourceFile, parent); break; case 181: var pattern = parent.parent; switch (pattern.kind) { case 180: changes.deleteNode(sourceFile, parent); break; case 179: changes.deleteNodeInList(sourceFile, parent); break; default: return ts.Debug.assertNever(pattern) }break; case 242: var importEquals = ts.getAncestor(identifier, 242); changes.deleteNode(sourceFile, importEquals); break; case 247: var namedImports = parent.parent; 1 === namedImports.elements.length ? tryDeleteNamedImportBinding(changes, sourceFile, namedImports) : changes.deleteNodeInList(sourceFile, parent); break; case 244: var importClause = parent; if (importClause.namedBindings) { var start = importClause.name.getStart(sourceFile), nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end, !1); if (nextToken && 26 === nextToken.kind) { var end = ts.skipTrivia(sourceFile.text, nextToken.end, !1, !0); changes.deleteRange(sourceFile, { pos: start, end: end }) } else changes.deleteNode(sourceFile, importClause.name) } else changes.deleteNode(sourceFile, ts.getAncestor(importClause, 243)); break; case 245: tryDeleteNamedImportBinding(changes, sourceFile, parent); break; default: tryDeleteDefault(changes, sourceFile, identifier, deletedAncestors) } } function tryDeleteNamedImportBinding(changes, sourceFile, namedBindings) { if (namedBindings.parent.name) { var previousToken = ts.getTokenAtPosition(sourceFile, namedBindings.pos - 1, !1); previousToken && 26 === previousToken.kind && changes.deleteRange(sourceFile, { pos: previousToken.getStart(), end: namedBindings.end }) } else { var importDecl = ts.getAncestor(namedBindings, 243); changes.deleteNode(sourceFile, importDecl) } } function tryDeleteVariableDeclaration(changes, sourceFile, varDecl, deletedAncestors) { switch (varDecl.parent.parent.kind) { case 219: var forStatement = varDecl.parent.parent, forInitializer = forStatement.initializer; 1 === forInitializer.declarations.length ? (deletedAncestors && deletedAncestors.add(forInitializer), changes.deleteNode(sourceFile, forInitializer)) : (deletedAncestors && deletedAncestors.add(varDecl), changes.deleteNodeInList(sourceFile, varDecl)); break; case 221: var forOfStatement = varDecl.parent.parent; ts.Debug.assert(232 === forOfStatement.initializer.kind); var forOfInitializer = forOfStatement.initializer; deletedAncestors && deletedAncestors.add(forOfInitializer.declarations[0]), changes.replaceNode(sourceFile, forOfInitializer.declarations[0], ts.createObjectLiteral()); break; case 220: case 229: break; default: var variableStatement = varDecl.parent.parent; 1 === variableStatement.declarationList.declarations.length ? (deletedAncestors && deletedAncestors.add(variableStatement), changes.deleteNode(sourceFile, variableStatement)) : (deletedAncestors && deletedAncestors.add(varDecl), changes.deleteNodeInList(sourceFile, varDecl)) } } var fixName = "unusedIdentifier", fixIdPrefix = "unusedIdentifier_prefix", fixIdDelete = "unusedIdentifier_delete", errorCodes = [ts.Diagnostics._0_is_declared_but_its_value_is_never_read.code, ts.Diagnostics._0_is_declared_but_never_used.code, ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code, ts.Diagnostics.All_imports_in_import_declaration_are_unused.code, ts.Diagnostics.All_destructured_elements_are_unused.code, ts.Diagnostics.All_variables_are_unused.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, sourceFile = context.sourceFile, startToken = ts.getTokenAtPosition(sourceFile, context.span.start, !1), importDecl = tryGetFullImport(startToken); if (importDecl) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.deleteNode(sourceFile, importDecl) }); return [codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Remove_import_from_0, ts.showModuleSpecifier(importDecl)], fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations)] } var delDestructure = ts.textChanges.ChangeTracker.with(context, function (t) { return tryDeleteFullDestructure(t, sourceFile, startToken, void 0) }); if (delDestructure.length) return [codefix.createCodeFixAction(fixName, delDestructure, ts.Diagnostics.Remove_destructuring, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations)]; var delVar = ts.textChanges.ChangeTracker.with(context, function (t) { return tryDeleteFullVariableStatement(t, sourceFile, startToken, void 0) }); if (delVar.length) return [codefix.createCodeFixAction(fixName, delDestructure, ts.Diagnostics.Remove_variable_statement, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations)]; var token = getToken(sourceFile, ts.textSpanEnd(context.span)), result = [], deletion = ts.textChanges.ChangeTracker.with(context, function (t) { return tryDeleteDeclaration(t, sourceFile, token, void 0) }); deletion.length && result.push(codefix.createCodeFixAction(fixName, deletion, [ts.Diagnostics.Remove_declaration_for_Colon_0, token.getText(sourceFile)], fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations)); var prefix = ts.textChanges.ChangeTracker.with(context, function (t) { return tryPrefixDeclaration(t, errorCode, sourceFile, token) }); return prefix.length && result.push(codefix.createCodeFixAction(fixName, prefix, [ts.Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, ts.Diagnostics.Prefix_all_unused_declarations_with_where_possible)), result }, fixIds: [fixIdPrefix, fixIdDelete], getAllCodeActions: function (context) { var deleted = new NodeSet; return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var sourceFile = context.sourceFile, startToken = ts.getTokenAtPosition(sourceFile, diag.start, !1), token = ts.findPrecedingToken(ts.textSpanEnd(diag), diag.file); switch (context.fixId) { case fixIdPrefix: ts.isIdentifier(token) && canPrefix(token) && tryPrefixDeclaration(changes, diag.code, sourceFile, token); break; case fixIdDelete: if (deleted.some(function (d) { return ts.rangeContainsPosition(d, diag.start) })) break; var importDecl = tryGetFullImport(startToken); importDecl ? changes.deleteNode(sourceFile, importDecl) : tryDeleteFullDestructure(changes, sourceFile, startToken, deleted) || tryDeleteFullVariableStatement(changes, sourceFile, startToken, deleted) || tryDeleteDeclaration(changes, sourceFile, token, deleted); break; default: ts.Debug.fail(JSON.stringify(context.fixId)) } }) } }); var NodeSet = function () { function NodeSet() { this.map = ts.createMap() } return NodeSet.prototype.add = function (node) { this.map.set(String(ts.getNodeId(node)), node) }, NodeSet.prototype.some = function (pred) { return ts.forEachEntry(this.map, pred) || !1 }, NodeSet }() }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function doChange(changes, sourceFile, start) { var token = ts.getTokenAtPosition(sourceFile, start, !1), statement = ts.findAncestor(token, ts.isStatement); ts.Debug.assert(statement.getStart(sourceFile) === token.getStart(sourceFile)); var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; switch (container.kind) { case 216: if (container.elseStatement) { ts.isBlock(statement.parent) ? changes.deleteNodeRange(sourceFile, ts.first(statement.parent.statements), ts.last(statement.parent.statements)) : changes.replaceNode(sourceFile, statement, ts.createBlock(ts.emptyArray)); break } case 218: case 219: changes.deleteNode(sourceFile, container); break; default: ts.isBlock(statement.parent) ? split(sliceAfter(statement.parent.statements, statement), shouldRemove, function (start, end) { return changes.deleteNodeRange(sourceFile, start, end) }) : changes.deleteNode(sourceFile, statement) } } function shouldRemove(s) { return !(ts.isFunctionDeclaration(s) || isPurelyTypeDeclaration(s) || ts.isVariableStatement(s) && !(3 & ts.getCombinedNodeFlags(s)) && s.declarationList.declarations.some(function (d) { return !d.initializer })) } function isPurelyTypeDeclaration(s) { switch (s.kind) { case 235: case 236: return !0; case 238: return 1 !== ts.getModuleInstanceState(s); case 237: return ts.hasModifier(s, 2048) } } function sliceAfter(arr, value) { var index = arr.indexOf(value); return ts.Debug.assert(index !== -1), arr.slice(index) } function split(arr, pred, cb) { ts.getRangesWhere(arr, pred, function (start, afterEnd) { return cb(arr[start], arr[afterEnd - 1]) }) } var fixId = "fixUnreachableCode", errorCodes = [ts.Diagnostics.Unreachable_code_detected.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return doChange(changes, diag.file, diag.start) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function doChange(changes, sourceFile, start) { var token = ts.getTokenAtPosition(sourceFile, start, !1), labeledStatement = ts.cast(token.parent, ts.isLabeledStatement), pos = token.getStart(sourceFile), statementPos = labeledStatement.statement.getStart(sourceFile), end = ts.positionsAreOnSameLine(pos, statementPos, sourceFile) ? statementPos : ts.skipTrivia(sourceFile.text, ts.findChildOfKind(labeledStatement, 56, sourceFile).end, !0); changes.deleteRange(sourceFile, { pos: pos, end: end }) } var fixId = "fixUnusedLabel", errorCodes = [ts.Diagnostics.Unused_label.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unused_label, fixId, ts.Diagnostics.Remove_all_unused_labels)] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return doChange(changes, diag.file, diag.start) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function doChange(changes, sourceFile, oldTypeNode, newType, checker) { changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(newType, oldTypeNode)) } function getInfo(sourceFile, pos, checker) { var decl = ts.findAncestor(ts.getTokenAtPosition(sourceFile, pos, !1), isTypeContainer), typeNode = decl && decl.type; return typeNode && { typeNode: typeNode, type: checker.getTypeFromTypeNode(typeNode) } } function isTypeContainer(node) { switch (node.kind) { case 207: case 157: case 158: case 233: case 155: case 159: case 176: case 153: case 152: case 148: case 151: case 150: case 156: case 236: case 189: case 231: return !0; default: return !1 } } var fixIdPlain = "fixJSDocTypes_plain", fixIdNullable = "fixJSDocTypes_nullable", errorCodes = [ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { function fix(type, fixId, fixAllDescription) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, typeNode, type, checker) }); return codefix.createCodeFixAction("jdocTypes", changes, [ts.Diagnostics.Change_0_to_1, original, checker.typeToString(type)], fixId, fixAllDescription) } var sourceFile = context.sourceFile, checker = context.program.getTypeChecker(), info = getInfo(sourceFile, context.span.start, checker); if (info) { var typeNode = info.typeNode, type = info.type, original = typeNode.getText(sourceFile), actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; return 280 === typeNode.kind && actions.push(fix(checker.getNullableType(type, 4096), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)), actions } }, fixIds: [fixIdPlain, fixIdNullable], getAllCodeActions: function (context) { var fixId = context.fixId, program = context.program, sourceFile = context.sourceFile, checker = program.getTypeChecker(); return codefix.codeFixAll(context, errorCodes, function (changes, err) { var info = getInfo(err.file, err.start, checker); if (info) { var typeNode = info.typeNode, type = info.type, fixedType = 280 === typeNode.kind && fixId === fixIdNullable ? checker.getNullableType(type, 4096) : type; doChange(changes, sourceFile, typeNode, fixedType, checker) } }) } }) }(codefix = ts.codefix || (ts.codefix = {})); }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getReturnType(expr) { return expr.type ? expr.type : ts.isVariableDeclaration(expr.parent) && expr.parent.type && ts.isFunctionTypeNode(expr.parent.type) ? expr.parent.type.type : void 0 } function getNodes(sourceFile, start) { var token = ts.getTokenAtPosition(sourceFile, start, !1), containingFunction = ts.getContainingFunction(token); if (containingFunction) { var insertBefore; switch (containingFunction.kind) { case 153: insertBefore = containingFunction.name; break; case 233: case 191: insertBefore = ts.findChildOfKind(containingFunction, 89, sourceFile); break; case 192: insertBefore = ts.findChildOfKind(containingFunction, 19, sourceFile) || ts.first(containingFunction.parameters); break; default: return }return { insertBefore: insertBefore, returnType: getReturnType(containingFunction) } } } function doChange(changes, sourceFile, _a) { var insertBefore = _a.insertBefore, returnType = _a.returnType; if (returnType) { var entityName = ts.getEntityNameFromTypeNode(returnType); entityName && 71 === entityName.kind && "Promise" === entityName.text || changes.replaceNode(sourceFile, returnType, ts.createTypeReferenceNode("Promise", ts.createNodeArray([returnType]))) } changes.insertModifierBefore(sourceFile, 120, insertBefore) } var fixId = "fixAwaitInSyncFunction", errorCodes = [ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function.code, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, span = context.span, nodes = getNodes(sourceFile, span.start); if (nodes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, nodes) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts.Diagnostics.Add_all_missing_async_modifiers)] } }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var nodes = getNodes(diag.file, diag.start); nodes && doChange(changes, context.sourceFile, nodes) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function makeChange(changes, sourceFile, position, seenLines) { var lineNumber = ts.getLineAndCharacterOfPosition(sourceFile, position).line; seenLines && !ts.addToSeen(seenLines, lineNumber) || changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore") } var fixName = "disableJsDiagnostics", fixId = "disableJsDiagnostics", errorCodes = ts.mapDefined(Object.keys(ts.Diagnostics), function (key) { var diag = ts.Diagnostics[key]; return diag.category === ts.DiagnosticCategory.Error ? diag.code : void 0 }); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, program = context.program, span = context.span, host = context.host, formatContext = context.formatContext; if (ts.isInJavaScriptFile(sourceFile) && ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { var fixes = [codefix.createCodeFixActionNoFixId(fixName, [codefix.createFileTextChanges(sourceFile.fileName, [ts.createTextChange(sourceFile.checkJsDirective ? ts.createTextSpanFromBounds(sourceFile.checkJsDirective.pos, sourceFile.checkJsDirective.end) : ts.createTextSpan(0, 0), "// @ts-nocheck" + ts.getNewLineOrDefaultFromHost(host, formatContext.options))])], ts.Diagnostics.Disable_checking_for_this_file)]; return ts.textChanges.isValidLocationToAddComment(sourceFile, span.start) && fixes.unshift(codefix.createCodeFixAction(fixName, ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, sourceFile, span.start) }), ts.Diagnostics.Ignore_this_error_message, fixId, ts.Diagnostics.Add_ts_ignore_to_all_error_messages)), fixes } }, fixIds: [fixId], getAllCodeActions: function (context) { var seenLines = ts.createMap(); return codefix.codeFixAll(context, errorCodes, function (changes, diag) { ts.textChanges.isValidLocationToAddComment(diag.file, diag.start) && makeChange(changes, diag.file, diag.start, seenLines) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, checker, preferences, out) { for (var classMembers = classDeclaration.symbol.members, _i = 0, possiblyMissingSymbols_1 = possiblyMissingSymbols; _i < possiblyMissingSymbols_1.length; _i++) { var symbol = possiblyMissingSymbols_1[_i]; classMembers.has(symbol.escapedName) || addNewNodeForMemberSymbol(symbol, classDeclaration, checker, preferences, out) } } function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, checker, preferences, out) { function outputMethod(signature, modifiers, name, body) { var method = signatureToMethodDeclaration(checker, signature, enclosingDeclaration, modifiers, name, optional, body); method && out(method) } var declarations = symbol.getDeclarations(); if (declarations && declarations.length) { var declaration = declarations[0], name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), !1), visibilityModifier = createVisibilityModifier(ts.getModifierFlags(declaration)), modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : void 0, type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)), optional = !!(16777216 & symbol.flags); switch (declaration.kind) { case 155: case 156: case 150: case 151: var typeNode = checker.typeToTypeNode(type, enclosingDeclaration); out(ts.createProperty(void 0, modifiers, name, optional ? ts.createToken(55) : void 0, typeNode, void 0)); break; case 152: case 153: var signatures = checker.getSignaturesOfType(type, 0); if (!ts.some(signatures)) break; if (1 === declarations.length) { ts.Debug.assert(1 === signatures.length); var signature = signatures[0]; outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences)); break } for (var _i = 0, signatures_8 = signatures; _i < signatures_8.length; _i++) { var signature = signatures_8[_i]; outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, !1), ts.getSynthesizedDeepClone(name, !1)) } if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences)) } else ts.Debug.assert(declarations.length === signatures.length), out(createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences)) } } } function signatureToMethodDeclaration(checker, signature, enclosingDeclaration, modifiers, name, optional, body) { var signatureDeclaration = checker.signatureToSignatureDeclaration(signature, 153, enclosingDeclaration, 256); if (signatureDeclaration) return signatureDeclaration.decorators = void 0, signatureDeclaration.modifiers = modifiers, signatureDeclaration.name = name, signatureDeclaration.questionToken = optional ? ts.createToken(55) : void 0, signatureDeclaration.body = body, signatureDeclaration } function createMethodFromCallExpression(_a, methodName, inJs, makeStatic, preferences) { var typeArguments = _a.typeArguments, args = _a.arguments; return ts.createMethod(void 0, makeStatic ? [ts.createToken(115)] : void 0, void 0, methodName, void 0, inJs ? void 0 : ts.map(typeArguments, function (_, i) { return ts.createTypeParameterDeclaration(84 + typeArguments.length - 1 <= 90 ? String.fromCharCode(84 + i) : "T" + i) }), createDummyParameters(args.length, void 0, void 0, inJs), inJs ? void 0 : ts.createKeywordTypeNode(119), createStubbedMethodBody(preferences)) } function createDummyParameters(argCount, names, minArgumentCount, inJs) { for (var parameters = [], i = 0; i < argCount; i++) { var newParameter = ts.createParameter(void 0, void 0, void 0, names && names[i] || "arg" + i, void 0 !== minArgumentCount && i >= minArgumentCount ? ts.createToken(55) : void 0, inJs ? void 0 : ts.createKeywordTypeNode(119), void 0); parameters.push(newParameter) } return parameters } function createMethodImplementingSignatures(signatures, name, optional, modifiers, preferences) { for (var maxArgsSignature = signatures[0], minArgumentCount = signatures[0].minArgumentCount, someSigHasRestParameter = !1, _i = 0, signatures_9 = signatures; _i < signatures_9.length; _i++) { var sig = signatures_9[_i]; minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount), sig.hasRestParameter && (someSigHasRestParameter = !0), sig.parameters.length >= maxArgsSignature.parameters.length && (!sig.hasRestParameter || maxArgsSignature.hasRestParameter) && (maxArgsSignature = sig) } var maxNonRestArgs = maxArgsSignature.parameters.length - (maxArgsSignature.hasRestParameter ? 1 : 0), maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name }), parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, minArgumentCount, !1); if (someSigHasRestParameter) { var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(119)), restParameter = ts.createParameter(void 0, void 0, ts.createToken(24), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", maxNonRestArgs >= minArgumentCount ? ts.createToken(55) : void 0, anyArrayType, void 0); parameters.push(restParameter) } return createStubbedMethod(modifiers, name, optional, void 0, parameters, void 0, preferences) } function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, preferences) { return ts.createMethod(void 0, modifiers, void 0, name, optional ? ts.createToken(55) : void 0, typeParameters, parameters, returnType, createStubbedMethodBody(preferences)) } function createStubbedMethodBody(preferences) { return ts.createBlock([ts.createThrow(ts.createNew(ts.createIdentifier("Error"), void 0, [ts.createLiteral("Method not implemented.", "single" === preferences.quotePreference)]))], !0) } function createVisibilityModifier(flags) { return 4 & flags ? ts.createToken(114) : 16 & flags ? ts.createToken(113) : void 0 } codefix.createMissingMemberNodes = createMissingMemberNodes, codefix.createMethodFromCallExpression = createMethodFromCallExpression }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getDiagnostic(errorCode, token) { switch (errorCode) { case ts.Diagnostics.Parameter_0_implicitly_has_an_1_type.code: return ts.isSetAccessor(ts.getContainingFunction(token)) ? ts.Diagnostics.Infer_type_of_0_from_usage : ts.Diagnostics.Infer_parameter_types_from_usage; case ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code: return ts.Diagnostics.Infer_parameter_types_from_usage; default: return ts.Diagnostics.Infer_type_of_0_from_usage } } function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen) { if (ts.isParameterPropertyModifier(token.kind) || 71 === token.kind || 24 === token.kind) { var parent = token.parent; switch (errorCode) { case ts.Diagnostics.Member_0_implicitly_has_an_1_type.code: case ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code: if (ts.isVariableDeclaration(parent) && markSeen(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) return annotateVariableDeclaration(changes, sourceFile, parent, program, cancellationToken), parent; return; case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: var symbol = program.getTypeChecker().getSymbolAtLocation(token); if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) return annotateVariableDeclaration(changes, sourceFile, symbol.valueDeclaration, program, cancellationToken), symbol.valueDeclaration; return }var containingFunction = ts.getContainingFunction(token); if (void 0 !== containingFunction) switch (errorCode) { case ts.Diagnostics.Parameter_0_implicitly_has_an_1_type.code: if (ts.isSetAccessor(containingFunction)) return annotateSetAccessor(changes, sourceFile, containingFunction, program, cancellationToken), containingFunction; case ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code: if (markSeen(containingFunction)) { var param = ts.cast(parent, ts.isParameter); return annotateParameters(changes, param, containingFunction, sourceFile, program, cancellationToken), param } return; case ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code: case ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code: if (ts.isGetAccessor(containingFunction) && ts.isIdentifier(containingFunction.name)) return annotate(changes, sourceFile, containingFunction, inferTypeForVariableFromUsage(containingFunction.name, program, cancellationToken), program), containingFunction; return; case ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code: if (ts.isSetAccessor(containingFunction)) return annotateSetAccessor(changes, sourceFile, containingFunction, program, cancellationToken), containingFunction; return; default: return ts.Debug.fail(String(errorCode)) } } } function annotateVariableDeclaration(changes, sourceFile, declaration, program, cancellationToken) { ts.isIdentifier(declaration.name) && annotate(changes, sourceFile, declaration, inferTypeForVariableFromUsage(declaration.name, program, cancellationToken), program) } function isApplicableFunctionForInference(declaration) { switch (declaration.kind) { case 233: case 153: case 154: return !0; case 191: return !!declaration.name }return !1 } function annotateParameters(changes, parameterDeclaration, containingFunction, sourceFile, program, cancellationToken) { if (ts.isIdentifier(parameterDeclaration.name) && isApplicableFunctionForInference(containingFunction)) { var types = inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) || containingFunction.parameters.map(function (p) { return ts.isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : void 0 }); types && containingFunction.parameters.length === types.length && ts.zipWith(containingFunction.parameters, types, function (parameter, type) { parameter.type || parameter.initializer || annotate(changes, sourceFile, parameter, type, program) }) } } function annotateSetAccessor(changes, sourceFile, setAccessorDeclaration, program, cancellationToken) { var param = ts.firstOrUndefined(setAccessorDeclaration.parameters); if (param && ts.isIdentifier(setAccessorDeclaration.name) && ts.isIdentifier(param.name)) { var type = inferTypeForVariableFromUsage(setAccessorDeclaration.name, program, cancellationToken) || inferTypeForVariableFromUsage(param.name, program, cancellationToken); annotate(changes, sourceFile, param, type, program) } } function annotate(changes, sourceFile, declaration, type, program) { var typeNode = type && getTypeNodeIfAccessible(type, declaration, program.getTypeChecker()); typeNode && changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode) } function getTypeNodeIfAccessible(type, enclosingScope, checker) { var typeIsAccessible = !0, notAccessible = function () { typeIsAccessible = !1 }, res = checker.typeToTypeNode(type, enclosingScope, void 0, { trackSymbol: function (symbol, declaration, meaning) { typeIsAccessible = typeIsAccessible && 0 === checker.isSymbolAccessible(symbol, declaration, meaning, !1).accessibility }, reportInaccessibleThisError: notAccessible, reportPrivateInBaseOfClassExpression: notAccessible, reportInaccessibleUniqueSymbolError: notAccessible }); return typeIsAccessible ? res : void 0 } function getReferences(token, program, cancellationToken) { return ts.mapDefined(ts.FindAllReferences.getReferenceEntriesForNode(-1, token, program, program.getSourceFiles(), cancellationToken), function (entry) { return "node" === entry.type ? ts.tryCast(entry.node, ts.isIdentifier) : void 0 }) } function inferTypeForVariableFromUsage(token, program, cancellationToken) { return InferFromReference.inferTypeFromReferences(getReferences(token, program, cancellationToken), program.getTypeChecker(), cancellationToken) } function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) { switch (containingFunction.kind) { case 154: case 191: case 233: case 153: var isConstructor = 154 === containingFunction.kind, searchToken = isConstructor ? ts.findChildOfKind(containingFunction, 123, sourceFile) : containingFunction.name; if (searchToken) return InferFromReference.inferTypeForParametersFromReferences(getReferences(searchToken, program, cancellationToken), containingFunction, program.getTypeChecker(), cancellationToken) } } var fixId = "inferFromUsage", errorCodes = [ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code, ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code, ts.Diagnostics.Parameter_0_implicitly_has_an_1_type.code, ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code, ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code, ts.Diagnostics.Member_0_implicitly_has_an_1_type.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, program = context.program, start = context.span.start, errorCode = context.errorCode, cancellationToken = context.cancellationToken; if (!ts.isSourceFileJavaScript(sourceFile)) { var declaration, token = ts.getTokenAtPosition(sourceFile, start, !1), changes = ts.textChanges.ChangeTracker.with(context, function (changes) { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken, ts.returnTrue) }); return 0 === changes.length ? void 0 : [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getNameOfDeclaration(declaration).getText(sourceFile)], fixId, ts.Diagnostics.Infer_all_types_from_usage)] } }, fixIds: [fixId], getAllCodeActions: function (context) { var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken, markSeen = ts.nodeSeenTracker(); return codefix.codeFixAll(context, errorCodes, function (changes, err) { doChange(changes, sourceFile, ts.getTokenAtPosition(err.file, err.start, !1), err.code, program, cancellationToken, markSeen) }) } }); var InferFromReference; !function (InferFromReference) { function inferTypeFromReferences(references, checker, cancellationToken) { for (var usageContext = {}, _i = 0, references_1 = references; _i < references_1.length; _i++) { var reference = references_1[_i]; cancellationToken.throwIfCancellationRequested(), inferTypeFromContext(reference, checker, usageContext) } return getTypeFromUsageContext(usageContext, checker) } function inferTypeForParametersFromReferences(references, declaration, checker, cancellationToken) { if (0 !== references.length && declaration.parameters) { for (var usageContext = {}, _i = 0, references_2 = references; _i < references_2.length; _i++) { var reference = references_2[_i]; cancellationToken.throwIfCancellationRequested(), inferTypeFromContext(reference, checker, usageContext) } var isConstructor = 154 === declaration.kind, callContexts = isConstructor ? usageContext.constructContexts : usageContext.callContexts; return callContexts && declaration.parameters.map(function (parameter, parameterIndex) { for (var types = [], isRest = ts.isRestParameter(parameter), _i = 0, callContexts_1 = callContexts; _i < callContexts_1.length; _i++) { var callContext = callContexts_1[_i]; if (!(callContext.argumentTypes.length <= parameterIndex)) if (isRest) for (var i = parameterIndex; i < callContext.argumentTypes.length; i++)types.push(checker.getBaseTypeOfLiteralType(callContext.argumentTypes[i])); else types.push(checker.getBaseTypeOfLiteralType(callContext.argumentTypes[parameterIndex])) } if (types.length) { var type = checker.getWidenedType(checker.getUnionType(types, 2)); return isRest ? checker.createArrayType(type) : type } }) } } function inferTypeFromContext(node, checker, usageContext) { for (; ts.isRightSideOfQualifiedNameOrPropertyAccess(node);)node = node.parent; switch (node.parent.kind) { case 198: usageContext.isNumber = !0; break; case 197: inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext); break; case 199: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; case 265: case 266: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; case 186: case 187: node.parent.expression === node ? inferTypeFromCallExpressionContext(node.parent, checker, usageContext) : inferTypeFromContextualType(node, checker, usageContext); break; case 184: inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext); break; case 185: inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext); break; case 231: var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { initializer && addCandidateType(usageContext, checker.getTypeAtLocation(initializer)); break } default: return inferTypeFromContextualType(node, checker, usageContext) } } function inferTypeFromContextualType(node, checker, usageContext) { ts.isExpressionNode(node) && addCandidateType(usageContext, checker.getContextualType(node)) } function inferTypeFromPrefixUnaryExpressionContext(node, usageContext) { switch (node.operator) { case 43: case 44: case 38: case 52: usageContext.isNumber = !0; break; case 37: usageContext.isNumberOrString = !0 } } function inferTypeFromBinaryExpressionContext(node, parent, checker, usageContext) { switch (parent.operatorToken.kind) { case 40: case 39: case 41: case 42: case 45: case 46: case 47: case 48: case 49: case 50: case 60: case 62: case 61: case 63: case 64: case 68: case 69: case 70: case 65: case 67: case 66: case 38: case 27: case 30: case 29: case 31: var operandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left); 272 & operandType.flags ? addCandidateType(usageContext, operandType) : usageContext.isNumber = !0; break; case 59: case 37: var otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left); 272 & otherOperandType.flags ? addCandidateType(usageContext, otherOperandType) : 84 & otherOperandType.flags ? usageContext.isNumber = !0 : 34 & otherOperandType.flags ? usageContext.isString = !0 : usageContext.isNumberOrString = !0; break; case 58: case 32: case 34: case 35: case 33: addCandidateType(usageContext, checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left)); break; case 92: node === parent.left && (usageContext.isString = !0); break; case 54: node !== parent.left || 231 !== node.parent.parent.kind && !ts.isAssignmentExpression(node.parent.parent, !0) || addCandidateType(usageContext, checker.getTypeAtLocation(parent.right)); break; case 53: case 26: case 93: } } function inferTypeFromSwitchStatementLabelContext(parent, checker, usageContext) { addCandidateType(usageContext, checker.getTypeAtLocation(parent.parent.parent.expression)) } function inferTypeFromCallExpressionContext(parent, checker, usageContext) { var callContext = { argumentTypes: [], returnType: {} }; if (parent.arguments) for (var _i = 0, _a = parent.arguments; _i < _a.length; _i++) { var argument = _a[_i]; callContext.argumentTypes.push(checker.getTypeAtLocation(argument)) } inferTypeFromContext(parent, checker, callContext.returnType), 186 === parent.kind ? (usageContext.callContexts || (usageContext.callContexts = [])).push(callContext) : (usageContext.constructContexts || (usageContext.constructContexts = [])).push(callContext) } function inferTypeFromPropertyAccessExpressionContext(parent, checker, usageContext) { var name = ts.escapeLeadingUnderscores(parent.name.text); usageContext.properties || (usageContext.properties = ts.createUnderscoreEscapedMap()); var propertyUsageContext = usageContext.properties.get(name) || {}; inferTypeFromContext(parent, checker, propertyUsageContext), usageContext.properties.set(name, propertyUsageContext) } function inferTypeFromPropertyElementExpressionContext(parent, node, checker, usageContext) { if (node === parent.argumentExpression) return void (usageContext.isNumberOrString = !0); var indexType = checker.getTypeAtLocation(parent), indexUsageContext = {}; inferTypeFromContext(parent, checker, indexUsageContext), 84 & indexType.flags ? usageContext.numberIndexContext = indexUsageContext : usageContext.stringIndexContext = indexUsageContext } function getTypeFromUsageContext(usageContext, checker) { if (usageContext.isNumberOrString && !usageContext.isNumber && !usageContext.isString) return checker.getUnionType([checker.getNumberType(), checker.getStringType()]); if (usageContext.isNumber) return checker.getNumberType(); if (usageContext.isString) return checker.getStringType(); if (usageContext.candidateTypes) return checker.getWidenedType(checker.getUnionType(usageContext.candidateTypes.map(function (t) { return checker.getBaseTypeOfLiteralType(t) }), 2)); if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) { var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, !1, checker), types = paramType.getCallSignatures().map(function (c) { return c.getReturnType() }); return checker.createPromiseType(types.length ? checker.getUnionType(types, 2) : checker.getAnyType()) } if (usageContext.properties && hasCallContext(usageContext.properties.get("push"))) return checker.createArrayType(getParameterTypeFromCallContexts(0, usageContext.properties.get("push").callContexts, !1, checker)); if (usageContext.properties || usageContext.callContexts || usageContext.constructContexts || usageContext.numberIndexContext || usageContext.stringIndexContext) { var members_6 = ts.createUnderscoreEscapedMap(), callSignatures = [], constructSignatures = [], stringIndexInfo = void 0, numberIndexInfo = void 0; if (usageContext.properties && usageContext.properties.forEach(function (context, name) { var symbol = checker.createSymbol(4, name); symbol.type = getTypeFromUsageContext(context, checker) || checker.getAnyType(), members_6.set(name, symbol) }), usageContext.callContexts) for (var _i = 0, _a = usageContext.callContexts; _i < _a.length; _i++) { var callContext = _a[_i]; callSignatures.push(getSignatureFromCallContext(callContext, checker)) } if (usageContext.constructContexts) for (var _b = 0, _c = usageContext.constructContexts; _b < _c.length; _b++) { var constructContext = _c[_b]; constructSignatures.push(getSignatureFromCallContext(constructContext, checker)) } return usageContext.numberIndexContext && (numberIndexInfo = checker.createIndexInfo(getTypeFromUsageContext(usageContext.numberIndexContext, checker), !1)), usageContext.stringIndexContext && (stringIndexInfo = checker.createIndexInfo(getTypeFromUsageContext(usageContext.stringIndexContext, checker), !1)), checker.createAnonymousType(void 0, members_6, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) } } function getParameterTypeFromCallContexts(parameterIndex, callContexts, isRestParameter, checker) { var types = []; if (callContexts) for (var _i = 0, callContexts_2 = callContexts; _i < callContexts_2.length; _i++) { var callContext = callContexts_2[_i]; callContext.argumentTypes.length > parameterIndex && (isRestParameter ? types = ts.concatenate(types, ts.map(callContext.argumentTypes.slice(parameterIndex), function (a) { return checker.getBaseTypeOfLiteralType(a) })) : types.push(checker.getBaseTypeOfLiteralType(callContext.argumentTypes[parameterIndex]))) } if (types.length) { var type = checker.getWidenedType(checker.getUnionType(types, 2)); return isRestParameter ? checker.createArrayType(type) : type } } function getSignatureFromCallContext(callContext, checker) { for (var parameters = [], i = 0; i < callContext.argumentTypes.length; i++) { var symbol = checker.createSymbol(1, ts.escapeLeadingUnderscores("arg" + i)); symbol.type = checker.getWidenedType(checker.getBaseTypeOfLiteralType(callContext.argumentTypes[i])), parameters.push(symbol) } var returnType = getTypeFromUsageContext(callContext.returnType, checker) || checker.getVoidType(); return checker.createSignature(void 0, void 0, void 0, parameters, returnType, void 0, callContext.argumentTypes.length, !1, !1) } function addCandidateType(context, type) { !type || 1 & type.flags || 16384 & type.flags || (context.candidateTypes || (context.candidateTypes = [])).push(type) } function hasCallContext(usageContext) { return usageContext && usageContext.callContexts } InferFromReference.inferTypeFromReferences = inferTypeFromReferences, InferFromReference.inferTypeForParametersFromReferences = inferTypeForParametersFromReferences }(InferFromReference || (InferFromReference = {})) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getActionsForInvalidImport(context) { var sourceFile = context.sourceFile, node = ts.getTokenAtPosition(sourceFile, context.span.start, !1).parent; return ts.isImportDeclaration(node) ? getCodeFixesForImportDeclaration(context, node) : [] } function getCodeFixesForImportDeclaration(context, node) { var sourceFile = ts.getSourceFileOfNode(node), namespace = ts.getNamespaceDeclarationNode(node), opts = context.program.getCompilerOptions(), variations = []; return variations.push(createAction(context, sourceFile, node, ts.makeImport(namespace.name, void 0, node.moduleSpecifier, ts.getQuotePreference(sourceFile, context.preferences)))), ts.getEmitModuleKind(opts) === ts.ModuleKind.CommonJS && variations.push(createAction(context, sourceFile, node, ts.createImportEqualsDeclaration(void 0, void 0, namespace.name, ts.createExternalModuleReference(node.moduleSpecifier)))), variations } function createAction(context, sourceFile, node, replacement) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, node, replacement) }); return codefix.createCodeFixActionNoFixId("invalidImportSyntax", changes, [ts.Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]) } function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile, targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 186 : 187, node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start, !1), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === context.span.start + context.span.length }); if (!node) return []; var expr = node.expression, type = context.program.getTypeChecker().getTypeAtLocation(expr); if (!type.symbol || !type.symbol.originatingImport) return []; var fixes = [], relatedImport = type.symbol.originatingImport; ts.isImportCall(relatedImport) || ts.addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport)); var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, expr, ts.createPropertyAccess(expr, "default"), {}) }); return fixes.push(codefix.createCodeFixActionNoFixId(fixName, changes, ts.Diagnostics.Use_synthetic_default_member)), fixes } var fixName = "invalidImportSyntax"; codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime.code], getCodeActions: getActionsForInvalidImport }), codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature.code], getCodeActions: getActionsForUsageOfInvalidImport }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getPropertyDeclaration(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos, !1); return ts.isIdentifier(token) ? ts.cast(token.parent, ts.isPropertyDeclaration) : void 0 } function getActionForAddMissingDefiniteAssignmentAssertion(context, propertyDeclaration) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addDefiniteAssignmentAssertion(t, context.sourceFile, propertyDeclaration) }); return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_definite_assignment_assertion_to_property_0, propertyDeclaration.getText()], fixIdAddDefiniteAssignmentAssertions, ts.Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties) } function addDefiniteAssignmentAssertion(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) { var property = ts.updateProperty(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, ts.createToken(51), propertyDeclaration.type, propertyDeclaration.initializer); changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property) } function getActionForAddMissingUndefinedType(context, propertyDeclaration) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addUndefinedType(t, context.sourceFile, propertyDeclaration) }); return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties) } function addUndefinedType(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) { var undefinedTypeNode = ts.createKeywordTypeNode(140), types = ts.isUnionTypeNode(propertyDeclaration.type) ? propertyDeclaration.type.types.concat(undefinedTypeNode) : [propertyDeclaration.type, undefinedTypeNode]; changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration.type, ts.createUnionTypeNode(types)) } function getActionForAddMissingInitializer(context, propertyDeclaration) { var checker = context.program.getTypeChecker(), initializer = getInitializer(checker, propertyDeclaration); if (initializer) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addInitializer(t, context.sourceFile, propertyDeclaration, initializer) }); return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_initializer_to_property_0, propertyDeclaration.name.getText()], fixIdAddInitializer, ts.Diagnostics.Add_initializers_to_all_uninitialized_properties) } } function addInitializer(changeTracker, propertyDeclarationSourceFile, propertyDeclaration, initializer) { var property = ts.updateProperty(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, propertyDeclaration.questionToken, propertyDeclaration.type, initializer); changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property) } function getInitializer(checker, propertyDeclaration) { return getDefaultValueFromType(checker, checker.getTypeFromTypeNode(propertyDeclaration.type)) } function getDefaultValueFromType(checker, type) { if (2 & type.flags) return ts.createLiteral(""); if (4 & type.flags) return ts.createNumericLiteral("0"); if (8 & type.flags) return ts.createFalse(); if (type.isLiteral()) return ts.createLiteral(type.value); if (type.isUnion()) return ts.firstDefined(type.types, function (t) { return getDefaultValueFromType(checker, t) }); if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); if (!classDeclaration || ts.hasModifier(classDeclaration, 128)) return; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) return; return ts.createNew(ts.createIdentifier(type.symbol.name), void 0, void 0) } } var fixName = "strictClassInitialization", fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions", fixIdAddUndefinedType = "addMissingPropertyUndefinedType", fixIdAddInitializer = "addMissingPropertyInitializer", errorCodes = [ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var propertyDeclaration = getPropertyDeclaration(context.sourceFile, context.span.start); if (propertyDeclaration) { var result = [getActionForAddMissingUndefinedType(context, propertyDeclaration), getActionForAddMissingDefiniteAssignmentAssertion(context, propertyDeclaration)]; return ts.append(result, getActionForAddMissingInitializer(context, propertyDeclaration)), result } }, fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var propertyDeclaration = getPropertyDeclaration(diag.file, diag.start); if (propertyDeclaration) switch (context.fixId) { case fixIdAddDefiniteAssignmentAssertions: addDefiniteAssignmentAssertion(changes, diag.file, propertyDeclaration); break; case fixIdAddUndefinedType: addUndefinedType(changes, diag.file, propertyDeclaration); break; case fixIdAddInitializer: var checker = context.program.getTypeChecker(), initializer = getInitializer(checker, propertyDeclaration); if (!initializer) return; addInitializer(changes, diag.file, propertyDeclaration, initializer); break; default: ts.Debug.fail(JSON.stringify(context.fixId)) } }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function doChange(changes, sourceFile, pos, program) { var _a = getInfo(sourceFile, pos), statement = _a.statement, name = _a.name, required = _a.required; changes.replaceNode(sourceFile, statement, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()) ? ts.createImportDeclaration(void 0, void 0, ts.createImportClause(name, void 0), required) : ts.createImportEqualsDeclaration(void 0, void 0, name, ts.createExternalModuleReference(required))) } function getInfo(sourceFile, pos) { var parent = ts.getTokenAtPosition(sourceFile, pos, !1).parent; if (!ts.isRequireCall(parent, !0)) throw ts.Debug.failBadSyntaxKind(parent); var decl = ts.cast(parent.parent, ts.isVariableDeclaration); return { statement: ts.cast(decl.parent.parent, ts.isVariableStatement), name: ts.cast(decl.name, ts.isIdentifier), required: parent.arguments[0] } } var fixId = "requireInTs", errorCodes = [ts.Diagnostics.require_call_may_be_converted_to_an_import.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.program) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_require_to_import, fixId, ts.Diagnostics.Convert_all_require_to_import)] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return doChange(changes, diag.file, diag.start, context.program) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getInfo(sourceFile, pos) { var name = ts.getTokenAtPosition(sourceFile, pos, !1); if (ts.isIdentifier(name)) { var parent = name.parent; if (ts.isImportEqualsDeclaration(parent) && ts.isExternalModuleReference(parent.moduleReference)) return { importNode: parent, name: name, moduleSpecifier: parent.moduleReference.expression }; if (ts.isNamespaceImport(parent)) { var importNode = parent.parent.parent; return { importNode: importNode, name: name, moduleSpecifier: importNode.moduleSpecifier } } } } function doChange(changes, sourceFile, info, preferences) { changes.replaceNode(sourceFile, info.importNode, ts.makeImport(info.name, void 0, info.moduleSpecifier, ts.getQuotePreference(sourceFile, preferences))) } var fixId = "useDefaultImport", errorCodes = [ts.Diagnostics.Import_may_be_converted_to_a_default_import.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, start = context.span.start, info = getInfo(sourceFile, start); if (info) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info, context.preferences) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_default_import, fixId, ts.Diagnostics.Convert_all_to_default_imports)] } }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { var info = getInfo(diag.file, diag.start); info && doChange(changes, diag.file, info, context.preferences) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var codefix; !function (codefix) { function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos, !1); return ts.Debug.assert(91 === token.kind), ts.Debug.assert(178 === token.parent.kind), token.parent } function doChange(changes, sourceFile, importType) { var newTypeNode = ts.updateImportTypeNode(importType, importType.argument, importType.qualifier, importType.typeArguments, !0); changes.replaceNode(sourceFile, importType, newTypeNode) } var fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof", fixId = fixIdAddMissingTypeof, errorCodes = [ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here.code]; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { var sourceFile = context.sourceFile, span = context.span, importType = getImportTypeNode(sourceFile, span.start), changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, importType) }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_typeof, fixId, ts.Diagnostics.Add_missing_typeof)] }, fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start)) }) } }) }(codefix = ts.codefix || (ts.codefix = {})) }(ts || (ts = {})); var ts; !function (ts) { var refactor; !function (refactor) { var extractSymbol; !function (extractSymbol) { function getAvailableActions(context) { var rangeToExtract = getRangeToExtract(context.file, ts.getRefactorContextSpan(context)), targetRange = rangeToExtract.targetRange; if (void 0 !== targetRange) { var extractions = getPossibleExtractions(targetRange, context); if (void 0 !== extractions) { for (var functionActions = [], usedFunctionNames = ts.createMap(), constantActions = [], usedConstantNames = ts.createMap(), i = 0, _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction; if (0 === functionExtraction.errors.length) { var description = functionExtraction.description; usedFunctionNames.has(description) || (usedFunctionNames.set(description, !0), functionActions.push({ description: description, name: "function_scope_" + i })) } if (0 === constantExtraction.errors.length) { var description = constantExtraction.description; usedConstantNames.has(description) || (usedConstantNames.set(description, !0), constantActions.push({ description: description, name: "constant_scope_" + i })) } i++ } var infos = []; return functionActions.length && infos.push({ name: refactorName, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_function), actions: functionActions }), constantActions.length && infos.push({ name: refactorName, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_constant), actions: constantActions }), infos.length ? infos : void 0 } } } function getEditsForAction(context, actionName) { var rangeToExtract = getRangeToExtract(context.file, ts.getRefactorContextSpan(context)), targetRange = rangeToExtract.targetRange, parsedFunctionIndexMatch = /^function_scope_(\d+)$/.exec(actionName); if (parsedFunctionIndexMatch) { var index = +parsedFunctionIndexMatch[1]; return ts.Debug.assert(isFinite(index), "Expected to parse a finite number from the function scope index"), getFunctionExtractionAtIndex(targetRange, context, index) } var parsedConstantIndexMatch = /^constant_scope_(\d+)$/.exec(actionName); if (parsedConstantIndexMatch) { var index = +parsedConstantIndexMatch[1]; return ts.Debug.assert(isFinite(index), "Expected to parse a finite number from the constant scope index"), getConstantExtractionAtIndex(targetRange, context, index) } ts.Debug.fail("Unrecognized action name") } function getRangeToExtract(sourceFile, span) { function refineNode(node) { if (ts.isReturnStatement(node)) { if (node.expression) return node.expression } else if (ts.isVariableStatement(node)) { for (var numInitializers = 0, lastInitializer = void 0, _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; declaration.initializer && (numInitializers++ , lastInitializer = declaration.initializer) } if (1 === numInitializers) return lastInitializer } else if (ts.isVariableDeclaration(node) && node.initializer) return node.initializer; return node } function checkRootNode(node) { if (ts.isIdentifier(ts.isExpressionStatement(node) ? node.expression : node)) return [ts.createDiagnosticForNode(node, Messages.cannotExtractIdentifier)] } function checkForStaticContext(nodeToCheck, containingClass) { for (var current = nodeToCheck; current !== containingClass;) { if (151 === current.kind) { ts.hasModifier(current, 32) && (rangeFacts |= RangeFacts.InStaticRegion); break } if (148 === current.kind) { var ctorOrMethod = ts.getContainingFunction(current); 154 === ctorOrMethod.kind && (rangeFacts |= RangeFacts.InStaticRegion); break } 153 === current.kind && ts.hasModifier(current, 32) && (rangeFacts |= RangeFacts.InStaticRegion), current = current.parent } } function checkNode(nodeToCheck) { function visit(node) { if (errors) return !0; if (ts.isDeclaration(node)) { var declaringNode = 231 === node.kind ? node.parent.parent : node; if (ts.hasModifier(declaringNode, 1)) return (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)), !0; declarations.push(node.symbol) } switch (node.kind) { case 243: return (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)), !0; case 97: if (186 === node.parent.kind) { var containingClass_1 = ts.getContainingClass(node); if (containingClass_1.pos < span.start || containingClass_1.end >= span.start + span.length) return (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractSuper)), !0 } else rangeFacts |= RangeFacts.UsesThis }if (!node || ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) { switch (node.kind) { case 233: case 234: ts.isSourceFile(node.parent) && void 0 === node.parent.externalModuleIndicator && (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)) }return !1 } var savedPermittedJumps = permittedJumps; switch (node.kind) { case 216: permittedJumps = 0; break; case 229: permittedJumps = 0; break; case 212: node.parent && 229 === node.parent.kind && node.parent.finallyBlock === node && (permittedJumps = 4); break; case 265: permittedJumps |= 1; break; default: ts.isIterationStatement(node, !1) && (permittedJumps |= 3) }switch (node.kind) { case 173: case 99: rangeFacts |= RangeFacts.UsesThis; break; case 227: var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText), ts.forEachChild(node, visit), seenLabels.pop(); break; case 223: case 222: var label = node.label; label ? ts.contains(seenLabels, label.escapedText) || (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)) : permittedJumps & (223 === node.kind ? 1 : 2) || (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); break; case 196: rangeFacts |= RangeFacts.IsAsyncFunction; break; case 202: rangeFacts |= RangeFacts.IsGenerator; break; case 224: 4 & permittedJumps ? rangeFacts |= RangeFacts.HasReturn : (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalReturnStatement)); break; default: ts.forEachChild(node, visit) }permittedJumps = savedPermittedJumps } var PermittedJumps; if (function (PermittedJumps) { PermittedJumps[PermittedJumps.None = 0] = "None", PermittedJumps[PermittedJumps.Break = 1] = "Break", PermittedJumps[PermittedJumps.Continue = 2] = "Continue", PermittedJumps[PermittedJumps.Return = 4] = "Return" }(PermittedJumps || (PermittedJumps = {})), ts.Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"), ts.Debug.assert(!ts.positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"), !(ts.isStatement(nodeToCheck) || ts.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) return [ts.createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)]; if (4194304 & nodeToCheck.flags) return [ts.createDiagnosticForNode(nodeToCheck, Messages.cannotExtractAmbientBlock)]; var containingClass = ts.getContainingClass(nodeToCheck); containingClass && checkForStaticContext(nodeToCheck, containingClass); var errors, seenLabels, permittedJumps = 4; return visit(nodeToCheck), errors } var length = span.length; if (0 === length) return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractEmpty)] }; var start = getParentNodeInSpan(ts.getTokenAtPosition(sourceFile, span.start, !1), sourceFile, span), end = getParentNodeInSpan(ts.findTokenOnLeftOfPosition(sourceFile, ts.textSpanEnd(span)), sourceFile, span), declarations = [], rangeFacts = RangeFacts.None; if (!start || !end) return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; if (start.parent !== end.parent) return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; if (start !== end) { if (!isBlockLike(start.parent)) return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; for (var statements = [], _i = 0, _a = start.parent.statements; _i < _a.length; _i++) { var statement = _a[_i]; if (statement === start || statements.length) { var errors_1 = checkNode(statement); if (errors_1) return { errors: errors_1 }; statements.push(statement) } if (statement === end) break } return statements.length ? { targetRange: { range: statements, facts: rangeFacts, declarations: declarations } } : { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] } } if (ts.isReturnStatement(start) && !start.expression) return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; var node = refineNode(start), errors = checkRootNode(node) || checkNode(node); return errors ? { errors: errors } : { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations } } } function getStatementOrExpressionRange(node) { return ts.isStatement(node) ? [node] : ts.isExpressionNode(node) ? ts.isExpressionStatement(node.parent) ? [node.parent] : node : void 0 } function isScope(node) { return ts.isFunctionLikeDeclaration(node) || ts.isSourceFile(node) || ts.isModuleBlock(node) || ts.isClassLike(node) } function collectEnclosingScopes(range) { var current = isReadonlyArray(range.range) ? ts.first(range.range) : range.range; if (range.facts & RangeFacts.UsesThis) { var containingClass = ts.getContainingClass(current); if (containingClass) { var containingFunction = ts.findAncestor(current, ts.isFunctionLikeDeclaration); return containingFunction ? [containingFunction, containingClass] : [containingClass] } } for (var scopes = []; ;)if (current = current.parent, 148 === current.kind && (current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent) }).parent), isScope(current) && (scopes.push(current), 273 === current.kind)) return scopes } function getFunctionExtractionAtIndex(targetRange, context, requestedChangesIndex) { var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, target = _b.target, usagesPerScope = _b.usagesPerScope, functionErrorsPerScope = _b.functionErrorsPerScope, exposedVariableDeclarations = _b.exposedVariableDeclarations; return ts.Debug.assert(!functionErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"), context.cancellationToken.throwIfCancellationRequested(), extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context) } function getConstantExtractionAtIndex(targetRange, context, requestedChangesIndex) { var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, target = _b.target, usagesPerScope = _b.usagesPerScope, constantErrorsPerScope = _b.constantErrorsPerScope, exposedVariableDeclarations = _b.exposedVariableDeclarations; ts.Debug.assert(!constantErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"), ts.Debug.assert(0 === exposedVariableDeclarations.length, "Extract constant accepted a range containing a variable declaration?"), context.cancellationToken.throwIfCancellationRequested(); var expression = ts.isExpression(target) ? target : target.statements[0].expression; return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context) } function getPossibleExtractions(targetRange, context) { var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, functionErrorsPerScope = _b.functionErrorsPerScope, constantErrorsPerScope = _b.constantErrorsPerScope, extractions = scopes.map(function (scope, i) { var functionDescription, constantDescription, functionDescriptionPart = getDescriptionForFunctionInScope(scope), constantDescriptionPart = getDescriptionForConstantInScope(scope), scopeDescription = ts.isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : ts.isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope); return 1 === scopeDescription ? (functionDescription = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "global"]), constantDescription = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "global"])) : 0 === scopeDescription ? (functionDescription = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "module"]), constantDescription = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "module"])) : (functionDescription = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_0_in_1), [functionDescriptionPart, scopeDescription]), constantDescription = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_0_in_1), [constantDescriptionPart, scopeDescription])), 0 !== i || ts.isClassLike(scope) || (constantDescription = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_0_in_enclosing_scope), [constantDescriptionPart])), { functionExtraction: { description: functionDescription, errors: functionErrorsPerScope[i] }, constantExtraction: { description: constantDescription, errors: constantErrorsPerScope[i] } } }); return extractions } function getPossibleExtractionsWorker(targetRange, context) { var sourceFile = context.file, scopes = collectEnclosingScopes(targetRange), enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile), readsAndWrites = collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, context.program.getTypeChecker(), context.cancellationToken); return { scopes: scopes, readsAndWrites: readsAndWrites } } function getDescriptionForFunctionInScope(scope) { return ts.isFunctionLikeDeclaration(scope) ? "inner function" : ts.isClassLike(scope) ? "method" : "function" } function getDescriptionForConstantInScope(scope) { return ts.isClassLike(scope) ? "readonly field" : "constant" } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { case 154: return "constructor"; case 191: case 233: return scope.name ? "function '" + scope.name.text + "'" : "anonymous function"; case 192: return "arrow function"; case 153: return "method '" + scope.name.getText(); case 155: return "'get " + scope.name.getText() + "'"; case 156: return "'set " + scope.name.getText() + "'"; default: ts.Debug.assertNever(scope) } } function getDescriptionForClassLikeDeclaration(scope) { return 234 === scope.kind ? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration" : scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression" } function getDescriptionForModuleLikeDeclaration(scope) { return 239 === scope.kind ? "namespace '" + scope.parent.name.getText() + "'" : scope.externalModuleIndicator ? 0 : 1 } function extractFunctionInScope(node, scope, _a, exposedVariableDeclarations, range, context) { function getTypeDeepCloneUnionUndefined(typeNode) { if (void 0 !== typeNode) { for (var clone = ts.getSynthesizedDeepClone(typeNode), withoutParens = clone; ts.isParenthesizedTypeNode(withoutParens);)withoutParens = withoutParens.type; return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return 140 === t.kind }) ? clone : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(140)]) } } var returnType, writes, usagesInScope = _a.usages, typeParameterUsages = _a.typeParameterUsages, substitutions = _a.substitutions, checker = context.program.getTypeChecker(), file = scope.getSourceFile(), functionNameText = ts.getUniqueName(ts.isClassLike(scope) ? "newMethod" : "newFunction", file), isJS = ts.isInJavaScriptFile(scope), functionName = ts.createIdentifier(functionNameText), parameters = [], callArguments = []; usagesInScope.forEach(function (usage, name) { var typeNode; if (!isJS) { var type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node); type = checker.getBaseTypeOfLiteralType(type), typeNode = checker.typeToTypeNode(type, scope, 1) } var paramDecl = ts.createParameter(void 0, void 0, void 0, name, void 0, typeNode); parameters.push(paramDecl), 2 === usage.usage && (writes || (writes = [])).push(usage), callArguments.push(ts.createIdentifier(name)) }); var typeParametersAndDeclarations = ts.arrayFrom(typeParameterUsages.values()).map(function (type) { return { type: type, declaration: getFirstDeclaration(type) } }), sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder), typeParameters = 0 === sortedTypeParametersAndDeclarations.length ? void 0 : sortedTypeParametersAndDeclarations.map(function (t) { return t.declaration }), callTypeArguments = void 0 !== typeParameters ? typeParameters.map(function (decl) { return ts.createTypeReferenceNode(decl.name, void 0) }) : void 0; if (ts.isExpression(node) && !isJS) { var contextualType = checker.getContextualType(node); returnType = checker.typeToTypeNode(contextualType, scope, 1) } var _b = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty; ts.suppressLeadingAndTrailingTrivia(body); var newFunction; if (ts.isClassLike(scope)) { var modifiers = isJS ? [] : [ts.createToken(112)]; range.facts & RangeFacts.InStaticRegion && modifiers.push(ts.createToken(115)), range.facts & RangeFacts.IsAsyncFunction && modifiers.push(ts.createToken(120)), newFunction = ts.createMethod(void 0, modifiers.length ? modifiers : void 0, range.facts & RangeFacts.IsGenerator ? ts.createToken(39) : void 0, functionName, void 0, typeParameters, parameters, returnType, body) } else newFunction = ts.createFunctionDeclaration(void 0, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(120)] : void 0, range.facts & RangeFacts.IsGenerator ? ts.createToken(39) : void 0, functionName, typeParameters, parameters, returnType, body); var changeTracker = ts.textChanges.ChangeTracker.fromContext(context), minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end, nodeToInsertBefore = getNodeToInsertFunctionBefore(minInsertionPos, scope); nodeToInsertBefore ? changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newFunction, !0) : changeTracker.insertNodeAtEndOfScope(context.file, scope, newFunction); var newNodes = [], called = getCalledExpression(scope, range, functionNameText), call = ts.createCall(called, callTypeArguments, callArguments); if (range.facts & RangeFacts.IsGenerator && (call = ts.createYield(ts.createToken(39), call)), range.facts & RangeFacts.IsAsyncFunction && (call = ts.createAwait(call)), exposedVariableDeclarations.length && !writes) if (ts.Debug.assert(!returnValueProperty), ts.Debug.assert(!(range.facts & RangeFacts.HasReturn)), 1 === exposedVariableDeclarations.length) { var variableDeclaration = exposedVariableDeclarations[0]; newNodes.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(variableDeclaration.name), ts.getSynthesizedDeepClone(variableDeclaration.type), call)], variableDeclaration.parent.flags))) } else { for (var bindingElements = [], typeElements = [], commonNodeFlags = exposedVariableDeclarations[0].parent.flags, sawExplicitType = !1, _i = 0, exposedVariableDeclarations_1 = exposedVariableDeclarations; _i < exposedVariableDeclarations_1.length; _i++) { var variableDeclaration = exposedVariableDeclarations_1[_i]; bindingElements.push(ts.createBindingElement(void 0, void 0, ts.getSynthesizedDeepClone(variableDeclaration.name))); var variableType = checker.typeToTypeNode(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)), scope, 1); typeElements.push(ts.createPropertySignature(void 0, variableDeclaration.symbol.name, void 0, variableType, void 0)), sawExplicitType = sawExplicitType || void 0 !== variableDeclaration.type, commonNodeFlags &= variableDeclaration.parent.flags } var typeLiteral = sawExplicitType ? ts.createTypeLiteralNode(typeElements) : void 0; typeLiteral && ts.setEmitFlags(typeLiteral, 1), newNodes.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.createObjectBindingPattern(bindingElements), typeLiteral, call)], commonNodeFlags))) } else if (exposedVariableDeclarations.length || writes) { if (exposedVariableDeclarations.length) for (var _c = 0, exposedVariableDeclarations_2 = exposedVariableDeclarations; _c < exposedVariableDeclarations_2.length; _c++) { var variableDeclaration = exposedVariableDeclarations_2[_c], flags = variableDeclaration.parent.flags; 2 & flags && (flags = flags & -3 | 1), newNodes.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(variableDeclaration.symbol.name, getTypeDeepCloneUnionUndefined(variableDeclaration.type))], flags))) } returnValueProperty && newNodes.push(ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(returnValueProperty, getTypeDeepCloneUnionUndefined(returnType))], 1))); var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); returnValueProperty && assignments.unshift(ts.createShorthandPropertyAssignment(returnValueProperty)), 1 === assignments.length ? (ts.Debug.assert(!returnValueProperty), newNodes.push(ts.createStatement(ts.createAssignment(assignments[0].name, call))), range.facts & RangeFacts.HasReturn && newNodes.push(ts.createReturn())) : (newNodes.push(ts.createStatement(ts.createAssignment(ts.createObjectLiteral(assignments), call))), returnValueProperty && newNodes.push(ts.createReturn(ts.createIdentifier(returnValueProperty)))) } else range.facts & RangeFacts.HasReturn ? newNodes.push(ts.createReturn(call)) : isReadonlyArray(range.range) ? newNodes.push(ts.createStatement(call)) : newNodes.push(call); isReadonlyArray(range.range) ? changeTracker.replaceNodeRangeWithNodes(context.file, ts.first(range.range), ts.last(range.range), newNodes) : changeTracker.replaceNodeWithNodes(context.file, range.range, newNodes); var edits = changeTracker.getChanges(), renameRange = isReadonlyArray(range.range) ? ts.first(range.range) : range.range, renameFilename = renameRange.getSourceFile().fileName, renameLocation = ts.getRenameLocation(edits, renameFilename, functionNameText, !1); return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits } } function extractConstantInScope(node, scope, _a, rangeFacts, context) { var substitutions = _a.substitutions, checker = context.program.getTypeChecker(), file = scope.getSourceFile(), localNameText = ts.getUniqueName(ts.isClassLike(scope) ? "newProperty" : "newLocal", file), isJS = ts.isInJavaScriptFile(scope), variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1), initializer = transformConstantInitializer(node, substitutions); ts.suppressLeadingAndTrailingTrivia(initializer); var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); if (ts.isClassLike(scope)) { ts.Debug.assert(!isJS); var modifiers = []; modifiers.push(ts.createToken(112)), rangeFacts & RangeFacts.InStaticRegion && modifiers.push(ts.createToken(115)), modifiers.push(ts.createToken(132)); var newVariable = ts.createProperty(void 0, modifiers, localNameText, void 0, variableType, initializer), localReference = ts.createPropertyAccess(rangeFacts & RangeFacts.InStaticRegion ? ts.createIdentifier(scope.name.getText()) : ts.createThis(), ts.createIdentifier(localNameText)), maxInsertionPos = node.pos, nodeToInsertBefore = getNodeToInsertPropertyBefore(maxInsertionPos, scope); changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariable, !0), changeTracker.replaceNode(context.file, node, localReference) } else { var newVariableDeclaration = ts.createVariableDeclaration(localNameText, variableType, initializer), oldVariableDeclaration = getContainingVariableDeclarationIfInList(node, scope); if (oldVariableDeclaration) { changeTracker.insertNodeBefore(context.file, oldVariableDeclaration, newVariableDeclaration); var localReference = ts.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference) } else if (215 === node.parent.kind && scope === ts.findAncestor(node, isScope)) { var newVariableStatement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([newVariableDeclaration], 2)); changeTracker.replaceNode(context.file, node.parent, newVariableStatement) } else { var newVariableStatement = ts.createVariableStatement(void 0, ts.createVariableDeclarationList([newVariableDeclaration], 2)), nodeToInsertBefore = getNodeToInsertConstantBefore(node, scope); if (0 === nodeToInsertBefore.pos ? changeTracker.insertNodeAtTopOfFile(context.file, newVariableStatement, !1) : changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, !1), 215 === node.parent.kind) changeTracker.deleteNode(context.file, node.parent, ts.textChanges.useNonAdjustedPositions); else { var localReference = ts.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference) } } } var edits = changeTracker.getChanges(), renameFilename = node.getSourceFile().fileName, renameLocation = ts.getRenameLocation(edits, renameFilename, localNameText, !0); return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits } } function getContainingVariableDeclarationIfInList(node, scope) { for (var prevNode; void 0 !== node && node !== scope;) { if (ts.isVariableDeclaration(node) && node.initializer === prevNode && ts.isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1) return node; prevNode = node, node = node.parent } } function getFirstDeclaration(type) { var firstDeclaration, symbol = type.symbol; if (symbol && symbol.declarations) for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; (void 0 === firstDeclaration || declaration.pos < firstDeclaration.pos) && (firstDeclaration = declaration) } return firstDeclaration } function compareTypesByDeclarationOrder(_a, _b) { var type1 = _a.type, declaration1 = _a.declaration, type2 = _b.type, declaration2 = _b.declaration; return ts.compareProperties(declaration1, declaration2, "pos", ts.compareValues) || ts.compareStringsCaseSensitive(type1.symbol ? type1.symbol.getName() : "", type2.symbol ? type2.symbol.getName() : "") || ts.compareValues(type1.id, type2.id) } function getCalledExpression(scope, range, functionNameText) { var functionReference = ts.createIdentifier(functionNameText); if (ts.isClassLike(scope)) { var lhs = range.facts & RangeFacts.InStaticRegion ? ts.createIdentifier(scope.name.text) : ts.createThis(); return ts.createPropertyAccess(lhs, functionReference) } return functionReference } function transformFunctionBody(body, exposedVariableDeclarations, writes, substitutions, hasReturn) { function visitor(node) { if (!ignoreReturns && 224 === node.kind && hasWritesOrVariableDeclarations) { var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); return node.expression && (returnValueProperty || (returnValueProperty = "__return"), assignments.unshift(ts.createPropertyAssignment(returnValueProperty, ts.visitNode(node.expression, visitor)))), 1 === assignments.length ? ts.createReturn(assignments[0].name) : ts.createReturn(ts.createObjectLiteral(assignments)) } var oldIgnoreReturns = ignoreReturns; ignoreReturns = ignoreReturns || ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node); var substitution = substitutions.get(ts.getNodeId(node).toString()), result = substitution ? ts.getSynthesizedDeepClone(substitution) : ts.visitEachChild(node, visitor, ts.nullTransformationContext); return ignoreReturns = oldIgnoreReturns, result } var hasWritesOrVariableDeclarations = void 0 !== writes || exposedVariableDeclarations.length > 0; if (ts.isBlock(body) && !hasWritesOrVariableDeclarations && 0 === substitutions.size) return { body: ts.createBlock(body.statements, !0), returnValueProperty: void 0 }; var returnValueProperty, ignoreReturns = !1, statements = ts.createNodeArray(ts.isBlock(body) ? body.statements.slice(0) : [ts.isStatement(body) ? body : ts.createReturn(body)]); if (hasWritesOrVariableDeclarations || substitutions.size) { var rewrittenStatements = ts.visitNodes(statements, visitor).slice(); if (hasWritesOrVariableDeclarations && !hasReturn && ts.isStatement(body)) { var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); 1 === assignments.length ? rewrittenStatements.push(ts.createReturn(assignments[0].name)) : rewrittenStatements.push(ts.createReturn(ts.createObjectLiteral(assignments))) } return { body: ts.createBlock(rewrittenStatements, !0), returnValueProperty: returnValueProperty } } return { body: ts.createBlock(statements, !0), returnValueProperty: void 0 } } function transformConstantInitializer(initializer, substitutions) { function visitor(node) { var substitution = substitutions.get(ts.getNodeId(node).toString()); return substitution ? ts.getSynthesizedDeepClone(substitution) : ts.visitEachChild(node, visitor, ts.nullTransformationContext) } return substitutions.size ? visitor(initializer) : initializer } function getStatementsOrClassElements(scope) { if (ts.isFunctionLikeDeclaration(scope)) { var body = scope.body; if (ts.isBlock(body)) return body.statements } else { if (ts.isModuleBlock(scope) || ts.isSourceFile(scope)) return scope.statements; if (ts.isClassLike(scope)) return scope.members; ts.assertTypeIsNever(scope) } return ts.emptyArray } function getNodeToInsertFunctionBefore(minPos, scope) { return ts.find(getStatementsOrClassElements(scope), function (child) { return child.pos >= minPos && ts.isFunctionLikeDeclaration(child) && !ts.isConstructorDeclaration(child) }) } function getNodeToInsertPropertyBefore(maxPos, scope) { var members = scope.members; ts.Debug.assert(members.length > 0); for (var prevMember, allProperties = !0, _i = 0, members_7 = members; _i < members_7.length; _i++) { var member = members_7[_i]; if (member.pos > maxPos) return prevMember || members[0]; if (allProperties && !ts.isPropertyDeclaration(member)) { if (void 0 !== prevMember) return member; allProperties = !1 } prevMember = member } return ts.Debug.assert(void 0 !== prevMember), prevMember } function getNodeToInsertConstantBefore(node, scope) { ts.Debug.assert(!ts.isClassLike(scope)); for (var prevScope, curr = node; curr !== scope; curr = curr.parent)isScope(curr) && (prevScope = curr); for (var curr = (prevScope || node).parent; ; curr = curr.parent) { if (isBlockLike(curr)) { for (var prevStatement = void 0, _i = 0, _a = curr.statements; _i < _a.length; _i++) { var statement = _a[_i]; if (statement.pos > node.pos) break; prevStatement = statement } return !prevStatement && ts.isCaseClause(curr) ? (ts.Debug.assert(ts.isSwitchStatement(curr.parent.parent)), curr.parent.parent) : (ts.Debug.assert(void 0 !== prevStatement), prevStatement) } if (curr === scope) { ts.Debug.fail("Didn't encounter a block-like before encountering scope"); break } } } function getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes) { var variableAssignments = ts.map(exposedVariableDeclarations, function (v) { return ts.createShorthandPropertyAssignment(v.symbol.name) }), writeAssignments = ts.map(writes, function (w) { return ts.createShorthandPropertyAssignment(w.symbol.name) }); return void 0 === variableAssignments ? writeAssignments : void 0 === writeAssignments ? variableAssignments : variableAssignments.concat(writeAssignments) } function isReadonlyArray(v) { return ts.isArray(v) } function getEnclosingTextRange(targetRange, sourceFile) { return isReadonlyArray(targetRange.range) ? { pos: ts.first(targetRange.range).getStart(sourceFile), end: ts.last(targetRange.range).getEnd() } : targetRange.range } function collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, checker, cancellationToken) { function isInGenericContext(node) { return !!ts.findAncestor(node, function (n) { return ts.isDeclarationWithTypeParameters(n) && 0 !== ts.getEffectiveTypeParameterDeclarations(n).length }) } function recordTypeParameterUsages(type) { for (var symbolWalker = checker.getSymbolWalker(function () { return cancellationToken.throwIfCancellationRequested(), !0 }), visitedTypes = symbolWalker.walkType(type).visitedTypes, _i = 0, visitedTypes_1 = visitedTypes; _i < visitedTypes_1.length; _i++) { var visitedType = visitedTypes_1[_i]; visitedType.isTypeParameter() && allTypeParameterUsages.set(visitedType.id.toString(), visitedType) } } function collectUsages(node, valueUsage) { if (void 0 === valueUsage && (valueUsage = 1), inGenericContext) { var type = checker.getTypeAtLocation(node); recordTypeParameterUsages(type) } if (ts.isDeclaration(node) && node.symbol && visibleDeclarationsInExtractedRange.push(node), ts.isAssignmentExpression(node)) collectUsages(node.left, 2), collectUsages(node.right); else if (ts.isUnaryExpressionWithWrite(node)) collectUsages(node.operand, 2); else if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) ts.forEachChild(node, collectUsages); else if (ts.isIdentifier(node)) { if (!node.parent) return; if (ts.isQualifiedName(node.parent) && node !== node.parent.left) return; if (ts.isPropertyAccessExpression(node.parent) && node !== node.parent.expression) return; recordUsage(node, valueUsage, ts.isPartOfTypeNode(node)) } else ts.forEachChild(node, collectUsages) } function recordUsage(n, usage, isTypeNode) { var symbolId = recordUsagebySymbol(n, usage, isTypeNode); if (symbolId) for (var i = 0; i < scopes.length; i++) { var substitution = substitutionsPerScope[i].get(symbolId); substitution && usagesPerScope[i].substitutions.set(ts.getNodeId(n).toString(), substitution) } } function recordUsagebySymbol(identifier, usage, isTypeName) { var symbol = getSymbolReferencedByIdentifier(identifier); if (symbol) { var symbolId = ts.getSymbolId(symbol).toString(), lastUsage = seenUsages.get(symbolId); if (lastUsage && lastUsage >= usage) return symbolId; if (seenUsages.set(symbolId, usage), lastUsage) { for (var _i = 0, usagesPerScope_1 = usagesPerScope; _i < usagesPerScope_1.length; _i++) { var perScope = usagesPerScope_1[_i], prevEntry = perScope.usages.get(identifier.text); prevEntry && perScope.usages.set(identifier.text, { usage: usage, symbol: symbol, node: identifier }) } return symbolId } var decls = symbol.getDeclarations(), declInFile = decls && ts.find(decls, function (d) { return d.getSourceFile() === sourceFile }); if (declInFile && !ts.rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) { if (targetRange.facts & RangeFacts.IsGenerator && 2 === usage) { for (var diag = ts.createDiagnosticForNode(identifier, Messages.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators), _a = 0, functionErrorsPerScope_1 = functionErrorsPerScope; _a < functionErrorsPerScope_1.length; _a++) { var errors = functionErrorsPerScope_1[_a]; errors.push(diag) } for (var _b = 0, constantErrorsPerScope_1 = constantErrorsPerScope; _b < constantErrorsPerScope_1.length; _b++) { var errors = constantErrorsPerScope_1[_b]; errors.push(diag) } } for (var i = 0; i < scopes.length; i++) { var scope = scopes[i], resolvedSymbol = checker.resolveName(symbol.name, scope, symbol.flags, !1); if (resolvedSymbol !== symbol && !substitutionsPerScope[i].has(symbolId)) { var substitution = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.exportSymbol || symbol, scope, isTypeName); if (substitution) substitutionsPerScope[i].set(symbolId, substitution); else if (isTypeName) { if (!(262144 & symbol.flags)) { var diag = ts.createDiagnosticForNode(identifier, Messages.typeWillNotBeVisibleInTheNewScope); functionErrorsPerScope[i].push(diag), constantErrorsPerScope[i].push(diag) } } else usagesPerScope[i].usages.set(identifier.text, { usage: usage, symbol: symbol, node: identifier }) } } return symbolId } } } function checkForUsedDeclarations(node) { if (!(node === targetRange.range || isReadonlyArray(targetRange.range) && targetRange.range.indexOf(node) >= 0)) { var sym = ts.isIdentifier(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); if (sym) { var decl = ts.find(visibleDeclarationsInExtractedRange, function (d) { return d.symbol === sym }); if (decl) if (ts.isVariableDeclaration(decl)) { var idString = decl.symbol.id.toString(); exposedVariableSymbolSet.has(idString) || (exposedVariableDeclarations.push(decl), exposedVariableSymbolSet.set(idString, !0)) } else firstExposedNonVariableDeclaration = firstExposedNonVariableDeclaration || decl } ts.forEachChild(node, checkForUsedDeclarations) } } function getSymbolReferencedByIdentifier(identifier) { return identifier.parent && ts.isShorthandPropertyAssignment(identifier.parent) && identifier.parent.name === identifier ? checker.getShorthandAssignmentValueSymbol(identifier.parent) : checker.getSymbolAtLocation(identifier) } function tryReplaceWithQualifiedNameOrPropertyAccess(symbol, scopeDecl, isTypeNode) { if (symbol) { var decls = symbol.getDeclarations(); if (decls && decls.some(function (d) { return d.parent === scopeDecl })) return ts.createIdentifier(symbol.name); var prefix = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.parent, scopeDecl, isTypeNode); if (void 0 !== prefix) return isTypeNode ? ts.createQualifiedName(prefix, ts.createIdentifier(symbol.name)) : ts.createPropertyAccess(prefix, symbol.name) } } var firstExposedNonVariableDeclaration, expressionDiagnostic, allTypeParameterUsages = ts.createMap(), usagesPerScope = [], substitutionsPerScope = [], functionErrorsPerScope = [], constantErrorsPerScope = [], visibleDeclarationsInExtractedRange = [], exposedVariableSymbolSet = ts.createMap(), exposedVariableDeclarations = [], expression = isReadonlyArray(targetRange.range) ? 1 === targetRange.range.length && ts.isExpressionStatement(targetRange.range[0]) ? targetRange.range[0].expression : void 0 : targetRange.range; if (void 0 === expression) { var statements = targetRange.range, start = ts.first(statements).getStart(), end = ts.last(statements).end; expressionDiagnostic = ts.createFileDiagnostic(sourceFile, start, end - start, Messages.expressionExpected) } else 18432 & checker.getTypeAtLocation(expression).flags && (expressionDiagnostic = ts.createDiagnosticForNode(expression, Messages.uselessConstantType)); for (var _i = 0, scopes_1 = scopes; _i < scopes_1.length; _i++) { var scope = scopes_1[_i]; usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() }), substitutionsPerScope.push(ts.createMap()), functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && 233 !== scope.kind ? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)] : []); var constantErrors = []; expressionDiagnostic && constantErrors.push(expressionDiagnostic), ts.isClassLike(scope) && ts.isInJavaScriptFile(scope) && constantErrors.push(ts.createDiagnosticForNode(scope, Messages.cannotExtractToJSClass)), ts.isArrowFunction(scope) && !ts.isBlock(scope.body) && constantErrors.push(ts.createDiagnosticForNode(scope, Messages.cannotExtractToExpressionArrowFunction)), constantErrorsPerScope.push(constantErrors) } var seenUsages = ts.createMap(), target = isReadonlyArray(targetRange.range) ? ts.createBlock(targetRange.range) : targetRange.range, unmodifiedNode = isReadonlyArray(targetRange.range) ? ts.first(targetRange.range) : targetRange.range, inGenericContext = isInGenericContext(unmodifiedNode); if (collectUsages(target), inGenericContext && !isReadonlyArray(targetRange.range)) { var contextualType = checker.getContextualType(targetRange.range); recordTypeParameterUsages(contextualType) } if (allTypeParameterUsages.size > 0) { for (var seenTypeParameterUsages = ts.createMap(), i_1 = 0, curr = unmodifiedNode; void 0 !== curr && i_1 < scopes.length; curr = curr.parent)if (curr === scopes[i_1] && (seenTypeParameterUsages.forEach(function (typeParameter, id) { usagesPerScope[i_1].typeParameterUsages.set(id, typeParameter) }), i_1++), ts.isDeclarationWithTypeParameters(curr)) for (var _a = 0, _b = ts.getEffectiveTypeParameterDeclarations(curr); _a < _b.length; _a++) { var typeParameterDecl = _b[_a], typeParameter = checker.getTypeAtLocation(typeParameterDecl); allTypeParameterUsages.has(typeParameter.id.toString()) && seenTypeParameterUsages.set(typeParameter.id.toString(), typeParameter) } ts.Debug.assert(i_1 === scopes.length) } if (visibleDeclarationsInExtractedRange.length) { var containingLexicalScopeOfExtraction = ts.isBlockScope(scopes[0], scopes[0].parent) ? scopes[0] : ts.getEnclosingBlockScopeContainer(scopes[0]); ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations) } for (var _loop_20 = function (i) { var scopeUsages = usagesPerScope[i]; if (i > 0 && (scopeUsages.usages.size > 0 || scopeUsages.typeParameterUsages.size > 0)) { var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range; constantErrorsPerScope[i].push(ts.createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes)) } var readonlyClassPropertyWrite, hasWrite = !1; if (usagesPerScope[i].usages.forEach(function (value) { 2 === value.usage && (hasWrite = !0, 106500 & value.symbol.flags && value.symbol.valueDeclaration && ts.hasModifier(value.symbol.valueDeclaration, 64) && (readonlyClassPropertyWrite = value.symbol.valueDeclaration)) }), ts.Debug.assert(isReadonlyArray(targetRange.range) || 0 === exposedVariableDeclarations.length), hasWrite && !isReadonlyArray(targetRange.range)) { var diag = ts.createDiagnosticForNode(targetRange.range, Messages.cannotWriteInExpression); functionErrorsPerScope[i].push(diag), constantErrorsPerScope[i].push(diag) } else if (readonlyClassPropertyWrite && i > 0) { var diag = ts.createDiagnosticForNode(readonlyClassPropertyWrite, Messages.cannotExtractReadonlyPropertyInitializerOutsideConstructor); functionErrorsPerScope[i].push(diag), constantErrorsPerScope[i].push(diag) } else if (firstExposedNonVariableDeclaration) { var diag = ts.createDiagnosticForNode(firstExposedNonVariableDeclaration, Messages.cannotExtractExportedEntity); functionErrorsPerScope[i].push(diag), constantErrorsPerScope[i].push(diag) } }, i = 0; i < scopes.length; i++)_loop_20(i); return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations } } function getParentNodeInSpan(node, file, span) { if (node) for (; node.parent;) { if (ts.isSourceFile(node.parent) || !spanContainsNode(span, node.parent, file)) return node; node = node.parent } } function spanContainsNode(span, node, file) { return ts.textSpanContainsPosition(span, node.getStart(file)) && node.getEnd() <= ts.textSpanEnd(span) } function isExtractableExpression(node) { switch (node.parent.kind) { case 272: return !1 }switch (node.kind) { case 9: return 243 !== node.parent.kind && 247 !== node.parent.kind; case 203: case 179: case 181: return !1; case 71: return 181 !== node.parent.kind && 247 !== node.parent.kind && 251 !== node.parent.kind }return !0 } function isBlockLike(node) { switch (node.kind) { case 212: case 273: case 239: case 265: return !0; default: return !1 } } var refactorName = "Extract Symbol"; refactor.registerRefactor(refactorName, { getAvailableActions: getAvailableActions, getEditsForAction: getEditsForAction }), extractSymbol.getAvailableActions = getAvailableActions, extractSymbol.getEditsForAction = getEditsForAction; var Messages; !function (Messages) { function createMessage(message) { return { message: message, code: 0, category: ts.DiagnosticCategory.Message, key: message } } Messages.cannotExtractRange = createMessage("Cannot extract range."), Messages.cannotExtractImport = createMessage("Cannot extract import statement."), Messages.cannotExtractSuper = createMessage("Cannot extract super call."), Messages.cannotExtractEmpty = createMessage("Cannot extract empty range."), Messages.expressionExpected = createMessage("expression expected."), Messages.uselessConstantType = createMessage("No reason to extract constant of type."), Messages.statementOrExpressionExpected = createMessage("Statement or expression expected."), Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements = createMessage("Cannot extract range containing conditional break or continue statements."), Messages.cannotExtractRangeContainingConditionalReturnStatement = createMessage("Cannot extract range containing conditional return statement."), Messages.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange = createMessage("Cannot extract range containing labeled break or continue with target outside of the range."), Messages.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators = createMessage("Cannot extract range containing writes to references located outside of the target range in generators."), Messages.typeWillNotBeVisibleInTheNewScope = createMessage("Type will not visible in the new scope."), Messages.functionWillNotBeVisibleInTheNewScope = createMessage("Function will not visible in the new scope."), Messages.cannotExtractIdentifier = createMessage("Select more than a single identifier."), Messages.cannotExtractExportedEntity = createMessage("Cannot extract exported declaration"), Messages.cannotWriteInExpression = createMessage("Cannot write back side-effects when extracting an expression"), Messages.cannotExtractReadonlyPropertyInitializerOutsideConstructor = createMessage("Cannot move initialization of read-only class property outside of the constructor"), Messages.cannotExtractAmbientBlock = createMessage("Cannot extract code from ambient contexts"), Messages.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes"), Messages.cannotExtractToOtherFunctionLike = createMessage("Cannot extract method to a function-like scope that is not a function"), Messages.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS"), Messages.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block") }(Messages = extractSymbol.Messages || (extractSymbol.Messages = {})); var RangeFacts; !function (RangeFacts) { RangeFacts[RangeFacts.None = 0] = "None", RangeFacts[RangeFacts.HasReturn = 1] = "HasReturn", RangeFacts[RangeFacts.IsGenerator = 2] = "IsGenerator", RangeFacts[RangeFacts.IsAsyncFunction = 4] = "IsAsyncFunction", RangeFacts[RangeFacts.UsesThis = 8] = "UsesThis", RangeFacts[RangeFacts.InStaticRegion = 16] = "InStaticRegion" }(RangeFacts || (RangeFacts = {})), extractSymbol.getRangeToExtract = getRangeToExtract; var SpecialScope; !function (SpecialScope) { SpecialScope[SpecialScope.Module = 0] = "Module", SpecialScope[SpecialScope.Global = 1] = "Global" }(SpecialScope || (SpecialScope = {})); var Usage; !function (Usage) { Usage[Usage.Read = 1] = "Read", Usage[Usage.Write = 2] = "Write" }(Usage || (Usage = {})) }(extractSymbol = refactor.extractSymbol || (refactor.extractSymbol = {})) }(refactor = ts.refactor || (ts.refactor = {})) }(ts || (ts = {})); var ts; !function (ts) { var refactor; !function (refactor) { var generateGetAccessorAndSetAccessor; !function (generateGetAccessorAndSetAccessor) { function getAvailableActions(context) { var file = context.file; if (getConvertibleFieldAtPosition(context, file)) return [{ name: actionName, description: actionDescription, actions: [{ name: actionName, description: actionDescription }] }] } function getEditsForAction(context, _actionName) { var file = context.file, fieldInfo = getConvertibleFieldAtPosition(context, file); if (fieldInfo) { var isJS = ts.isSourceFileJavaScript(file), changeTracker = ts.textChanges.ChangeTracker.fromContext(context), isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration, renameAccessor = fieldInfo.renameAccessor; ts.suppressLeadingAndTrailingTrivia(fieldName), ts.suppressLeadingAndTrailingTrivia(declaration), ts.suppressLeadingAndTrailingTrivia(container); var isInClassLike = ts.isClassLike(container), modifierFlags = ts.getModifierFlags(declaration) & -65, accessorModifiers = isInClassLike ? !modifierFlags || 8 & modifierFlags ? getModifiers(isJS, isStatic, 114) : ts.createNodeArray(ts.createModifiersFromModifierFlags(modifierFlags)) : void 0, fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 112) : void 0; updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers); var getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); if (ts.suppressLeadingAndTrailingTrivia(getAccessor), insertAccessor(changeTracker, file, getAccessor, declaration, container), isReadonly) { var constructor = ts.getFirstConstructorWithBody(container); constructor && updateReadonlyPropertyInitializerStatementConstructor(changeTracker, context, constructor, fieldName, originalName) } else { var setAccessor = generateSetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); ts.suppressLeadingAndTrailingTrivia(setAccessor), insertAccessor(changeTracker, file, setAccessor, declaration, container) } var edits = changeTracker.getChanges(), renameFilename = file.fileName, nameNeedRename = renameAccessor ? accessorName : fieldName, renameLocationOffset = ts.isIdentifier(nameNeedRename) ? 0 : -1, renameLocation = renameLocationOffset + ts.getRenameLocation(edits, renameFilename, nameNeedRename.text, ts.isParameter(declaration)); return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits } } } function isConvertableName(name) { return ts.isIdentifier(name) || ts.isStringLiteral(name) } function isAcceptedDeclaration(node) { return ts.isParameterPropertyDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertyAssignment(node) } function createPropertyName(name, originalName) { return ts.isIdentifier(originalName) ? ts.createIdentifier(name) : ts.createLiteral(name) } function createAccessorAccessExpression(fieldName, isStatic, container) { var leftHead = isStatic ? container.name : ts.createThis(); return ts.isIdentifier(fieldName) ? ts.createPropertyAccess(leftHead, fieldName) : ts.createElementAccess(leftHead, ts.createLiteral(fieldName)) } function getModifiers(isJS, isStatic, accessModifier) { var modifiers = ts.append(isJS ? void 0 : [ts.createToken(accessModifier)], isStatic ? ts.createToken(115) : void 0); return modifiers && ts.createNodeArray(modifiers) } function startsWithUnderscore(name) { return 95 === name.charCodeAt(0) } function getConvertibleFieldAtPosition(context, file) { var startPosition = context.startPosition, endPosition = context.endPosition, node = ts.getTokenAtPosition(file, startPosition, !1), declaration = ts.findAncestor(node.parent, isAcceptedDeclaration), meaning = 124; if (declaration && ts.rangeOverlapsWithStartEnd(declaration.name, startPosition, endPosition) && isConvertableName(declaration.name) && (ts.getModifierFlags(declaration) | meaning) === meaning) { var name = declaration.name.text, startWithUnderscore = startsWithUnderscore(name), fieldName = createPropertyName(startWithUnderscore ? name : ts.getUniqueName("_" + name, file), declaration.name), accessorName = createPropertyName(startWithUnderscore ? ts.getUniqueName(name.substring(1), file) : name, declaration.name); return { isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasReadonlyModifier(declaration), type: ts.getTypeAnnotationNode(declaration), container: 148 === declaration.kind ? declaration.parent.parent : declaration.parent, originalName: declaration.name, declaration: declaration, fieldName: fieldName, accessorName: accessorName, renameAccessor: startWithUnderscore } } } function generateGetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) { return ts.createGetAccessor(void 0, modifiers, accessorName, void 0, type, ts.createBlock([ts.createReturn(createAccessorAccessExpression(fieldName, isStatic, container))], !0)) } function generateSetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) { return ts.createSetAccessor(void 0, modifiers, accessorName, [ts.createParameter(void 0, void 0, void 0, ts.createIdentifier("value"), void 0, type)], ts.createBlock([ts.createStatement(ts.createAssignment(createAccessorAccessExpression(fieldName, isStatic, container), ts.createIdentifier("value")))], !0)) } function updatePropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers) { var property = ts.updateProperty(declaration, declaration.decorators, modifiers, fieldName, declaration.questionToken || declaration.exclamationToken, declaration.type, declaration.initializer); changeTracker.replaceNode(file, declaration, property) } function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) { var assignment = ts.updatePropertyAssignment(declaration, fieldName, declaration.initializer); changeTracker.replacePropertyAssignment(file, declaration, assignment) } function updateFieldDeclaration(changeTracker, file, declaration, fieldName, modifiers) { ts.isPropertyDeclaration(declaration) ? updatePropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers) : ts.isPropertyAssignment(declaration) ? updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) : changeTracker.replaceNode(file, declaration, ts.updateParameter(declaration, declaration.decorators, modifiers, declaration.dotDotDotToken, ts.cast(fieldName, ts.isIdentifier), declaration.questionToken, declaration.type, declaration.initializer)) } function insertAccessor(changeTracker, file, accessor, declaration, container) { ts.isParameterPropertyDeclaration(declaration) ? changeTracker.insertNodeAtClassStart(file, container, accessor) : ts.isPropertyAssignment(declaration) ? changeTracker.insertNodeAfterComma(file, declaration, accessor) : changeTracker.insertNodeAfter(file, declaration, accessor) } function updateReadonlyPropertyInitializerStatementConstructor(changeTracker, context, constructor, fieldName, originalName) { if (constructor.body) { var file = context.file, program = context.program, cancellationToken = context.cancellationToken, referenceEntries = ts.mapDefined(ts.FindAllReferences.getReferenceEntriesForNode(originalName.parent.pos, originalName, program, [file], cancellationToken), function (entry) { return "node" === entry.type && ts.rangeContainsRange(constructor, entry.node) && ts.isIdentifier(entry.node) && ts.isWriteAccess(entry.node) ? entry.node : void 0 }); ts.forEach(referenceEntries, function (entry) { var parent = entry.parent, accessorName = ts.createIdentifier(fieldName.text), node = ts.isBinaryExpression(parent) ? ts.updateBinary(parent, accessorName, parent.right, parent.operatorToken) : ts.isPropertyAccessExpression(parent) ? ts.updatePropertyAccess(parent, parent.expression, accessorName) : ts.Debug.fail("Unexpected write access token"); changeTracker.replaceNode(file, parent, node) }) } } var actionName = "Generate 'get' and 'set' accessors", actionDescription = ts.Diagnostics.Generate_get_and_set_accessors.message; refactor.registerRefactor(actionName, { getEditsForAction: getEditsForAction, getAvailableActions: getAvailableActions }) }(generateGetAccessorAndSetAccessor = refactor.generateGetAccessorAndSetAccessor || (refactor.generateGetAccessorAndSetAccessor = {})) }(refactor = ts.refactor || (ts.refactor = {})) }(ts || (ts = {})); var ts; !function (ts) { var refactor; !function (refactor) { function getRangeToMove(context) { var file = context.file, range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context)), statements = file.statements, startNodeIndex = ts.findIndex(statements, function (s) { return s.end > range.pos }); if (startNodeIndex !== -1) { var startStatement = statements[startNodeIndex]; if (ts.isNamedDeclaration(startStatement) && startStatement.name && ts.rangeContainsRange(startStatement.name, range)) return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] }; if (!(range.pos > startStatement.getStart(file))) { var afterEndNodeIndex = ts.findIndex(statements, function (s) { return s.end > range.end }, startNodeIndex); if (afterEndNodeIndex === -1 || !(0 === afterEndNodeIndex || statements[afterEndNodeIndex].getStart(file) < range.end)) return { toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex), afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] } } } } function doChange(oldFile, program, toMove, changes, host, preferences) { var checker = program.getTypeChecker(), usage = getUsageInfo(oldFile, toMove.all, checker), currentDirectory = ts.getDirectoryPath(oldFile.fileName), extension = ts.extensionFromPath(oldFile.fileName), newModuleName = makeUniqueModuleName(getNewModuleName(usage.movedSymbols), extension, currentDirectory, host), newFileNameWithExtension = newModuleName + extension; changes.createNewFile(oldFile, ts.combinePaths(currentDirectory, newFileNameWithExtension), getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences)), addNewFileToTsconfig(program, changes, oldFile.fileName, newFileNameWithExtension, ts.hostGetCanonicalFileName(host)) } function getStatementsToMove(context) { var rangeToMove = getRangeToMove(context); if (void 0 !== rangeToMove) { var all = [], ranges = [], toMove = rangeToMove.toMove, afterLast = rangeToMove.afterLast; return ts.getRangesWhere(toMove, function (s) { return !isPureImport(s) }, function (start, afterEndIndex) { for (var i = start; i < afterEndIndex; i++)all.push(toMove[i]); ranges.push({ first: toMove[start], afterLast: afterLast }) }), 0 === all.length ? void 0 : { all: all, ranges: ranges } } } function isPureImport(node) { switch (node.kind) { case 243: return !0; case 242: return !ts.hasModifier(node, 1); case 213: return node.declarationList.declarations.every(function (d) { return d.initializer && ts.isRequireCall(d.initializer, !0) }); default: return !1 } } function addNewFileToTsconfig(program, changes, oldFileName, newFileNameWithExtension, getCanonicalFileName) { var cfg = program.getCompilerOptions().configFile; if (cfg) { var newFileAbsolutePath = ts.normalizePath(ts.combinePaths(oldFileName, "..", newFileNameWithExtension)), newFilePath = ts.getRelativePathFromFile(cfg.fileName, newFileAbsolutePath, getCanonicalFileName), cfgObject = cfg.statements[0] && ts.tryCast(cfg.statements[0].expression, ts.isObjectLiteralExpression), filesProp = cfgObject && ts.find(cfgObject.properties, function (prop) { return ts.isPropertyAssignment(prop) && ts.isStringLiteral(prop.name) && "files" === prop.name.text }); filesProp && ts.isArrayLiteralExpression(filesProp.initializer) && changes.insertNodeInListAfter(cfg, ts.last(filesProp.initializer.elements), ts.createLiteral(newFilePath), filesProp.initializer.elements); } } function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences) { var checker = program.getTypeChecker(); if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) return deleteMovedStatements(oldFile, toMove.ranges, changes), toMove.all; var useEs6ModuleSyntax = !!oldFile.externalModuleIndicator, quotePreference = ts.getQuotePreference(oldFile, preferences), importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile, newModuleName, useEs6ModuleSyntax, quotePreference); return importsFromNewFile && changes.insertNodeBefore(oldFile, oldFile.statements[0], importsFromNewFile, !0), deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker), deleteMovedStatements(oldFile, toMove.ranges, changes), updateImportsInOtherFiles(changes, program, oldFile, usage.movedSymbols, newModuleName), getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, useEs6ModuleSyntax, quotePreference).concat(addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEs6ModuleSyntax)) } function deleteMovedStatements(sourceFile, moved, changes) { for (var _i = 0, moved_1 = moved; _i < moved_1.length; _i++) { var _a = moved_1[_i], first_1 = _a.first, afterLast = _a.afterLast; changes.deleteNodeRangeExcludingEnd(sourceFile, first_1, afterLast) } } function deleteUnusedOldImports(oldFile, toMove, changes, toDelete, checker) { for (var _i = 0, _a = oldFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; ts.contains(toMove, statement) || forEachImportInStatement(statement, function (i) { return deleteUnusedImports(oldFile, i, changes, function (name) { return toDelete.has(checker.getSymbolAtLocation(name)) }) }) } } function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) { for (var checker = program.getTypeChecker(), _loop_21 = function (sourceFile) { if (sourceFile === oldFile) return "continue"; for (var _loop_22 = function (statement) { forEachImportInStatement(statement, function (importNode) { if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) === oldFile.symbol) { var shouldMove = function (name) { var symbol = ts.isBindingElement(name.parent) ? ts.getPropertySymbolFromBindingElement(checker, name.parent) : ts.skipAlias(checker.getSymbolAtLocation(name), checker); return !!symbol && movedSymbols.has(symbol) }; deleteUnusedImports(sourceFile, importNode, changes, shouldMove); var newModuleSpecifier = ts.combinePaths(ts.getDirectoryPath(moduleSpecifierFromImport(importNode).text), newModuleName), newImportDeclaration = filterImport(importNode, ts.createLiteral(newModuleSpecifier), shouldMove); newImportDeclaration && changes.insertNodeAfter(sourceFile, statement, newImportDeclaration); var ns = getNamespaceLikeImport(importNode); ns && updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, ns, importNode) } }) }, _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; _loop_22(statement) } }, _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; _loop_21(sourceFile) } } function getNamespaceLikeImport(node) { switch (node.kind) { case 243: return node.importClause && node.importClause.namedBindings && 245 === node.importClause.namedBindings.kind ? node.importClause.namedBindings.name : void 0; case 242: return node.name; case 231: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node) } } function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) { var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 6), needUniqueName = !1, toChange = []; if (ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) { ts.isPropertyAccessExpression(ref.parent) && (needUniqueName = needUniqueName || !!checker.resolveName(preferredNewNamespaceName, ref, 67108863, !0), movedSymbols.has(checker.getSymbolAtLocation(ref.parent.name)) && toChange.push(ref)) }), toChange.length) { for (var newNamespaceName = needUniqueName ? ts.getUniqueName(preferredNewNamespaceName, sourceFile) : preferredNewNamespaceName, _i = 0, toChange_1 = toChange; _i < toChange_1.length; _i++) { var ref = toChange_1[_i]; changes.replaceNode(sourceFile, ref, ts.createIdentifier(newNamespaceName)) } changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, newModuleName, newModuleSpecifier)) } } function updateNamespaceLikeImportNode(node, newNamespaceName, newModuleSpecifier) { var newNamespaceId = ts.createIdentifier(newNamespaceName), newModuleString = ts.createLiteral(newModuleSpecifier); switch (node.kind) { case 243: return ts.createImportDeclaration(void 0, void 0, ts.createImportClause(void 0, ts.createNamespaceImport(newNamespaceId)), newModuleString); case 242: return ts.createImportEqualsDeclaration(void 0, void 0, newNamespaceId, ts.createExternalModuleReference(newModuleString)); case 231: return ts.createVariableDeclaration(newNamespaceId, void 0, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node) } } function moduleSpecifierFromImport(i) { return 243 === i.kind ? i.moduleSpecifier : 242 === i.kind ? i.moduleReference.expression : i.initializer.arguments[0] } function forEachImportInStatement(statement, cb) { if (ts.isImportDeclaration(statement)) ts.isStringLiteral(statement.moduleSpecifier) && cb(statement); else if (ts.isImportEqualsDeclaration(statement)) ts.isExternalModuleReference(statement.moduleReference) && ts.isStringLiteralLike(statement.moduleReference.expression) && cb(statement); else if (ts.isVariableStatement(statement)) for (var _i = 0, _a = statement.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; decl.initializer && ts.isRequireCall(decl.initializer, !0) && cb(decl) } } function createOldFileImportsFromNewFile(newFileNeedExport, newFileNameWithExtension, useEs6Imports, quotePreference) { var defaultImport, imports = []; return newFileNeedExport.forEach(function (symbol) { "default" === symbol.escapedName ? defaultImport = ts.createIdentifier(ts.symbolNameNoDefault(symbol)) : imports.push(symbol.name) }), makeImportOrRequire(defaultImport, imports, newFileNameWithExtension, useEs6Imports, quotePreference) } function makeImportOrRequire(defaultImport, imports, path, useEs6Imports, quotePreference) { if (path = ts.ensurePathIsNonModuleName(path), useEs6Imports) { var specifiers = imports.map(function (i) { return ts.createImportSpecifier(void 0, ts.createIdentifier(i)) }); return ts.makeImportIfNecessary(defaultImport, specifiers, path, quotePreference) } ts.Debug.assert(!defaultImport); var bindingElements = imports.map(function (i) { return ts.createBindingElement(void 0, void 0, i) }); return bindingElements.length ? makeVariableStatement(ts.createObjectBindingPattern(bindingElements), void 0, createRequireCall(ts.createLiteral(path))) : void 0 } function makeVariableStatement(name, type, initializer, flags) { return void 0 === flags && (flags = 2), ts.createVariableStatement(void 0, ts.createVariableDeclarationList([ts.createVariableDeclaration(name, type, initializer)], flags)) } function createRequireCall(moduleSpecifier) { return ts.createCall(ts.createIdentifier("require"), void 0, [moduleSpecifier]) } function addExports(sourceFile, toMove, needExport, useEs6Exports) { return ts.flatMap(toMove, function (statement) { if (isTopLevelDeclarationStatement(statement) && !isExported(sourceFile, statement, useEs6Exports) && forEachTopLevelDeclaration(statement, function (d) { return needExport.has(ts.Debug.assertDefined(d.symbol)) })) { var exports_2 = addExport(statement, useEs6Exports); if (exports_2) return exports_2 } return statement }) } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { case 243: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; case 242: isUnused(importDecl.name) && changes.deleteNode(sourceFile, importDecl); break; case 231: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: ts.Debug.assertNever(importDecl) } } function deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused) { if (importDecl.importClause) { var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings, defaultUnused = !name || isUnused(name), namedBindingsUnused = !namedBindings || (245 === namedBindings.kind ? isUnused(namedBindings.name) : namedBindings.elements.every(function (e) { return isUnused(e.name) })); if (defaultUnused && namedBindingsUnused) changes.deleteNode(sourceFile, importDecl); else if (name && defaultUnused && changes.deleteNode(sourceFile, name), namedBindings) if (namedBindingsUnused) changes.deleteNode(sourceFile, namedBindings); else if (246 === namedBindings.kind) for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; isUnused(element.name) && changes.deleteNodeInList(sourceFile, element) } } } function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) { var name = varDecl.name; switch (name.kind) { case 71: isUnused(name) && changes.deleteNode(sourceFile, name); break; case 180: break; case 179: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name) })) changes.deleteNode(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && 1 === varDecl.parent.declarations.length ? varDecl.parent.parent : varDecl); else for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { var element = _a[_i]; ts.isIdentifier(element.name) && isUnused(element.name) && changes.deleteNode(sourceFile, element.name) } } } function getNewFileImportsAndAddExportInOldFile(oldFile, importsToCopy, newFileImportsFromOldFile, changes, checker, useEs6ModuleSyntax, quotePreference) { for (var copiedOldImports = [], _i = 0, _a = oldFile.statements; _i < _a.length; _i++) { var oldStatement = _a[_i]; forEachImportInStatement(oldStatement, function (i) { ts.append(copiedOldImports, filterImport(i, moduleSpecifierFromImport(i), function (name) { return importsToCopy.has(checker.getSymbolAtLocation(name)) })) }) } var oldFileDefault, oldFileNamedImports = [], markSeenTop = ts.nodeSeenTracker(); return newFileImportsFromOldFile.forEach(function (symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; if (isTopLevelDeclaration(decl)) { var name = nameOfTopLevelDeclaration(decl); if (name) { var top = getTopLevelDeclarationStatement(decl); markSeenTop(top) && addExportToChanges(oldFile, top, changes, useEs6ModuleSyntax), ts.hasModifier(decl, 512) ? oldFileDefault = name : oldFileNamedImports.push(name.text) } } } }), ts.append(copiedOldImports, makeImportOrRequire(oldFileDefault, oldFileNamedImports, ts.removeFileExtension(ts.getBaseFileName(oldFile.fileName)), useEs6ModuleSyntax, quotePreference)), copiedOldImports } function makeUniqueModuleName(moduleName, extension, inDirectory, host) { for (var newModuleName = moduleName, i = 1; ; i++) { var name = ts.combinePaths(inDirectory, newModuleName + extension); if (!host.fileExists(name)) return newModuleName; newModuleName = moduleName + "." + i } } function getNewModuleName(movedSymbols) { return movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile" } function getUsageInfo(oldFile, toMove, checker) { for (var movedSymbols = new SymbolSet, oldImportsNeededByNewFile = new SymbolSet, newFileImportsFromOldFile = new SymbolSet, _i = 0, toMove_1 = toMove; _i < toMove_1.length; _i++) { var statement = toMove_1[_i]; forEachTopLevelDeclaration(statement, function (decl) { movedSymbols.add(ts.Debug.assertDefined(ts.isExpressionStatement(decl) ? checker.getSymbolAtLocation(decl.expression.left) : decl.symbol)) }) } for (var _a = 0, toMove_2 = toMove; _a < toMove_2.length; _a++) { var statement = toMove_2[_a]; forEachReference(statement, checker, function (symbol) { if (symbol.declarations) for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; isInImport(decl) ? oldImportsNeededByNewFile.add(symbol) : isTopLevelDeclaration(decl) && !movedSymbols.has(symbol) && newFileImportsFromOldFile.add(symbol) } }) } for (var unusedImportsFromOldFile = oldImportsNeededByNewFile.clone(), oldFileImportsFromNewFile = new SymbolSet, _b = 0, _c = oldFile.statements; _b < _c.length; _b++) { var statement = _c[_b]; ts.contains(toMove, statement) || forEachReference(statement, checker, function (symbol) { movedSymbols.has(symbol) && oldFileImportsFromNewFile.add(symbol), unusedImportsFromOldFile.delete(symbol) }) } return { movedSymbols: movedSymbols, newFileImportsFromOldFile: newFileImportsFromOldFile, oldFileImportsFromNewFile: oldFileImportsFromNewFile, oldImportsNeededByNewFile: oldImportsNeededByNewFile, unusedImportsFromOldFile: unusedImportsFromOldFile } } function isInImport(decl) { switch (decl.kind) { case 242: case 247: case 244: return !0; case 231: return isVariableDeclarationInImport(decl); case 181: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return !1 } } function isVariableDeclarationInImport(decl) { return ts.isSourceFile(decl.parent.parent.parent) && decl.initializer && ts.isRequireCall(decl.initializer, !0) } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { case 243: var clause = i.importClause; if (!clause) return; var defaultImport = clause.name && keep(clause.name) ? clause.name : void 0, namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); return defaultImport || namedBindings ? ts.createImportDeclaration(void 0, void 0, ts.createImportClause(defaultImport, namedBindings), moduleSpecifier) : void 0; case 242: return keep(i.name) ? i : void 0; case 231: var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : void 0; default: return ts.Debug.assertNever(i) } } function filterNamedBindings(namedBindings, keep) { if (245 === namedBindings.kind) return keep(namedBindings.name) ? namedBindings : void 0; var newElements = namedBindings.elements.filter(function (e) { return keep(e.name) }); return newElements.length ? ts.createNamedImports(newElements) : void 0 } function filterBindingName(name, keep) { switch (name.kind) { case 71: return keep(name) ? name : void 0; case 180: return name; case 179: var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name) }); return newElements.length ? ts.createObjectBindingPattern(newElements) : void 0 } } function forEachReference(node, checker, onReference) { node.forEachChild(function cb(node) { if (ts.isIdentifier(node) && !ts.isDeclarationName(node)) { var sym = checker.getSymbolAtLocation(node); sym && onReference(sym) } else node.forEachChild(cb) }) } function isTopLevelDeclaration(node) { return isNonVariableTopLevelDeclaration(node) || ts.isVariableDeclaration(node) && ts.isSourceFile(node.parent.parent.parent) } function isTopLevelDeclarationStatement(node) { return ts.Debug.assert(ts.isSourceFile(node.parent)), isNonVariableTopLevelDeclaration(node) || ts.isVariableStatement(node) } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { case 233: case 234: case 238: case 237: case 236: case 235: case 242: return !0; default: return !1 } } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { case 233: case 234: case 238: case 237: case 236: case 235: case 242: return cb(statement); case 213: return ts.forEach(statement.declarationList.declarations, cb); case 215: var expression = statement.expression; return ts.isBinaryExpression(expression) && 1 === ts.getSpecialPropertyAssignmentKind(expression) ? cb(statement) : void 0 } } function nameOfTopLevelDeclaration(d) { return 215 === d.kind ? d.expression.left.name : ts.tryCast(d.name, ts.isIdentifier) } function getTopLevelDeclarationStatement(d) { return ts.isVariableDeclaration(d) ? d.parent.parent : d } function addExportToChanges(sourceFile, decl, changes, useEs6Exports) { if (!isExported(sourceFile, decl, useEs6Exports)) if (useEs6Exports) ts.isExpressionStatement(decl) || changes.insertExportModifier(sourceFile, decl); else { var names = getNamesToExportInCommonJS(decl); 0 !== names.length && changes.insertNodesAfter(sourceFile, decl, names.map(createExportAssignment)) } } function isExported(sourceFile, decl, useEs6Exports) { return useEs6Exports ? !ts.isExpressionStatement(decl) && ts.hasModifier(decl, 1) : getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)) }) } function addExport(decl, useEs6Exports) { return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl) } function addEs6Export(d) { var modifiers = ts.concatenate([ts.createModifier(84)], d.modifiers); switch (d.kind) { case 233: return ts.updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); case 234: return ts.updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); case 213: return ts.updateVariableStatement(d, modifiers, d.declarationList); case 238: return ts.updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body); case 237: return ts.updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members); case 236: return ts.updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type); case 235: return ts.updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); case 242: return ts.updateImportEqualsDeclaration(d, d.decorators, modifiers, d.name, d.moduleReference); case 215: return ts.Debug.fail(); default: return ts.Debug.assertNever(d) } } function addCommonjsExport(decl) { return [decl].concat(getNamesToExportInCommonJS(decl).map(createExportAssignment)) } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { case 233: case 234: return [decl.name.text]; case 213: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : void 0 }); case 238: case 237: case 236: case 235: case 242: return; case 215: return ts.Debug.fail(); default: ts.Debug.assertNever(decl) } } function createExportAssignment(name) { return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 58, ts.createIdentifier(name))) } var refactorName = "Move to a new file"; refactor.registerRefactor(refactorName, { getAvailableActions: function (context) { if (context.preferences.allowTextChangesInNewFiles && void 0 !== getStatementsToMove(context)) { var description = ts.getLocaleSpecificMessage(ts.Diagnostics.Move_to_a_new_file); return [{ name: refactorName, description: description, actions: [{ name: refactorName, description: description }] }] } }, getEditsForAction: function (context, actionName) { ts.Debug.assert(actionName === refactorName); var statements = ts.Debug.assertDefined(getStatementsToMove(context)), edits = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(context.file, context.program, statements, t, context.host, context.preferences) }); return { edits: edits, renameFilename: void 0, renameLocation: void 0 } } }); var SymbolSet = function () { function SymbolSet() { this.map = ts.createMap() } return SymbolSet.prototype.add = function (symbol) { this.map.set(String(ts.getSymbolId(symbol)), symbol) }, SymbolSet.prototype.has = function (symbol) { return this.map.has(String(ts.getSymbolId(symbol))) }, SymbolSet.prototype.delete = function (symbol) { this.map.delete(String(ts.getSymbolId(symbol))) }, SymbolSet.prototype.forEach = function (cb) { this.map.forEach(cb) }, SymbolSet.prototype.forEachEntry = function (cb) { return ts.forEachEntry(this.map, cb) }, SymbolSet.prototype.clone = function () { var clone = new SymbolSet; return ts.copyEntries(this.map, clone.map), clone }, SymbolSet }() }(refactor = ts.refactor || (ts.refactor = {})) }(ts || (ts = {})); var ts; !function (ts) { var sourcemaps; !function (sourcemaps) { function decode(host, mapPath, map, program, fallbackCache) { function getGeneratedPosition(loc) { var maps = getSourceOrderedMappings(); if (!ts.length(maps)) return loc; var targetIndex = ts.binarySearch(maps, { sourcePath: loc.fileName, sourcePosition: loc.position }, ts.identity, compareProcessedPositionSourcePositions); return targetIndex < 0 && maps.length > 0 && (targetIndex = ~targetIndex), maps[targetIndex] && 0 === ts.comparePaths(loc.fileName, maps[targetIndex].sourcePath, sourceRoot) ? { fileName: ts.toPath(map.file, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition } : loc } function getOriginalPosition(loc) { var maps = getGeneratedOrderedMappings(); if (!ts.length(maps)) return loc; var targetIndex = ts.binarySearch(maps, { emittedPosition: loc.position }, ts.identity, compareProcessedPositionEmittedPositions); return targetIndex < 0 && maps.length > 0 && (targetIndex = ~targetIndex), { fileName: ts.toPath(maps[targetIndex].sourcePath, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].sourcePosition } } function getSourceFileLike(fileName, location) { var file = program && program.getSourceFile(fileName); if (!file) { var path = ts.toPath(fileName, location, host.getCanonicalFileName); return fallbackCache.get(path) } return file } function getPositionOfLineAndCharacterUsingName(fileName, directory, line, character) { var file = getSourceFileLike(fileName, directory); return file ? ts.getPositionOfLineAndCharacter(file, line, character) : -1 } function getDecodedMappings() { return decodedMappings || (decodedMappings = calculateDecodedMappings()) } function getSourceOrderedMappings() { return sourceOrderedMappings || (sourceOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionSourcePositions)) } function getGeneratedOrderedMappings() { return generatedOrderedMappings || (generatedOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionEmittedPositions)) } function calculateDecodedMappings() { for (var state = { encodedText: map.mappings, currentNameIndex: void 0, sourceMapNamesLength: map.names ? map.names.length : void 0, currentEmittedColumn: 0, currentEmittedLine: 0, currentSourceColumn: 0, currentSourceLine: 0, currentSourceIndex: 0, positions: [], decodingIndex: 0, processPosition: processPosition }; !hasCompletedDecoding(state);)if (decodeSinglePosition(state), state.error) return host.log("Encountered error while decoding sourcemap found at " + mapPath + ": " + state.error), []; return state.positions } function compareProcessedPositionSourcePositions(a, b) { return ts.comparePaths(a.sourcePath, b.sourcePath, sourceRoot) || ts.compareValues(a.sourcePosition, b.sourcePosition) } function compareProcessedPositionEmittedPositions(a, b) { return ts.compareValues(a.emittedPosition, b.emittedPosition) } function processPosition(position) { var sourcePath = map.sources[position.sourceIndex]; return { emittedPosition: getPositionOfLineAndCharacterUsingName(map.file, currentDirectory, position.emittedLine, position.emittedColumn), sourcePosition: getPositionOfLineAndCharacterUsingName(sourcePath, sourceRoot, position.sourceLine, position.sourceColumn), sourcePath: sourcePath } } void 0 === fallbackCache && (fallbackCache = ts.createSourceFileLikeCache(host)); var decodedMappings, generatedOrderedMappings, sourceOrderedMappings, currentDirectory = ts.getDirectoryPath(mapPath), sourceRoot = map.sourceRoot || currentDirectory; return { getOriginalPosition: getOriginalPosition, getGeneratedPosition: getGeneratedPosition } } function hasCompletedDecoding(state) { return state.decodingIndex === state.encodedText.length } function decodeSinglePosition(state) { function capturePosition() { state.positions.push(state.processPosition({ emittedColumn: state.currentEmittedColumn, emittedLine: state.currentEmittedLine, sourceColumn: state.currentSourceColumn, sourceIndex: state.currentSourceIndex, sourceLine: state.currentSourceLine, nameIndex: state.currentNameIndex })) } function createErrorIfCondition(condition, errormsg) { return !!state.error || (condition && (state.error = errormsg), condition) } function base64VLQFormatDecode() { for (var moreDigits = !0, shiftCount = 0, value = 0; moreDigits; state.decodingIndex++) { if (createErrorIfCondition(state.decodingIndex >= state.encodedText.length, "Error in decoding base64VLQFormatDecode, past the mapping string")) return; var currentByte = base64FormatDecode(state.encodedText.charAt(state.decodingIndex)); moreDigits = 0 !== (32 & currentByte), value |= (31 & currentByte) << shiftCount, shiftCount += 5 } return 0 === (1 & value) ? value >>= 1 : (value >>= 1, value = -value), value } for (; state.decodingIndex < state.encodedText.length;) { var char = state.encodedText.charCodeAt(state.decodingIndex); if (59 !== char) { if (44 !== char) { if (state.currentEmittedColumn += base64VLQFormatDecode(), createErrorIfCondition(state.currentEmittedColumn < 0, "Invalid emittedColumn found")) return; if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted column")) return; if (state.currentSourceIndex += base64VLQFormatDecode(), createErrorIfCondition(state.currentSourceIndex < 0, "Invalid sourceIndex found")) return; if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after sourceIndex")) return; if (state.currentSourceLine += base64VLQFormatDecode(), createErrorIfCondition(state.currentSourceLine < 0, "Invalid sourceLine found")) return; if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted Line")) return; if (state.currentSourceColumn += base64VLQFormatDecode(), createErrorIfCondition(state.currentSourceColumn < 0, "Invalid sourceLine found")) return; if (isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex) || (void 0 === state.currentNameIndex && (state.currentNameIndex = 0), state.currentNameIndex += base64VLQFormatDecode()), createErrorIfCondition(!isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: There are more entries after " + (void 0 === state.currentNameIndex ? "sourceColumn" : "nameIndex"))) return; return void capturePosition() } state.decodingIndex++ } else state.currentEmittedLine++ , state.currentEmittedColumn = 0, state.decodingIndex++ } createErrorIfCondition(!0, "No encoded entry found") } function base64FormatDecode(char) { return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(char) } function isSourceMappingSegmentEnd(encodedText, pos) { return pos === encodedText.length || 44 === encodedText.charCodeAt(pos) || 59 === encodedText.charCodeAt(pos) } sourcemaps.identitySourceMapper = { getOriginalPosition: ts.identity, getGeneratedPosition: ts.identity }, sourcemaps.decode = decode }(sourcemaps = ts.sourcemaps || (ts.sourcemaps = {})) }(ts || (ts = {})); var ts; !function (ts) { function createNode(kind, pos, end, parent) { var node = ts.isNodeKind(kind) ? new NodeObject(kind, pos, end) : 71 === kind ? new IdentifierObject(71, pos, end) : new TokenObject(kind, pos, end); return node.parent = parent, node.flags = 12679168 & parent.flags, node } function createChildren(node, sourceFile) { if (!ts.isNodeKind(node.kind)) return ts.emptyArray; var children = []; if (ts.isJSDocCommentContainingNode(node)) return node.forEachChild(function (child) { children.push(child) }), children; ts.scanner.setText((sourceFile || node.getSourceFile()).text); var pos = node.pos, processNode = function (child) { addSyntheticNodes(children, pos, child.pos, node), children.push(child), pos = child.end }, processNodes = function (nodes) { addSyntheticNodes(children, pos, nodes.pos, node), children.push(createSyntaxList(nodes, node)), pos = nodes.end }; return ts.forEach(node.jsDoc, processNode), pos = node.pos, node.forEachChild(processNode, processNodes), addSyntheticNodes(children, pos, node.end, node), ts.scanner.setText(void 0), children } function addSyntheticNodes(nodes, pos, end, parent) { for (ts.scanner.setTextPos(pos); pos < end;) { var token = ts.scanner.scan(), textPos = ts.scanner.getTextPos(); if (textPos <= end && (71 === token && ts.Debug.fail("Did not expect " + ts.Debug.showSyntaxKind(parent) + " to have an Identifier in its trivia"), nodes.push(createNode(token, pos, textPos, parent))), pos = textPos, 1 === token) break } } function createSyntaxList(nodes, parent) { var list = createNode(298, nodes.pos, nodes.end, parent); list._children = []; for (var pos = nodes.pos, _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { var node = nodes_7[_i]; addSyntheticNodes(list._children, pos, node.pos, parent), list._children.push(node), pos = node.end } return addSyntheticNodes(list._children, pos, nodes.end, parent), list } function hasJSDocInheritDocTag(node) { return ts.getJSDocTags(node).some(function (tag) { return "inheritDoc" === tag.tagName.text }) } function getDocumentationComment(declarations, checker) { if (!declarations) return ts.emptyArray; var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations); if (0 === doc.length || declarations.some(hasJSDocInheritDocTag)) for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) { var declaration = declarations_14[_i], inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); inheritedDocs && (doc = 0 === doc.length ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc)) } return doc } function findInheritedJSDocComments(declaration, propertyName, typeChecker) { return ts.firstDefined(declaration.parent ? ts.getAllSuperTypeNodes(declaration.parent) : ts.emptyArray, function (superTypeNode) { var superType = typeChecker.getTypeAtLocation(superTypeNode), baseProperty = superType && typeChecker.getPropertyOfType(superType, propertyName), inheritedDocs = baseProperty && baseProperty.getDocumentationComment(typeChecker); return inheritedDocs && inheritedDocs.length ? inheritedDocs : void 0 }) } function getServicesObjectAllocator() { return { getNodeConstructor: function () { return NodeObject }, getTokenConstructor: function () { return TokenObject }, getIdentifierConstructor: function () { return IdentifierObject }, getSourceFileConstructor: function () { return SourceFileObject }, getSymbolConstructor: function () { return SymbolObject }, getTypeConstructor: function () { return TypeObject }, getSignatureConstructor: function () { return SignatureObject }, getSourceMapSourceConstructor: function () { return SourceMapSourceObject } } } function toEditorSettings(optionsAsMap) { var allPropertiesAreCamelCased = !0; for (var key in optionsAsMap) if (ts.hasProperty(optionsAsMap, key) && !isCamelCase(key)) { allPropertiesAreCamelCased = !1; break } if (allPropertiesAreCamelCased) return optionsAsMap; var settings = {}; for (var key in optionsAsMap) if (ts.hasProperty(optionsAsMap, key)) { var newKey = isCamelCase(key) ? key : key.charAt(0).toLowerCase() + key.substr(1); settings[newKey] = optionsAsMap[key] } return settings } function isCamelCase(s) { return !s.length || s.charAt(0) === s.charAt(0).toLowerCase() } function displayPartsToString(displayParts) { return displayParts ? ts.map(displayParts, function (displayPart) { return displayPart.text }).join("") : "" } function getDefaultCompilerOptions() { return { target: 1, jsx: 1 } } function getSupportedCodeFixes() { return ts.codefix.getSupportedErrorCodes() } function setSourceFileFields(sourceFile, scriptSnapshot, version) { sourceFile.version = version, sourceFile.scriptSnapshot = scriptSnapshot } function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) { var sourceFile = ts.createSourceFile(fileName, ts.getSnapshotText(scriptSnapshot), scriptTarget, setNodeParents, scriptKind); return setSourceFileFields(sourceFile, scriptSnapshot, version), sourceFile } function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { if (textChangeRange && version !== sourceFile.version && !ts.disableIncrementalParsing) { var newText = void 0, prefix = 0 !== textChangeRange.span.start ? sourceFile.text.substr(0, textChangeRange.span.start) : "", suffix = ts.textSpanEnd(textChangeRange.span) !== sourceFile.text.length ? sourceFile.text.substr(ts.textSpanEnd(textChangeRange.span)) : ""; if (0 === textChangeRange.newLength) newText = prefix && suffix ? prefix + suffix : prefix || suffix; else { var changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength); newText = prefix && suffix ? prefix + changedText + suffix : prefix ? prefix + changedText : changedText + suffix } var newSourceFile = ts.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); return setSourceFileFields(newSourceFile, scriptSnapshot, version), newSourceFile.nameTable = void 0, sourceFile !== newSourceFile && sourceFile.scriptSnapshot && (sourceFile.scriptSnapshot.dispose && sourceFile.scriptSnapshot.dispose(), sourceFile.scriptSnapshot = void 0), newSourceFile } return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, !0, sourceFile.scriptKind) } function createSourceFileLikeCache(host) { var cached = ts.createMap(); return { get: function (path) { if (cached.has(path)) return cached.get(path); if (host.fileExists && host.readFile && host.fileExists(path)) { var text = host.readFile(path), file = { text: text, lineMap: void 0, getLineAndCharacterOfPosition: function (pos) { return ts.computeLineAndCharacterOfPosition(ts.getLineStarts(this), pos) } }; return cached.set(path, file), file } } } } function createLanguageService(host, documentRegistry, syntaxOnly) { function log(message) { host.log && host.log(message) } function getValidSourceFile(fileName) { var sourceFile = program.getSourceFile(fileName); if (!sourceFile) throw new Error("Could not find file: '" + fileName + "'."); return sourceFile } function synchronizeHostData() { function fileExists(fileName) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName), entry = hostCache.getEntryByPath(path); return entry ? !ts.isString(entry) : host.fileExists && host.fileExists(fileName) } function onReleaseOldSourceFile(oldSourceFile, oldOptions) { var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldOptions); documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey) } function getOrCreateSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile) { return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), languageVersion, onError, shouldCreateNewSourceFile) } function getOrCreateSourceFileByPath(fileName, path, _languageVersion, _onError, shouldCreateNewSourceFile) { ts.Debug.assert(void 0 !== hostCache); var hostFileInformation = hostCache.getOrCreateEntryByPath(fileName, path); if (hostFileInformation) { if (!shouldCreateNewSourceFile) { var oldSourceFile = program && program.getSourceFileByPath(path); if (oldSourceFile) return ts.Debug.assertEqual(hostFileInformation.scriptKind, oldSourceFile.scriptKind, "Registered script kind should match new script kind.", path), documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind) } return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind) } } if (ts.Debug.assert(!syntaxOnly), host.getProjectVersion) { var hostProjectVersion = host.getProjectVersion(); if (hostProjectVersion) { if (lastProjectVersion === hostProjectVersion && !host.hasChangedAutomaticTypeDirectiveNames) return; lastProjectVersion = hostProjectVersion } } var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0; lastTypesRootVersion !== typeRootsVersion && (log("TypeRoots version has changed; provide new program"), program = void 0, lastTypesRootVersion = typeRootsVersion); var hostCache = new HostCache(host, getCanonicalFileName), rootFileNames = hostCache.getRootFileNames(), hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (!ts.isProgramUptoDate(program, rootFileNames, hostCache.compilationSettings(), function (path) { return hostCache.getVersion(path) }, fileExists, hasInvalidatedResolution, host.hasChangedAutomaticTypeDirectiveNames)) { var newSettings = hostCache.compilationSettings(), compilerHost = { getSourceFile: getOrCreateSourceFile, getSourceFileByPath: getOrCreateSourceFileByPath, getCancellationToken: function () { return cancellationToken }, getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitiveFileNames }, getNewLine: function () { return ts.getNewLineCharacter(newSettings, function () { return ts.getNewLineOrDefaultFromHost(host) }) }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options) }, writeFile: ts.noop, getCurrentDirectory: function () { return currentDirectory }, fileExists: fileExists, readFile: function (fileName) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName), entry = hostCache.getEntryByPath(path); return entry ? ts.isString(entry) ? void 0 : ts.getSnapshotText(entry.scriptSnapshot) : host.readFile && host.readFile(fileName) }, realpath: host.realpath && function (path) { return host.realpath(path) }, directoryExists: function (directoryName) { return ts.directoryProbablyExists(directoryName, host) }, getDirectories: function (path) { return host.getDirectories ? host.getDirectories(path) : [] }, onReleaseOldSourceFile: onReleaseOldSourceFile, hasInvalidatedResolution: hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames: host.hasChangedAutomaticTypeDirectiveNames }; host.trace && (compilerHost.trace = function (message) { return host.trace(message) }), host.resolveModuleNames && (compilerHost.resolveModuleNames = function (moduleNames, containingFile, reusedNames) { return host.resolveModuleNames(moduleNames, containingFile, reusedNames) }), host.resolveTypeReferenceDirectives && (compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile) }); var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings), options = { rootNames: rootFileNames, options: newSettings, host: compilerHost, oldProgram: program, projectReferences: hostCache.getProjectReferences() }; program = ts.createProgram(options), hostCache = void 0, sourcemappedFileCache = createSourceFileLikeCache(host), program.getTypeChecker() } } function getProgram() { return syntaxOnly ? void ts.Debug.assert(void 0 === program) : (synchronizeHostData(), program) } function cleanupSemanticCache() { program = void 0 } function dispose() { program && (ts.forEach(program.getSourceFiles(), function (f) { return documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()) }), program = void 0), host = void 0 } function getSyntacticDiagnostics(fileName) { return synchronizeHostData(), program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken).slice() } function getSemanticDiagnostics(fileName) { synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName), semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); if (!program.getCompilerOptions().declaration) return semanticDiagnostics.slice(); var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); return semanticDiagnostics.concat(declarationDiagnostics) } function getSuggestionDiagnostics(fileName) { return synchronizeHostData(), ts.computeSuggestionDiagnostics(getValidSourceFile(fileName), program) } function getCompilerOptionsDiagnostics() { return synchronizeHostData(), program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken)) } function getCompletionsAtPosition(fileName, position, options) { void 0 === options && (options = ts.defaultPreferences); var fullPreferences = __assign({}, ts.identity(options), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); return synchronizeHostData(), ts.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences, options.triggerCharacter) } function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) { return void 0 === preferences && (preferences = ts.defaultPreferences), synchronizeHostData(), ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, formattingOptions && ts.formatting.getFormatContext(formattingOptions), getCanonicalFileName, preferences, cancellationToken) } function getCompletionEntrySymbol(fileName, position, name, source) { return synchronizeHostData(), ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }) } function getQuickInfoAtPosition(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName), node = ts.getTouchingPropertyName(sourceFile, position, !0); if (node !== sourceFile) { var typeChecker = program.getTypeChecker(), symbol = getSymbolAtLocationForQuickInfo(node, typeChecker); if (symbol && !typeChecker.isUnknownSymbol(symbol)) { var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node) }), symbolKind = _a.symbolKind, displayParts = _a.displayParts, documentation = _a.documentation, tags = _a.tags; return { kind: symbolKind, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), textSpan: ts.createTextSpanFromNode(node, sourceFile), displayParts: displayParts, documentation: documentation, tags: tags } } switch (node.kind) { case 71: if (ts.isLabelName(node)) return; case 184: case 145: case 99: case 173: case 97: var type_4 = typeChecker.getTypeAtLocation(node); return type_4 && { kind: "", kindModifiers: "", textSpan: ts.createTextSpanFromNode(node, sourceFile), displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_4, ts.getContainerNode(node)) }), documentation: type_4.symbol ? type_4.symbol.getDocumentationComment(typeChecker) : void 0, tags: type_4.symbol ? type_4.symbol.getJsDocTags() : void 0 } } } } function getSymbolAtLocationForQuickInfo(node, checker) { if ((ts.isIdentifier(node) || ts.isStringLiteral(node)) && ts.isPropertyAssignment(node.parent) && node.parent.name === node) { var type = checker.getContextualType(node.parent.parent), property = type && checker.getPropertyOfType(type, ts.getTextOfIdentifierOrLiteral(node)); if (property) return property } return checker.getSymbolAtLocation(node) } function toLineColumnOffset(fileName, position) { var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName), file = program.getSourceFile(path) || sourcemappedFileCache.get(path); return file.getLineAndCharacterOfPosition(position) } function scanForSourcemapURL(fileName) { var mappedFile = sourcemappedFileCache.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); if (mappedFile) for (var starts = ts.getLineStarts(mappedFile), index = starts.length - 1; index >= 0; index--) { sourceMapCommentRegExp.lastIndex = starts[index]; var comment = sourceMapCommentRegExp.exec(mappedFile.text); if (comment) return comment[1] } } function convertDocumentToSourceMapper(file, contents, mapFileName) { var maps; try { maps = JSON.parse(contents) } catch (_a) { } return maps && maps.sources && maps.file && maps.mappings ? file.sourceMapper = ts.sourcemaps.decode({ readFile: function (s) { return host.readFile(s) }, fileExists: function (s) { return host.fileExists(s) }, getCanonicalFileName: getCanonicalFileName, log: log }, mapFileName, maps, program, sourcemappedFileCache) : file.sourceMapper = ts.sourcemaps.identitySourceMapper } function getSourceMapper(fileName, file) { if (!host.readFile || !host.fileExists) return file.sourceMapper = ts.sourcemaps.identitySourceMapper; if (file.sourceMapper) return file.sourceMapper; var mapFileName = scanForSourcemapURL(fileName); if (mapFileName) { var match = base64UrlRegExp.exec(mapFileName); if (match) { if (match[1]) { var base64Object = match[1]; return convertDocumentToSourceMapper(file, ts.base64decode(ts.sys, base64Object), fileName) } mapFileName = void 0 } } var possibleMapLocations = []; mapFileName && possibleMapLocations.push(mapFileName), possibleMapLocations.push(fileName + ".map"); for (var _i = 0, possibleMapLocations_1 = possibleMapLocations; _i < possibleMapLocations_1.length; _i++) { var location = possibleMapLocations_1[_i], mapPath = ts.toPath(location, ts.getDirectoryPath(fileName), getCanonicalFileName); if (host.fileExists(mapPath)) return convertDocumentToSourceMapper(file, host.readFile(mapPath), mapPath) } return file.sourceMapper = ts.sourcemaps.identitySourceMapper } function makeGetTargetOfMappedPosition(extract, create) { function getTargetOfMappedPosition(input, original) { void 0 === original && (original = input); var info = extract(input); if (ts.endsWith(info.fileName, ".d.ts")) { var file_18 = program.getSourceFile(info.fileName); if (!file_18) { var path = ts.toPath(info.fileName, currentDirectory, getCanonicalFileName); file_18 = sourcemappedFileCache.get(path) } if (!file_18) return input; var mapper = getSourceMapper(info.fileName, file_18), newLoc = mapper.getOriginalPosition(info); return newLoc === info ? input : getTargetOfMappedPosition(create(newLoc, input, original), original) } return input } return getTargetOfMappedPosition } function getTargetOfMappedDeclarationFiles(infos) { return ts.map(infos, function (d) { return getTargetOfMappedDeclarationInfo(d) }) } function getDefinitionAtPosition(fileName, position) { return synchronizeHostData(), getTargetOfMappedDeclarationFiles(ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position)) } function getDefinitionAndBoundSpan(fileName, position) { synchronizeHostData(); var result = ts.GoToDefinition.getDefinitionAndBoundSpan(program, getValidSourceFile(fileName), position); if (!result) return result; var mappedDefs = getTargetOfMappedDeclarationFiles(result.definitions); return mappedDefs === result.definitions ? result : { definitions: mappedDefs, textSpan: result.textSpan } } function getTypeDefinitionAtPosition(fileName, position) { return synchronizeHostData(), getTargetOfMappedDeclarationFiles(ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position)) } function getTargetOfMappedImplementationLocations(infos) { return ts.map(infos, function (d) { return getTargetOfMappedImplementationLocation(d) }) } function getImplementationAtPosition(fileName, position) { return synchronizeHostData(), getTargetOfMappedImplementationLocations(ts.FindAllReferences.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position)) } function getOccurrencesAtPosition(fileName, position) { return ts.flatMap(getDocumentHighlights(fileName, position, [fileName]), function (entry) { return entry.highlightSpans.map(function (highlightSpan) { return { fileName: entry.fileName, textSpan: highlightSpan.textSpan, isWriteAccess: "writtenReference" === highlightSpan.kind, isDefinition: !1, isInString: highlightSpan.isInString } }) }) } function getDocumentHighlights(fileName, position, filesToSearch) { ts.Debug.assert(filesToSearch.some(function (f) { return ts.normalizePath(f) === fileName })), synchronizeHostData(); var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return ts.Debug.assertDefined(program.getSourceFile(f)) }), sourceFile = getValidSourceFile(fileName); return ts.DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) } function findRenameLocations(fileName, position, findInStrings, findInComments) { return getReferences(fileName, position, { findInStrings: findInStrings, findInComments: findInComments, isForRename: !0 }) } function getReferencesAtPosition(fileName, position) { return getReferences(fileName, position) } function getReferences(fileName, position, options) { synchronizeHostData(); var sourceFiles = []; if (options && options.isForRename) for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; program.isSourceFileDefaultLibrary(sourceFile) || sourceFiles.push(sourceFile) } else sourceFiles = program.getSourceFiles().slice(); return ts.FindAllReferences.findReferencedEntries(program, cancellationToken, sourceFiles, getValidSourceFile(fileName), position, options) } function findReferences(fileName, position) { return synchronizeHostData(), ts.FindAllReferences.findReferencedSymbols(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position) } function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { synchronizeHostData(); var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles) } function getEmitOutput(fileName, emitOnlyDtsFiles) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName), customTransformers = host.getCustomTransformers && host.getCustomTransformers(); return ts.getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers) } function getSignatureHelpItems(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken) } function getNonBoundSourceFile(fileName) { return syntaxTreeCache.getCurrentSourceFile(fileName) } function getSourceFile(fileName) { return getNonBoundSourceFile(fileName) } function getNameOrDottedNameSpan(fileName, startPos, _endPos) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName), node = ts.getTouchingPropertyName(sourceFile, startPos, !1); if (node !== sourceFile) { switch (node.kind) { case 184: case 145: case 9: case 86: case 101: case 95: case 97: case 99: case 173: case 71: break; default: return }for (var nodeForStartPos = node; ;)if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) nodeForStartPos = nodeForStartPos.parent; else { if (!ts.isNameOfModuleDeclaration(nodeForStartPos)) break; if (238 !== nodeForStartPos.parent.parent.kind || nodeForStartPos.parent.parent.body !== nodeForStartPos.parent) break; nodeForStartPos = nodeForStartPos.parent.parent.name } return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()) } } function getBreakpointStatementAtPosition(fileName, position) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position) } function getNavigationBarItems(fileName) { return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken) } function getNavigationTree(fileName) { return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken) } function isTsOrTsxFile(fileName) { var kind = ts.getScriptKind(fileName, host); return 3 === kind || 4 === kind } function getSemanticClassifications(fileName, span) { return isTsOrTsxFile(fileName) ? (synchronizeHostData(), ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span)) : [] } function getEncodedSemanticClassifications(fileName, span) { return isTsOrTsxFile(fileName) ? (synchronizeHostData(), ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span)) : { spans: [], endOfLineState: 0 } } function getSyntacticClassifications(fileName, span) { return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span) } function getEncodedSyntacticClassifications(fileName, span) { return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span) } function getOutliningSpans(fileName) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return ts.OutliningElementsCollector.collectElements(sourceFile, cancellationToken) } function getBraceMatchingAtPosition(fileName, position) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName), token = ts.getTouchingToken(sourceFile, position, !1), matchKind = token.getStart(sourceFile) === position ? braceMatching.get(token.kind.toString()) : void 0, match = matchKind && ts.findChildOfKind(token.parent, matchKind, sourceFile); return match ? [ts.createTextSpanFromNode(token, sourceFile), ts.createTextSpanFromNode(match, sourceFile)].sort(function (a, b) { return a.start - b.start }) : ts.emptyArray } function getIndentationAtPosition(fileName, position, editorOptions) { var start = ts.timestamp(), settings = toEditorSettings(editorOptions), sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (ts.timestamp() - start)), start = ts.timestamp(); var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings); return log("getIndentationAtPosition: computeIndentation : " + (ts.timestamp() - start)), result } function getFormattingEditsForRange(fileName, start, end, options) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options))) } function getFormattingEditsForDocument(fileName, options) { return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options))) } function getFormattingEditsAfterKeystroke(fileName, position, key, options) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName), formatContext = ts.formatting.getFormatContext(toEditorSettings(options)); if (!ts.isInComment(sourceFile, position)) switch (key) { case "{": return ts.formatting.formatOnOpeningCurly(position, sourceFile, formatContext); case "}": return ts.formatting.formatOnClosingCurly(position, sourceFile, formatContext); case ";": return ts.formatting.formatOnSemicolon(position, sourceFile, formatContext); case "\n": return ts.formatting.formatOnEnter(position, sourceFile, formatContext) }return [] } function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions, preferences) { void 0 === preferences && (preferences = ts.defaultPreferences), synchronizeHostData(); var sourceFile = getValidSourceFile(fileName), span = ts.createTextSpanFromBounds(start, end), formatContext = ts.formatting.getFormatContext(formatOptions); return ts.flatMap(ts.deduplicate(errorCodes, ts.equateValues, ts.compareValues), function (errorCode) { return cancellationToken.throwIfCancellationRequested(), ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }) }) } function getCombinedCodeFix(scope, fixId, formatOptions, preferences) { void 0 === preferences && (preferences = ts.defaultPreferences), synchronizeHostData(), ts.Debug.assert("file" === scope.type); var sourceFile = getValidSourceFile(scope.fileName), formatContext = ts.formatting.getFormatContext(formatOptions); return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }) } function organizeImports(scope, formatOptions, preferences) { void 0 === preferences && (preferences = ts.defaultPreferences), synchronizeHostData(), ts.Debug.assert("file" === scope.type); var sourceFile = getValidSourceFile(scope.fileName), formatContext = ts.formatting.getFormatContext(formatOptions); return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences) } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { return void 0 === preferences && (preferences = ts.defaultPreferences), ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions), preferences) } function applyCodeActionCommand(fileName, actionOrUndefined) { var action = "string" == typeof fileName ? actionOrUndefined : fileName; return ts.isArray(action) ? Promise.all(action.map(applySingleCodeActionCommand)) : applySingleCodeActionCommand(action) } function applySingleCodeActionCommand(action) { switch (action.type) { case "install package": return host.installPackage ? host.installPackage({ fileName: ts.toPath(action.file, currentDirectory, getCanonicalFileName), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`"); default: ts.Debug.fail() } } function getDocCommentTemplateAtPosition(fileName, position) { return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position) } function isValidBraceCompletionAtPosition(fileName, position, openingBrace) { if (60 === openingBrace) return !1; var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); if (ts.isInString(sourceFile, position)) return !1; if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) return 123 === openingBrace; if (ts.isInTemplateString(sourceFile, position)) return !1; switch (openingBrace) { case 39: case 34: case 96: return !ts.isInComment(sourceFile, position) }return !0 } function getSpanOfEnclosingComment(fileName, position, onlyMultiLine) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName), range = ts.formatting.getRangeOfEnclosingComment(sourceFile, position, onlyMultiLine); return range && ts.createTextSpanFromRange(range) } function getTodoComments(fileName, descriptors) { function escapeRegExp(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") } function getTodoCommentsRegExp() { var singleLineCommentStart = /(?:\/\/+\s*)/.source, multiLineCommentStart = /(?:\/\*+\s*)/.source, anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source, preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")", literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")" }).join("|") + ")", endOfLineOrEndOfComment = /(?:$|\*\/)/.source, messageRemainder = /(?:.*?)/.source, messagePortion = "(" + literals + messageRemainder + ")", regExpString = preamble + messagePortion + endOfLineOrEndOfComment; return new RegExp(regExpString, "gim") } function isLetterOrDigit(char) { return char >= 97 && char <= 122 || char >= 65 && char <= 90 || char >= 48 && char <= 57 } function isNodeModulesFile(path) { return ts.stringContains(path, "/node_modules/") } synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); cancellationToken.throwIfCancellationRequested(); var fileContents = sourceFile.text, result = []; if (descriptors.length > 0 && !isNodeModulesFile(sourceFile.fileName)) for (var regExp = getTodoCommentsRegExp(), matchArray = void 0; matchArray = regExp.exec(fileContents);) { cancellationToken.throwIfCancellationRequested(); var firstDescriptorCaptureIndex = 3; ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); var preamble = matchArray[1], matchPosition = matchArray.index + preamble.length; if (ts.isInComment(sourceFile, matchPosition)) { for (var descriptor = void 0, i = 0; i < descriptors.length; i++)matchArray[i + firstDescriptorCaptureIndex] && (descriptor = descriptors[i]); if (ts.Debug.assert(void 0 !== descriptor), !isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { var message = matchArray[2]; result.push({ descriptor: descriptor, message: message, position: matchPosition }) } } } return result } function getRenameInfo(fileName, position) { synchronizeHostData(); var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position) } function getRefactorContext(file, positionOrRange, preferences, formatOptions) { var _a = "number" == typeof positionOrRange ? [positionOrRange, void 0] : [positionOrRange.pos, positionOrRange.end], startPosition = _a[0], endPosition = _a[1]; return { file: file, startPosition: startPosition, endPosition: endPosition, program: getProgram(), host: host, formatContext: ts.formatting.getFormatContext(formatOptions), cancellationToken: cancellationToken, preferences: preferences } } function getApplicableRefactors(fileName, positionOrRange, preferences) { void 0 === preferences && (preferences = ts.defaultPreferences), synchronizeHostData(); var file = getValidSourceFile(fileName); return ts.refactor.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences)) } function getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName, preferences) { void 0 === preferences && (preferences = ts.defaultPreferences), synchronizeHostData(); var file = getValidSourceFile(fileName); return ts.refactor.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName, actionName) } void 0 === documentRegistry && (documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory())), void 0 === syntaxOnly && (syntaxOnly = !1); var _a, program, lastProjectVersion, syntaxTreeCache = new SyntaxTreeCache(host), lastTypesRootVersion = 0, cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()), currentDirectory = host.getCurrentDirectory(); !ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages && (ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages()); var sourcemappedFileCache, useCaseSensitiveFileNames = ts.hostUsesCaseSensitiveFileNames(host), getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames), sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/gm, base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/, getTargetOfMappedDeclarationInfo = makeGetTargetOfMappedPosition(function (info) { return { fileName: info.fileName, position: info.textSpan.start } }, function (newLoc, info, original) { return { containerKind: info.containerKind, containerName: info.containerName, fileName: newLoc.fileName, kind: info.kind, name: info.name, textSpan: { start: newLoc.position, length: info.textSpan.length }, originalFileName: original.fileName, originalTextSpan: original.textSpan } }), getTargetOfMappedImplementationLocation = makeGetTargetOfMappedPosition(function (info) { return { fileName: info.fileName, position: info.textSpan.start } }, function (newLoc, info) { return { fileName: newLoc.fileName, kind: info.kind, displayParts: info.displayParts, textSpan: { start: newLoc.position, length: info.textSpan.length }, originalFileName: info.fileName, originalTextSpan: info.textSpan } }), braceMatching = ts.createMapFromTemplate((_a = {}, _a[17] = 18, _a[19] = 20, _a[21] = 22, _a[29] = 27, _a)); return braceMatching.forEach(function (value, key) { return braceMatching.set(value.toString(), Number(key)) }), { dispose: dispose, cleanupSemanticCache: cleanupSemanticCache, getSyntacticDiagnostics: getSyntacticDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getSuggestionDiagnostics: getSuggestionDiagnostics, getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, getSyntacticClassifications: getSyntacticClassifications, getSemanticClassifications: getSemanticClassifications, getEncodedSyntacticClassifications: getEncodedSyntacticClassifications, getEncodedSemanticClassifications: getEncodedSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, getCompletionEntrySymbol: getCompletionEntrySymbol, getSignatureHelpItems: getSignatureHelpItems, getQuickInfoAtPosition: getQuickInfoAtPosition, getDefinitionAtPosition: getDefinitionAtPosition, getDefinitionAndBoundSpan: getDefinitionAndBoundSpan, getImplementationAtPosition: getImplementationAtPosition, getTypeDefinitionAtPosition: getTypeDefinitionAtPosition, getReferencesAtPosition: getReferencesAtPosition, findReferences: findReferences, getOccurrencesAtPosition: getOccurrencesAtPosition, getDocumentHighlights: getDocumentHighlights, getNameOrDottedNameSpan: getNameOrDottedNameSpan, getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, getNavigateToItems: getNavigateToItems, getRenameInfo: getRenameInfo, findRenameLocations: findRenameLocations, getNavigationBarItems: getNavigationBarItems, getNavigationTree: getNavigationTree, getOutliningSpans: getOutliningSpans, getTodoComments: getTodoComments, getBraceMatchingAtPosition: getBraceMatchingAtPosition, getIndentationAtPosition: getIndentationAtPosition, getFormattingEditsForRange: getFormattingEditsForRange, getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition, getSpanOfEnclosingComment: getSpanOfEnclosingComment, getCodeFixesAtPosition: getCodeFixesAtPosition, getCombinedCodeFix: getCombinedCodeFix, applyCodeActionCommand: applyCodeActionCommand, organizeImports: organizeImports, getEditsForFileRename: getEditsForFileRename, getEmitOutput: getEmitOutput, getNonBoundSourceFile: getNonBoundSourceFile, getSourceFile: getSourceFile, getProgram: getProgram, getApplicableRefactors: getApplicableRefactors, getEditsForRefactor: getEditsForRefactor, toLineColumnOffset: toLineColumnOffset } } function getNameTable(sourceFile) { return sourceFile.nameTable || initializeNameTable(sourceFile), sourceFile.nameTable } function initializeNameTable(sourceFile) { var nameTable = sourceFile.nameTable = ts.createUnderscoreEscapedMap(); sourceFile.forEachChild(function walk(node) { if (ts.isIdentifier(node) && node.escapedText || ts.isStringOrNumericLiteral(node) && literalIsName(node)) { var text = ts.getEscapedTextOfIdentifierOrLiteral(node); nameTable.set(text, void 0 === nameTable.get(text) ? node.pos : -1) } if (ts.forEachChild(node, walk), ts.hasJSDocNodes(node)) for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { var jsDoc = _a[_i]; ts.forEachChild(jsDoc, walk) } }) } function literalIsName(node) { return ts.isDeclarationName(node) || 253 === node.parent.kind || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node) } function getContainingObjectLiteralElement(node) { switch (node.kind) { case 9: case 8: if (146 === node.parent.kind) return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0; case 71: return !ts.isObjectLiteralElement(node.parent) || 183 !== node.parent.parent.kind && 262 !== node.parent.parent.kind || node.parent.name !== node ? void 0 : node.parent; } } function getPropertySymbolsFromContextualType(typeChecker, node) { var objectLiteral = node.parent, contextualType = typeChecker.getContextualType(objectLiteral); return getPropertySymbolsFromType(contextualType, node.name) } function getPropertySymbolsFromType(type, propName) { var name = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(propName)); if (name && type) { var result_7 = [], symbol = type.getProperty(name); if (131072 & type.flags) return ts.forEach(type.types, function (t) { var symbol = t.getProperty(name); symbol && result_7.push(symbol) }), result_7; if (symbol) return result_7.push(symbol), result_7 } } function isArgumentOfElementAccessExpression(node) { return node && node.parent && 185 === node.parent.kind && node.parent.argumentExpression === node } function getDefaultLibFilePath(options) { return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options) } ts.servicesVersion = "0.8"; var NodeObject = function () { function NodeObject(kind, pos, end) { this.pos = pos, this.end = end, this.flags = 0, this.transformFlags = void 0, this.parent = void 0, this.kind = kind } return NodeObject.prototype.assertHasRealPosition = function (message) { ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation") }, NodeObject.prototype.getSourceFile = function () { return ts.getSourceFileOfNode(this) }, NodeObject.prototype.getStart = function (sourceFile, includeJsDocComment) { return this.assertHasRealPosition(), ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment) }, NodeObject.prototype.getFullStart = function () { return this.assertHasRealPosition(), this.pos }, NodeObject.prototype.getEnd = function () { return this.assertHasRealPosition(), this.end }, NodeObject.prototype.getWidth = function (sourceFile) { return this.assertHasRealPosition(), this.getEnd() - this.getStart(sourceFile) }, NodeObject.prototype.getFullWidth = function () { return this.assertHasRealPosition(), this.end - this.pos }, NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) { return this.assertHasRealPosition(), this.getStart(sourceFile) - this.pos }, NodeObject.prototype.getFullText = function (sourceFile) { return this.assertHasRealPosition(), (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end) }, NodeObject.prototype.getText = function (sourceFile) { return this.assertHasRealPosition(), sourceFile || (sourceFile = this.getSourceFile()), sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()) }, NodeObject.prototype.getChildCount = function (sourceFile) { return this.getChildren(sourceFile).length }, NodeObject.prototype.getChildAt = function (index, sourceFile) { return this.getChildren(sourceFile)[index] }, NodeObject.prototype.getChildren = function (sourceFile) { return this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"), this._children || (this._children = createChildren(this, sourceFile)) }, NodeObject.prototype.getFirstToken = function (sourceFile) { this.assertHasRealPosition(); var children = this.getChildren(sourceFile); if (children.length) { var child = ts.find(children, function (kid) { return kid.kind < 277 || kid.kind > 297 }); return child.kind < 145 ? child : child.getFirstToken(sourceFile) } }, NodeObject.prototype.getLastToken = function (sourceFile) { this.assertHasRealPosition(); var children = this.getChildren(sourceFile), child = ts.lastOrUndefined(children); if (child) return child.kind < 145 ? child : child.getLastToken(sourceFile) }, NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray) }, NodeObject }(), TokenOrIdentifierObject = function () { function TokenOrIdentifierObject(pos, end) { this.pos = pos, this.end = end, this.flags = 0, this.parent = void 0 } return TokenOrIdentifierObject.prototype.getSourceFile = function () { return ts.getSourceFileOfNode(this) }, TokenOrIdentifierObject.prototype.getStart = function (sourceFile, includeJsDocComment) { return ts.getTokenPosOfNode(this, sourceFile, includeJsDocComment) }, TokenOrIdentifierObject.prototype.getFullStart = function () { return this.pos }, TokenOrIdentifierObject.prototype.getEnd = function () { return this.end }, TokenOrIdentifierObject.prototype.getWidth = function (sourceFile) { return this.getEnd() - this.getStart(sourceFile) }, TokenOrIdentifierObject.prototype.getFullWidth = function () { return this.end - this.pos }, TokenOrIdentifierObject.prototype.getLeadingTriviaWidth = function (sourceFile) { return this.getStart(sourceFile) - this.pos }, TokenOrIdentifierObject.prototype.getFullText = function (sourceFile) { return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end) }, TokenOrIdentifierObject.prototype.getText = function (sourceFile) { return sourceFile || (sourceFile = this.getSourceFile()), sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()) }, TokenOrIdentifierObject.prototype.getChildCount = function () { return 0 }, TokenOrIdentifierObject.prototype.getChildAt = function () { }, TokenOrIdentifierObject.prototype.getChildren = function () { return ts.emptyArray }, TokenOrIdentifierObject.prototype.getFirstToken = function () { }, TokenOrIdentifierObject.prototype.getLastToken = function () { }, TokenOrIdentifierObject.prototype.forEachChild = function () { }, TokenOrIdentifierObject }(), SymbolObject = function () { function SymbolObject(flags, name) { this.flags = flags, this.escapedName = name } return SymbolObject.prototype.getFlags = function () { return this.flags }, Object.defineProperty(SymbolObject.prototype, "name", { get: function () { return ts.symbolName(this) }, enumerable: !0, configurable: !0 }), SymbolObject.prototype.getEscapedName = function () { return this.escapedName }, SymbolObject.prototype.getName = function () { return this.name }, SymbolObject.prototype.getDeclarations = function () { return this.declarations }, SymbolObject.prototype.getDocumentationComment = function (checker) { return this.documentationComment || (this.documentationComment = ts.emptyArray, this.documentationComment = getDocumentationComment(this.declarations, checker)), this.documentationComment }, SymbolObject.prototype.getJsDocTags = function () { return void 0 === this.tags && (this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations)), this.tags }, SymbolObject }(), TokenObject = function (_super) { function TokenObject(kind, pos, end) { var _this = _super.call(this, pos, end) || this; return _this.kind = kind, _this } return __extends(TokenObject, _super), TokenObject }(TokenOrIdentifierObject), IdentifierObject = function (_super) { function IdentifierObject(_kind, pos, end) { return _super.call(this, pos, end) || this } return __extends(IdentifierObject, _super), Object.defineProperty(IdentifierObject.prototype, "text", { get: function () { return ts.idText(this) }, enumerable: !0, configurable: !0 }), IdentifierObject }(TokenOrIdentifierObject); IdentifierObject.prototype.kind = 71; var TypeObject = function () { function TypeObject(checker, flags) { this.checker = checker, this.flags = flags } return TypeObject.prototype.getFlags = function () { return this.flags }, TypeObject.prototype.getSymbol = function () { return this.symbol }, TypeObject.prototype.getProperties = function () { return this.checker.getPropertiesOfType(this) }, TypeObject.prototype.getProperty = function (propertyName) { return this.checker.getPropertyOfType(this, propertyName) }, TypeObject.prototype.getApparentProperties = function () { return this.checker.getAugmentedPropertiesOfType(this) }, TypeObject.prototype.getCallSignatures = function () { return this.checker.getSignaturesOfType(this, 0) }, TypeObject.prototype.getConstructSignatures = function () { return this.checker.getSignaturesOfType(this, 1) }, TypeObject.prototype.getStringIndexType = function () { return this.checker.getIndexTypeOfType(this, 0) }, TypeObject.prototype.getNumberIndexType = function () { return this.checker.getIndexTypeOfType(this, 1) }, TypeObject.prototype.getBaseTypes = function () { return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : void 0 }, TypeObject.prototype.getNonNullableType = function () { return this.checker.getNonNullableType(this) }, TypeObject.prototype.getConstraint = function () { return this.checker.getBaseConstraintOfType(this) }, TypeObject.prototype.getDefault = function () { return this.checker.getDefaultFromTypeParameter(this) }, TypeObject.prototype.isUnion = function () { return !!(131072 & this.flags) }, TypeObject.prototype.isIntersection = function () { return !!(262144 & this.flags) }, TypeObject.prototype.isUnionOrIntersection = function () { return !!(393216 & this.flags) }, TypeObject.prototype.isLiteral = function () { return !!(224 & this.flags) }, TypeObject.prototype.isStringLiteral = function () { return !!(32 & this.flags) }, TypeObject.prototype.isNumberLiteral = function () { return !!(64 & this.flags) }, TypeObject.prototype.isTypeParameter = function () { return !!(32768 & this.flags) }, TypeObject.prototype.isClassOrInterface = function () { return !!(3 & ts.getObjectFlags(this)) }, TypeObject.prototype.isClass = function () { return !!(1 & ts.getObjectFlags(this)) }, TypeObject }(), SignatureObject = function () { function SignatureObject(checker) { this.checker = checker } return SignatureObject.prototype.getDeclaration = function () { return this.declaration }, SignatureObject.prototype.getTypeParameters = function () { return this.typeParameters }, SignatureObject.prototype.getParameters = function () { return this.parameters }, SignatureObject.prototype.getReturnType = function () { return this.checker.getReturnTypeOfSignature(this) }, SignatureObject.prototype.getDocumentationComment = function () { return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker)) }, SignatureObject.prototype.getJsDocTags = function () { return void 0 === this.jsDocTags && (this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : []), this.jsDocTags }, SignatureObject }(), SourceFileObject = function (_super) { function SourceFileObject(kind, pos, end) { return _super.call(this, kind, pos, end) || this } return __extends(SourceFileObject, _super), SourceFileObject.prototype.update = function (newText, textChangeRange) { return ts.updateSourceFile(this, newText, textChangeRange) }, SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) { return ts.getLineAndCharacterOfPosition(this, position) }, SourceFileObject.prototype.getLineStarts = function () { return ts.getLineStarts(this) }, SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { return ts.getPositionOfLineAndCharacter(this, line, character) }, SourceFileObject.prototype.getLineEndOfPosition = function (pos) { var lastCharPos, line = this.getLineAndCharacterOfPosition(pos).line, lineStarts = this.getLineStarts(); line + 1 >= lineStarts.length && (lastCharPos = this.getEnd()), lastCharPos || (lastCharPos = lineStarts[line + 1] - 1); var fullText = this.getFullText(); return "\n" === fullText[lastCharPos] && "\r" === fullText[lastCharPos - 1] ? lastCharPos - 1 : lastCharPos }, SourceFileObject.prototype.getNamedDeclarations = function () { return this.namedDeclarations || (this.namedDeclarations = this.computeNamedDeclarations()), this.namedDeclarations }, SourceFileObject.prototype.computeNamedDeclarations = function () { function addDeclaration(declaration) { var name = getDeclarationName(declaration); name && result.add(name, declaration) } function getDeclarations(name) { var declarations = result.get(name); return declarations || result.set(name, declarations = []), declarations } function getDeclarationName(declaration) { var name = ts.getNameOfDeclaration(declaration); return name && (ts.isComputedPropertyName(name) && ts.isPropertyAccessExpression(name.expression) ? name.expression.name.text : ts.isPropertyName(name) ? ts.getNameFromPropertyName(name) : void 0) } function visit(node) { switch (node.kind) { case 233: case 191: case 153: case 152: var functionDeclaration = node, declarationName = getDeclarationName(functionDeclaration); if (declarationName) { var declarations = getDeclarations(declarationName), lastDeclaration = ts.lastOrUndefined(declarations); lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol ? functionDeclaration.body && !lastDeclaration.body && (declarations[declarations.length - 1] = functionDeclaration) : declarations.push(functionDeclaration) } ts.forEachChild(node, visit); break; case 234: case 204: case 235: case 236: case 237: case 238: case 242: case 251: case 247: case 244: case 245: case 155: case 156: case 165: addDeclaration(node), ts.forEachChild(node, visit); break; case 148: if (!ts.hasModifier(node, 92)) break; case 231: case 181: var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); break } decl.initializer && visit(decl.initializer); case 272: case 151: case 150: addDeclaration(node); break; case 249: node.exportClause && ts.forEach(node.exportClause.elements, visit); break; case 243: var importClause = node.importClause; importClause && (importClause.name && addDeclaration(importClause), importClause.namedBindings && (245 === importClause.namedBindings.kind ? addDeclaration(importClause.namedBindings) : ts.forEach(importClause.namedBindings.elements, visit))); break; case 199: 0 !== ts.getSpecialPropertyAssignmentKind(node) && addDeclaration(node); default: ts.forEachChild(node, visit) } } var result = ts.createMultiMap(); return ts.forEachChild(this, visit), result }, SourceFileObject }(NodeObject), SourceMapSourceObject = function () { function SourceMapSourceObject(fileName, text, skipTrivia) { this.fileName = fileName, this.text = text, this.skipTrivia = skipTrivia } return SourceMapSourceObject.prototype.getLineAndCharacterOfPosition = function (pos) { return ts.getLineAndCharacterOfPosition(this, pos) }, SourceMapSourceObject }(); ts.toEditorSettings = toEditorSettings, ts.displayPartsToString = displayPartsToString, ts.getDefaultCompilerOptions = getDefaultCompilerOptions, ts.getSupportedCodeFixes = getSupportedCodeFixes; var HostCache = function () { function HostCache(host, getCanonicalFileName) { this.host = host, this.currentDirectory = host.getCurrentDirectory(), this.fileNameToEntry = ts.createMap(); for (var rootFileNames = host.getScriptFileNames(), _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) { var fileName = rootFileNames_1[_i]; this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName)) } this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions() } return HostCache.prototype.compilationSettings = function () { return this._compilationSettings }, HostCache.prototype.getProjectReferences = function () { return this.host.getProjectReferences && this.host.getProjectReferences() }, HostCache.prototype.createEntry = function (fileName, path) { var entry, scriptSnapshot = this.host.getScriptSnapshot(fileName); return entry = scriptSnapshot ? { hostFileName: fileName, version: this.host.getScriptVersion(fileName), scriptSnapshot: scriptSnapshot, scriptKind: ts.getScriptKind(fileName, this.host) } : fileName, this.fileNameToEntry.set(path, entry), entry }, HostCache.prototype.getEntryByPath = function (path) { return this.fileNameToEntry.get(path) }, HostCache.prototype.getHostFileInformation = function (path) { var entry = this.fileNameToEntry.get(path); return ts.isString(entry) ? void 0 : entry }, HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) { var info = this.getEntryByPath(path) || this.createEntry(fileName, path); return ts.isString(info) ? void 0 : info }, HostCache.prototype.getRootFileNames = function () { var names = []; return this.fileNameToEntry.forEach(function (entry) { ts.isString(entry) ? names.push(entry) : 6 !== entry.scriptKind && names.push(entry.hostFileName) }), names }, HostCache.prototype.getVersion = function (path) { var file = this.getHostFileInformation(path); return file && file.version }, HostCache.prototype.getScriptSnapshot = function (path) { var file = this.getHostFileInformation(path); return file && file.scriptSnapshot }, HostCache }(), SyntaxTreeCache = function () { function SyntaxTreeCache(host) { this.host = host } return SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) { var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (!scriptSnapshot) throw new Error("Could not find file: '" + fileName + "'."); var sourceFile, scriptKind = ts.getScriptKind(fileName, this.host), version = this.host.getScriptVersion(fileName); if (this.currentFileName !== fileName) sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 6, version, !0, scriptKind); else if (this.currentFileVersion !== version) { var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange) } return sourceFile && (this.currentFileVersion = version, this.currentFileName = fileName, this.currentFileScriptSnapshot = scriptSnapshot, this.currentSourceFile = sourceFile), this.currentSourceFile }, SyntaxTreeCache }(); ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile, ts.disableIncrementalParsing = !1, ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; var CancellationTokenObject = function () { function CancellationTokenObject(cancellationToken) { this.cancellationToken = cancellationToken } return CancellationTokenObject.prototype.isCancellationRequested = function () { return this.cancellationToken && this.cancellationToken.isCancellationRequested() }, CancellationTokenObject.prototype.throwIfCancellationRequested = function () { if (this.isCancellationRequested()) throw new ts.OperationCanceledException }, CancellationTokenObject }(), ThrottledCancellationToken = function () { function ThrottledCancellationToken(hostCancellationToken, throttleWaitMilliseconds) { void 0 === throttleWaitMilliseconds && (throttleWaitMilliseconds = 20), this.hostCancellationToken = hostCancellationToken, this.throttleWaitMilliseconds = throttleWaitMilliseconds, this.lastCancellationCheckTime = 0 } return ThrottledCancellationToken.prototype.isCancellationRequested = function () { var time = ts.timestamp(), duration = Math.abs(time - this.lastCancellationCheckTime); return duration >= this.throttleWaitMilliseconds && (this.lastCancellationCheckTime = time, this.hostCancellationToken.isCancellationRequested()) }, ThrottledCancellationToken.prototype.throwIfCancellationRequested = function () { if (this.isCancellationRequested()) throw new ts.OperationCanceledException }, ThrottledCancellationToken }(); ts.ThrottledCancellationToken = ThrottledCancellationToken, ts.createSourceFileLikeCache = createSourceFileLikeCache, ts.createLanguageService = createLanguageService, ts.getNameTable = getNameTable, ts.getContainingObjectLiteralElement = getContainingObjectLiteralElement, ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType, ts.getPropertySymbolsFromType = getPropertySymbolsFromType, ts.getDefaultLibFilePath = getDefaultLibFilePath, ts.objectAllocator = getServicesObjectAllocator() }(ts || (ts = {})); var ts; !function (ts) { var BreakpointResolver; !function (BreakpointResolver) { function spanInSourceFileAtLocation(sourceFile, position) { function textSpan(startNode, endNode) { var start = startNode.decorators ? ts.skipTrivia(sourceFile.text, startNode.decorators.end) : startNode.getStart(sourceFile); return ts.createTextSpanFromBounds(start, (endNode || startNode).getEnd()) } function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) { return textSpan(startNode, ts.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent, sourceFile)) } function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { return spanInNode(node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line ? node : otherwiseOnNode) } function spanInNodeArray(nodeArray) { return ts.createTextSpanFromBounds(ts.skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end) } function spanInPreviousNode(node) { return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)) } function spanInNextNode(node) { return spanInNode(ts.findNextToken(node, node.parent, sourceFile)) } function spanInNode(node) { function textSpanFromVariableDeclaration(variableDeclaration) { return ts.isVariableDeclarationList(variableDeclaration.parent) && variableDeclaration.parent.declarations[0] === variableDeclaration ? textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration) : textSpan(variableDeclaration) } function spanInVariableDeclaration(variableDeclaration) { return 220 === variableDeclaration.parent.parent.kind ? spanInNode(variableDeclaration.parent.parent) : ts.isBindingPattern(variableDeclaration.name) ? spanInBindingPattern(variableDeclaration.name) : variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || 221 === variableDeclaration.parent.parent.kind ? textSpanFromVariableDeclaration(variableDeclaration) : ts.isVariableDeclarationList(variableDeclaration.parent) && variableDeclaration.parent.declarations[0] !== variableDeclaration ? spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)) : void 0 } function canHaveSpanInParameterDeclaration(parameter) { return !!parameter.initializer || void 0 !== parameter.dotDotDotToken || ts.hasModifier(parameter, 12) } function spanInParameterDeclaration(parameter) { if (ts.isBindingPattern(parameter.name)) return spanInBindingPattern(parameter.name); if (canHaveSpanInParameterDeclaration(parameter)) return textSpan(parameter); var functionDeclaration = parameter.parent, indexOfParameter = functionDeclaration.parameters.indexOf(parameter); return ts.Debug.assert(indexOfParameter !== -1), 0 !== indexOfParameter ? spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]) : spanInNode(functionDeclaration.body) } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || 234 === functionDeclaration.parent.kind && 154 !== functionDeclaration.kind } function spanInFunctionDeclaration(functionDeclaration) { if (functionDeclaration.body) return canFunctionHaveSpanInWholeDeclaration(functionDeclaration) ? textSpan(functionDeclaration) : spanInNode(functionDeclaration.body) } function spanInFunctionBlock(block) { var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); return canFunctionHaveSpanInWholeDeclaration(block.parent) ? spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock) : spanInNode(nodeForSpanInBlock) } function spanInBlock(block) { switch (block.parent.kind) { case 238: if (1 !== ts.getModuleInstanceState(block.parent)) return; case 218: case 216: case 220: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 219: case 221: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]) }return spanInNode(block.statements[0]) } function spanInInitializerOfForLike(forLikeStatement) { if (232 !== forLikeStatement.initializer.kind) return spanInNode(forLikeStatement.initializer); var variableDeclarationList = forLikeStatement.initializer; return variableDeclarationList.declarations.length > 0 ? spanInNode(variableDeclarationList.declarations[0]) : void 0 } function spanInForStatement(forStatement) { return forStatement.initializer ? spanInInitializerOfForLike(forStatement) : forStatement.condition ? textSpan(forStatement.condition) : forStatement.incrementor ? textSpan(forStatement.incrementor) : void 0 } function spanInBindingPattern(bindingPattern) { var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return 205 !== element.kind ? element : void 0 }); return firstBindingElement ? spanInNode(firstBindingElement) : 181 === bindingPattern.parent.kind ? textSpan(bindingPattern.parent) : textSpanFromVariableDeclaration(bindingPattern.parent) } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { ts.Debug.assert(180 !== node.kind && 179 !== node.kind); var elements = 182 === node.kind ? node.elements : node.properties, firstBindingElement = ts.forEach(elements, function (element) { return 205 !== element.kind ? element : void 0 }); return firstBindingElement ? spanInNode(firstBindingElement) : textSpan(199 === node.parent.kind ? node.parent : node) } function spanInOpenBraceToken(node) { switch (node.parent.kind) { case 237: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); case 234: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); case 240: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]) }return spanInNode(node.parent) } function spanInCloseBraceToken(node) { switch (node.parent.kind) { case 239: if (1 !== ts.getModuleInstanceState(node.parent.parent)) return; case 237: case 234: return textSpan(node); case 212: if (ts.isFunctionBlock(node.parent)) return textSpan(node); case 268: return spanInNode(ts.lastOrUndefined(node.parent.statements)); case 240: var caseBlock = node.parent, lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) return spanInNode(ts.lastOrUndefined(lastClause.statements)); return; case 179: var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { var objectLiteral = node.parent; return textSpan(ts.lastOrUndefined(objectLiteral.properties) || objectLiteral) } return spanInNode(node.parent) } } function spanInCloseBracketToken(node) { switch (node.parent.kind) { case 180: var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { var arrayLiteral = node.parent; return textSpan(ts.lastOrUndefined(arrayLiteral.elements) || arrayLiteral) } return spanInNode(node.parent) } } function spanInOpenParenToken(node) { return 217 === node.parent.kind || 186 === node.parent.kind || 187 === node.parent.kind ? spanInPreviousNode(node) : 190 === node.parent.kind ? spanInNextNode(node) : spanInNode(node.parent) } function spanInCloseParenToken(node) { switch (node.parent.kind) { case 191: case 233: case 192: case 153: case 152: case 155: case 156: case 154: case 218: case 217: case 219: case 221: case 186: case 187: case 190: return spanInPreviousNode(node); default: return spanInNode(node.parent) } } function spanInColonToken(node) { return ts.isFunctionLike(node.parent) || 269 === node.parent.kind || 148 === node.parent.kind ? spanInPreviousNode(node) : spanInNode(node.parent) } function spanInGreaterThanOrLessThanToken(node) { return 189 === node.parent.kind ? spanInNextNode(node) : spanInNode(node.parent) } function spanInWhileKeyword(node) { return 217 === node.parent.kind ? textSpanEndingAtNextToken(node, node.parent.expression) : spanInNode(node.parent) } function spanInOfKeyword(node) { return 221 === node.parent.kind ? spanInNextNode(node) : spanInNode(node.parent) } if (node) switch (node.kind) { case 213: return spanInVariableDeclaration(node.declarationList.declarations[0]); case 231: case 151: case 150: return spanInVariableDeclaration(node); case 148: return spanInParameterDeclaration(node); case 233: case 153: case 152: case 155: case 156: case 154: case 191: case 192: return spanInFunctionDeclaration(node); case 212: if (ts.isFunctionBlock(node)) return spanInFunctionBlock(node); case 239: return spanInBlock(node); case 268: return spanInBlock(node.block); case 215: return textSpan(node.expression); case 224: return textSpan(node.getChildAt(0), node.expression); case 218: return textSpanEndingAtNextToken(node, node.expression); case 217: return spanInNode(node.statement); case 230: return textSpan(node.getChildAt(0)); case 216: return textSpanEndingAtNextToken(node, node.expression); case 227: return spanInNode(node.statement); case 223: case 222: return textSpan(node.getChildAt(0), node.label); case 219: return spanInForStatement(node); case 220: return textSpanEndingAtNextToken(node, node.expression); case 221: return spanInInitializerOfForLike(node); case 226: return textSpanEndingAtNextToken(node, node.expression); case 265: case 266: return spanInNode(node.statements[0]); case 229: return spanInBlock(node.tryBlock); case 228: return textSpan(node, node.expression); case 248: return textSpan(node, node.expression); case 242: return textSpan(node, node.moduleReference); case 243: return textSpan(node, node.moduleSpecifier); case 249: return textSpan(node, node.moduleSpecifier); case 238: if (1 !== ts.getModuleInstanceState(node)) return; case 234: case 237: case 272: case 181: return textSpan(node); case 225: return spanInNode(node.statement); case 149: return spanInNodeArray(node.parent.decorators); case 179: case 180: return spanInBindingPattern(node); case 235: case 236: return; case 25: case 1: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); case 26: return spanInPreviousNode(node); case 17: return spanInOpenBraceToken(node); case 18: return spanInCloseBraceToken(node); case 22: return spanInCloseBracketToken(node); case 19: return spanInOpenParenToken(node); case 20: return spanInCloseParenToken(node); case 56: return spanInColonToken(node); case 29: case 27: return spanInGreaterThanOrLessThanToken(node); case 106: return spanInWhileKeyword(node); case 82: case 74: case 87: return spanInNextNode(node); case 144: return spanInOfKeyword(node); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); if ((71 === node.kind || 203 === node.kind || 269 === node.kind || 270 === node.kind) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) return textSpan(node); if (199 === node.kind) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left); if (58 === operatorToken.kind && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) return textSpan(node); if (26 === operatorToken.kind) return spanInNode(left) } if (ts.isExpressionNode(node)) switch (node.parent.kind) { case 217: return spanInPreviousNode(node); case 149: return spanInNode(node.parent); case 219: case 221: return textSpan(node); case 199: if (26 === node.parent.operatorToken.kind) return textSpan(node); break; case 192: if (node.parent.body === node) return textSpan(node) }switch (node.parent.kind) { case 269: if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) return spanInNode(node.parent.initializer); break; case 189: if (node.parent.type === node) return spanInNextNode(node.parent.type); break; case 231: case 148: var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) return spanInPreviousNode(node); break; case 199: var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) return spanInPreviousNode(node); break; default: if (ts.isFunctionLike(node.parent) && node.parent.type === node) return spanInPreviousNode(node) }return spanInNode(node.parent) } } if (!sourceFile.isDeclarationFile) { var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position, !1), lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if ((!(sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) || (tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile), tokenAtLocation && sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line === lineOfPosition)) && !(4194304 & tokenAtLocation.flags)) return spanInNode(tokenAtLocation) } } BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation }(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})) }(ts || (ts = {})); var ts; !function (ts) { function transform(source, transformers, compilerOptions) { var diagnostics = []; compilerOptions = ts.fixupCompilerOptions(compilerOptions, diagnostics); var nodes = ts.isArray(source) ? source : [source], result = ts.transformNodes(void 0, void 0, compilerOptions, nodes, transformers, !0); return result.diagnostics = ts.concatenate(result.diagnostics, diagnostics), result } ts.transform = transform }(ts || (ts = {})); var ts, debugObjectHost = function () { return this }(); !function (ts) { function logInternalError(logger, err) { logger && logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message) } function simpleForwardCall(logger, actionDescription, action, logPerformance) { var start; logPerformance && (logger.log(actionDescription), start = ts.timestamp()); var result = action(); if (logPerformance) { var end = ts.timestamp(); if (logger.log(actionDescription + " completed in " + (end - start) + " msec"), ts.isString(result)) { var str = result; str.length > 128 && (str = str.substring(0, 128) + "..."), logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'") } } return result } function forwardJSONCall(logger, actionDescription, action, logPerformance) { return forwardCall(logger, actionDescription, !0, action, logPerformance); } function forwardCall(logger, actionDescription, returnJson, action, logPerformance) { try { var result = simpleForwardCall(logger, actionDescription, action, logPerformance); return returnJson ? JSON.stringify({ result: result }) : result } catch (err) { return err instanceof ts.OperationCanceledException ? JSON.stringify({ canceled: !0 }) : (logInternalError(logger, err), err.description = actionDescription, JSON.stringify({ error: err })) } } function realizeDiagnostics(diagnostics, newLine) { return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine) }) } function realizeDiagnostic(diagnostic, newLine) { return { message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), start: diagnostic.start, length: diagnostic.length, category: ts.diagnosticCategoryName(diagnostic), code: diagnostic.code, reportsUnnecessary: diagnostic.reportsUnnecessary } } function convertClassifications(classifications) { return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState } } var ScriptSnapshotShimAdapter = function () { function ScriptSnapshotShimAdapter(scriptSnapshotShim) { this.scriptSnapshotShim = scriptSnapshotShim } return ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { return this.scriptSnapshotShim.getText(start, end) }, ScriptSnapshotShimAdapter.prototype.getLength = function () { return this.scriptSnapshotShim.getLength() }, ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { var oldSnapshotShim = oldSnapshot, encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); if (null === encoded) return null; var decoded = JSON.parse(encoded); return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength) }, ScriptSnapshotShimAdapter.prototype.dispose = function () { "dispose" in this.scriptSnapshotShim && this.scriptSnapshotShim.dispose() }, ScriptSnapshotShimAdapter }(), LanguageServiceShimHostAdapter = function () { function LanguageServiceShimHostAdapter(shimHost) { var _this = this; this.shimHost = shimHost, this.loggingEnabled = !1, this.tracingEnabled = !1, "getModuleResolutionsForFile" in this.shimHost && (this.resolveModuleNames = function (moduleNames, containingFile) { var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); return ts.map(moduleNames, function (name) { var result = ts.getProperty(resolutionsInFile, name); return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: !1 } : void 0 }) }), "directoryExists" in this.shimHost && (this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName) }), "getTypeReferenceDirectiveResolutionsForFile" in this.shimHost && (this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); return ts.map(typeDirectiveNames, function (name) { return ts.getProperty(typeDirectivesForFile, name) }) }) } return LanguageServiceShimHostAdapter.prototype.log = function (s) { this.loggingEnabled && this.shimHost.log(s) }, LanguageServiceShimHostAdapter.prototype.trace = function (s) { this.tracingEnabled && this.shimHost.trace(s) }, LanguageServiceShimHostAdapter.prototype.error = function (s) { this.shimHost.error(s) }, LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { if (this.shimHost.getProjectVersion) return this.shimHost.getProjectVersion() }, LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () { return this.shimHost.getTypeRootsVersion ? this.shimHost.getTypeRootsVersion() : 0 }, LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () { return !!this.shimHost.useCaseSensitiveFileNames && this.shimHost.useCaseSensitiveFileNames() }, LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); if (null === settingsJson || "" === settingsJson) throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); var compilerOptions = JSON.parse(settingsJson); return compilerOptions.allowNonTsExtensions = !0, compilerOptions }, LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); return this.files = JSON.parse(encoded) }, LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot) }, LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) { return "getScriptKind" in this.shimHost ? this.shimHost.getScriptKind(fileName) : 0 }, LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { return this.shimHost.getScriptVersion(fileName) }, LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); if (null === diagnosticMessagesJson || "" === diagnosticMessagesJson) return null; try { return JSON.parse(diagnosticMessagesJson) } catch (e) { return this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"), null } }, LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { var hostCancellationToken = this.shimHost.getCancellationToken(); return new ts.ThrottledCancellationToken(hostCancellationToken) }, LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { return this.shimHost.getCurrentDirectory() }, LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) { return JSON.parse(this.shimHost.getDirectories(path)) }, LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { return this.shimHost.getDefaultLibFileName(JSON.stringify(options)) }, LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) { var pattern = ts.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)) }, LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) { return this.shimHost.readFile(path, encoding) }, LanguageServiceShimHostAdapter.prototype.fileExists = function (path) { return this.shimHost.fileExists(path) }, LanguageServiceShimHostAdapter }(); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; var CoreServicesShimHostAdapter = function () { function CoreServicesShimHostAdapter(shimHost) { var _this = this; this.shimHost = shimHost, this.useCaseSensitiveFileNames = !!this.shimHost.useCaseSensitiveFileNames && this.shimHost.useCaseSensitiveFileNames(), "directoryExists" in this.shimHost && (this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName) }), "realpath" in this.shimHost && (this.realpath = function (path) { return _this.shimHost.realpath(path) }) } return CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) { var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)) }, CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { return this.shimHost.fileExists(fileName) }, CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { return this.shimHost.readFile(fileName) }, CoreServicesShimHostAdapter.prototype.getDirectories = function (path) { return JSON.parse(this.shimHost.getDirectories(path)) }, CoreServicesShimHostAdapter }(); ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; var ShimBase = function () { function ShimBase(factory) { this.factory = factory, factory.registerShim(this) } return ShimBase.prototype.dispose = function (_dummy) { this.factory.unregisterShim(this) }, ShimBase }(); ts.realizeDiagnostics = realizeDiagnostics; var LanguageServiceShimObject = function (_super) { function LanguageServiceShimObject(factory, host, languageService) { var _this = _super.call(this, factory) || this; return _this.host = host, _this.languageService = languageService, _this.logPerformance = !1, _this.logger = _this.host, _this } return __extends(LanguageServiceShimObject, _super), LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance) }, LanguageServiceShimObject.prototype.dispose = function (dummy) { this.logger.log("dispose()"), this.languageService.dispose(), this.languageService = null, debugObjectHost && debugObjectHost.CollectGarbage && (debugObjectHost.CollectGarbage(), this.logger.log("CollectGarbage()")), this.logger = null, _super.prototype.dispose.call(this, dummy) }, LanguageServiceShimObject.prototype.refresh = function (throwOnError) { this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null }) }, LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { var _this = this; this.forwardJSONCall("cleanupSemanticCache()", function () { return _this.languageService.cleanupSemanticCache(), null }) }, LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { var newLine = ts.getNewLineOrDefaultFromHost(this.host); return realizeDiagnostics(diagnostics, newLine) }, LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { var _this = this; return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)) }) }, LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { var _this = this; return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)) }) }, LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { var _this = this; return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))) }) }, LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { var _this = this; return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))) }) }, LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { var _this = this; return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName); return _this.realizeDiagnostics(diagnostics) }) }, LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) { var _this = this; return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () { var diagnostics = _this.languageService.getSemanticDiagnostics(fileName); return _this.realizeDiagnostics(diagnostics) }) }, LanguageServiceShimObject.prototype.getSuggestionDiagnostics = function (fileName) { var _this = this; return this.forwardJSONCall("getSuggestionDiagnostics('" + fileName + "')", function () { return _this.realizeDiagnostics(_this.languageService.getSuggestionDiagnostics(fileName)) }) }, LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () { var _this = this; return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { var diagnostics = _this.languageService.getCompilerOptionsDiagnostics(); return _this.realizeDiagnostics(diagnostics) }) }, LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { var _this = this; return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos) }) }, LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { var _this = this; return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position) }) }, LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.getDefinitionAndBoundSpan = function (fileName, position) { var _this = this; return this.forwardJSONCall("getDefinitionAndBoundSpan('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAndBoundSpan(fileName, position) }) }, LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getImplementationAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getImplementationAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { var _this = this; return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position) }) }, LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { var _this = this; return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments) }) }, LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.isValidBraceCompletionAtPosition = function (fileName, position, openingBrace) { var _this = this; return this.forwardJSONCall("isValidBraceCompletionAtPosition('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace) }) }, LanguageServiceShimObject.prototype.getSpanOfEnclosingComment = function (fileName, position, onlyMultiLine) { var _this = this; return this.forwardJSONCall("getSpanOfEnclosingComment('" + fileName + "', " + position + ")", function () { return _this.languageService.getSpanOfEnclosingComment(fileName, position, onlyMultiLine) }) }, LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { var _this = this; return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () { var localOptions = JSON.parse(options); return _this.languageService.getIndentationAtPosition(fileName, position, localOptions) }) }, LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.findReferences = function (fileName, position) { var _this = this; return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position) }) }, LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)), normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName }) }) }, LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position, preferences) { var _this = this; return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ", " + preferences + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position, preferences) }) }, LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName, formatOptions, source, preferences) { var _this = this; return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { var localOptions = void 0 === formatOptions ? void 0 : JSON.parse(formatOptions); return _this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source, preferences) }) }, LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { var _this = this; return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { var localOptions = JSON.parse(options); return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions) }) }, LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { var _this = this; return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { var localOptions = JSON.parse(options); return _this.languageService.getFormattingEditsForDocument(fileName, localOptions) }) }, LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { var _this = this; return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { var localOptions = JSON.parse(options); return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions) }) }, LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { var _this = this; return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position) }) }, LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) { var _this = this; return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ", " + fileName + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName) }) }, LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { var _this = this; return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName) }) }, LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) { var _this = this; return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName) }) }, LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { var _this = this; return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName) }) }, LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { var _this = this; return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)) }) }, LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { var _this = this; return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName) }) }, LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) { var _this = this; return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", !1, function () { return _this.languageService.getEmitOutput(fileName) }, this.logPerformance) }, LanguageServiceShimObject }(ShimBase), ClassifierShimObject = function (_super) { function ClassifierShimObject(factory, logger) { var _this = _super.call(this, factory) || this; return _this.logger = logger, _this.logPerformance = !1, _this.classifier = ts.createClassifier(), _this } return __extends(ClassifierShimObject, _super), ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { var _this = this; return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)) }, this.logPerformance) }, ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { for (var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics), result = "", _i = 0, _a = classification.entries; _i < _a.length; _i++) { var item = _a[_i]; result += item.length + "\n", result += item.classification + "\n" } return result += classification.finalLexState }, ClassifierShimObject }(ShimBase), CoreServicesShimObject = function (_super) { function CoreServicesShimObject(factory, logger, host) { var _this = _super.call(this, factory) || this; return _this.logger = logger, _this.host = host, _this.logPerformance = !1, _this } return __extends(CoreServicesShimObject, _super), CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance) }, CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) { var _this = this; return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { var compilerOptions = JSON.parse(compilerOptionsJson), result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host), resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : void 0; return result.resolvedModule && ".ts" !== result.resolvedModule.extension && ".tsx" !== result.resolvedModule.extension && ".d.ts" !== result.resolvedModule.extension && (resolvedFileName = void 0), { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations } }) }, CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { var _this = this; return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { var compilerOptions = JSON.parse(compilerOptionsJson), result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); return { resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : void 0, primary: !result.resolvedTypeReferenceDirective || result.resolvedTypeReferenceDirective.primary, failedLookupLocations: result.failedLookupLocations } }) }, CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { var result = ts.preProcessFile(ts.getSnapshotText(sourceTextSnapshot), !0, !0); return { referencedFiles: _this.convertFileReferences(result.referencedFiles), importedFiles: _this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, isLibFile: result.isLibFile, typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) } }) }, CoreServicesShimObject.prototype.getAutomaticTypeDirectiveNames = function (compilerOptionsJson) { var _this = this; return this.forwardJSONCall("getAutomaticTypeDirectiveNames('" + compilerOptionsJson + "')", function () { var compilerOptions = JSON.parse(compilerOptionsJson); return ts.getAutomaticTypeDirectiveNames(compilerOptions, _this.host) }) }, CoreServicesShimObject.prototype.convertFileReferences = function (refs) { if (refs) { for (var result = [], _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { var ref = refs_2[_i]; result.push({ path: ts.normalizeSlashes(ref.fileName), position: ref.pos, length: ref.end - ref.pos }) } return result } }, CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { var result = ts.parseJsonText(fileName, ts.getSnapshotText(sourceTextSnapshot)), normalizedFileName = ts.normalizeSlashes(fileName), configFile = ts.parseJsonSourceFileConfigFileContent(result, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); return { options: configFile.options, typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, errors: realizeDiagnostics(result.parseDiagnostics.concat(configFile.errors), "\r\n") } }) }, CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions() }) }, CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { var _this = this, getCanonicalFileName = ts.createGetCanonicalFileName(!1); return this.forwardJSONCall("discoverTypings()", function () { var info = JSON.parse(discoverTypingsJson); return void 0 === _this.safeList && (_this.safeList = ts.JsTyping.loadSafeList(_this.host, ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName))), ts.JsTyping.discoverTypings(_this.host, function (msg) { return _this.logger.log(msg) }, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), _this.safeList, info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports, info.typesRegistry) }) }, CoreServicesShimObject }(ShimBase), TypeScriptServicesFactory = function () { function TypeScriptServicesFactory() { this._shims = [] } return TypeScriptServicesFactory.prototype.getServicesVersion = function () { return ts.servicesVersion }, TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { try { void 0 === this.documentRegistry && (this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory())); var hostAdapter = new LanguageServiceShimHostAdapter(host), languageService = ts.createLanguageService(hostAdapter, this.documentRegistry, !1); return new LanguageServiceShimObject(this, host, languageService) } catch (err) { throw logInternalError(host, err), err } }, TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { try { return new ClassifierShimObject(this, logger) } catch (err) { throw logInternalError(logger, err), err } }, TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) { try { var adapter = new CoreServicesShimHostAdapter(host); return new CoreServicesShimObject(this, host, adapter) } catch (err) { throw logInternalError(host, err), err } }, TypeScriptServicesFactory.prototype.close = function () { ts.clear(this._shims), this.documentRegistry = void 0 }, TypeScriptServicesFactory.prototype.registerShim = function (shim) { this._shims.push(shim) }, TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { for (var i = 0; i < this._shims.length; i++)if (this._shims[i] === shim) return void delete this._shims[i]; throw new Error("Invalid operation") }, TypeScriptServicesFactory }(); ts.TypeScriptServicesFactory = TypeScriptServicesFactory, "undefined" != typeof module && module.exports && (module.exports = ts) }(ts || (ts = {})); var TypeScript; !function (TypeScript) { var Services; !function (Services) { Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory }(Services = TypeScript.Services || (TypeScript.Services = {})) }(TypeScript || (TypeScript = {})); ts.versionMajorMinor }).call(exports, __webpack_require__(30), "/index.js", function () { return this }(), "/") }, function(module, exports) { }, function(module, exports) { }, function(module, exports) { }, function(module, exports, __webpack_require__) { (function (Buffer) { function error() { var m = [].slice.call(arguments).join(" "); throw new Error([m, "we accept pull requests", "http://github.com/dominictarr/crypto-browserify"].join("\n")) } function each(a, f) { for (var i in a) f(a[i], i) } var rng = __webpack_require__(122); exports.createHash = __webpack_require__(124), exports.createHmac = __webpack_require__(136), exports.randomBytes = function (size, callback) { if (!callback || !callback.call) return new Buffer(rng(size)); try { callback.call(this, void 0, new Buffer(rng(size))) } catch (err) { callback(err) } }, exports.getHashes = function () { return ["sha1", "sha256", "sha512", "md5", "rmd160"] }; var p = __webpack_require__(137)(exports); exports.pbkdf2 = p.pbkdf2, exports.pbkdf2Sync = p.pbkdf2Sync, __webpack_require__(139)(exports, module.exports), each(["createCredentials", "createSign", "createVerify", "createDiffieHellman"], function (name) { exports[name] = function () { error("sorry,", name, "is not implemented yet") } }) }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ "use strict"; function typedArraySupport() { try { var arr = new Uint8Array(1); return arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }, 42 === arr.foo() && "function" == typeof arr.subarray && 0 === arr.subarray(1, 1).byteLength } catch (e) { return !1 } } function kMaxLength() { return Buffer.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823 } function createBuffer(that, length) { if (kMaxLength() < length) throw new RangeError("Invalid typed array length"); return Buffer.TYPED_ARRAY_SUPPORT ? (that = new Uint8Array(length), that.__proto__ = Buffer.prototype) : (null === that && (that = new Buffer(length)), that.length = length), that } function Buffer(arg, encodingOrOffset, length) { if (!(Buffer.TYPED_ARRAY_SUPPORT || this instanceof Buffer)) return new Buffer(arg, encodingOrOffset, length); if ("number" == typeof arg) { if ("string" == typeof encodingOrOffset) throw new Error("If encoding is specified then the first argument must be a string"); return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) } function from(that, value, encodingOrOffset, length) { if ("number" == typeof value) throw new TypeError('"value" argument must not be a number'); return "undefined" != typeof ArrayBuffer && value instanceof ArrayBuffer ? fromArrayBuffer(that, value, encodingOrOffset, length) : "string" == typeof value ? fromString(that, value, encodingOrOffset) : fromObject(that, value) } function assertSize(size) { if ("number" != typeof size) throw new TypeError('"size" argument must be a number'); if (size < 0) throw new RangeError('"size" argument must not be negative') } function alloc(that, size, fill, encoding) { return assertSize(size), size <= 0 ? createBuffer(that, size) : void 0 !== fill ? "string" == typeof encoding ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill) : createBuffer(that, size) } function allocUnsafe(that, size) { if (assertSize(size), that = createBuffer(that, size < 0 ? 0 : 0 | checked(size)), !Buffer.TYPED_ARRAY_SUPPORT) for (var i = 0; i < size; ++i)that[i] = 0; return that } function fromString(that, string, encoding) { if ("string" == typeof encoding && "" !== encoding || (encoding = "utf8"), !Buffer.isEncoding(encoding)) throw new TypeError('"encoding" must be a valid string encoding'); var length = 0 | byteLength(string, encoding); that = createBuffer(that, length); var actual = that.write(string, encoding); return actual !== length && (that = that.slice(0, actual)), that } function fromArrayLike(that, array) { var length = array.length < 0 ? 0 : 0 | checked(array.length); that = createBuffer(that, length); for (var i = 0; i < length; i += 1)that[i] = 255 & array[i]; return that } function fromArrayBuffer(that, array, byteOffset, length) { if (array.byteLength, byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError("'offset' is out of bounds"); if (array.byteLength < byteOffset + (length || 0)) throw new RangeError("'length' is out of bounds"); return array = void 0 === byteOffset && void 0 === length ? new Uint8Array(array) : void 0 === length ? new Uint8Array(array, byteOffset) : new Uint8Array(array, byteOffset, length), Buffer.TYPED_ARRAY_SUPPORT ? (that = array, that.__proto__ = Buffer.prototype) : that = fromArrayLike(that, array), that } function fromObject(that, obj) { if (Buffer.isBuffer(obj)) { var len = 0 | checked(obj.length); return that = createBuffer(that, len), 0 === that.length ? that : (obj.copy(that, 0, 0, len), that) } if (obj) { if ("undefined" != typeof ArrayBuffer && obj.buffer instanceof ArrayBuffer || "length" in obj) return "number" != typeof obj.length || isnan(obj.length) ? createBuffer(that, 0) : fromArrayLike(that, obj); if ("Buffer" === obj.type && isArray(obj.data)) return fromArrayLike(that, obj.data) } throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.") } function checked(length) { if (length >= kMaxLength()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes"); return 0 | length } function SlowBuffer(length) { return +length != length && (length = 0), Buffer.alloc(+length) } function byteLength(string, encoding) { if (Buffer.isBuffer(string)) return string.length; if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) return string.byteLength; "string" != typeof string && (string = "" + string); var len = string.length; if (0 === len) return 0; for (var loweredCase = !1; ;)switch (encoding) { case "ascii": case "latin1": case "binary": return len; case "utf8": case "utf-8": case void 0: return utf8ToBytes(string).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return 2 * len; case "hex": return len >>> 1; case "base64": return base64ToBytes(string).length; default: if (loweredCase) return utf8ToBytes(string).length; encoding = ("" + encoding).toLowerCase(), loweredCase = !0 } } function slowToString(encoding, start, end) { var loweredCase = !1; if ((void 0 === start || start < 0) && (start = 0), start > this.length) return ""; if ((void 0 === end || end > this.length) && (end = this.length), end <= 0) return ""; if (end >>>= 0, start >>>= 0, end <= start) return ""; for (encoding || (encoding = "utf8"); ;)switch (encoding) { case "hex": return hexSlice(this, start, end); case "utf8": case "utf-8": return utf8Slice(this, start, end); case "ascii": return asciiSlice(this, start, end); case "latin1": case "binary": return latin1Slice(this, start, end); case "base64": return base64Slice(this, start, end); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return utf16leSlice(this, start, end); default: if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); encoding = (encoding + "").toLowerCase(), loweredCase = !0 } } function swap(b, n, m) { var i = b[n]; b[n] = b[m], b[m] = i } function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { if (0 === buffer.length) return -1; if ("string" == typeof byteOffset ? (encoding = byteOffset, byteOffset = 0) : byteOffset > 2147483647 ? byteOffset = 2147483647 : byteOffset < -2147483648 && (byteOffset = -2147483648), byteOffset = +byteOffset, isNaN(byteOffset) && (byteOffset = dir ? 0 : buffer.length - 1), byteOffset < 0 && (byteOffset = buffer.length + byteOffset), byteOffset >= buffer.length) { if (dir) return -1; byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (!dir) return -1; byteOffset = 0 } if ("string" == typeof val && (val = Buffer.from(val, encoding)), Buffer.isBuffer(val)) return 0 === val.length ? -1 : arrayIndexOf(buffer, val, byteOffset, encoding, dir); if ("number" == typeof val) return val &= 255, Buffer.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? dir ? Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) : Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) : arrayIndexOf(buffer, [val], byteOffset, encoding, dir); throw new TypeError("val must be string, number or Buffer") } function arrayIndexOf(arr, val, byteOffset, encoding, dir) { function read(buf, i) { return 1 === indexSize ? buf[i] : buf.readUInt16BE(i * indexSize) } var indexSize = 1, arrLength = arr.length, valLength = val.length; if (void 0 !== encoding && (encoding = String(encoding).toLowerCase(), "ucs2" === encoding || "ucs-2" === encoding || "utf16le" === encoding || "utf-16le" === encoding)) { if (arr.length < 2 || val.length < 2) return -1; indexSize = 2, arrLength /= 2, valLength /= 2, byteOffset /= 2 } var i; if (dir) { var foundIndex = -1; for (i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1 && (foundIndex = i), i - foundIndex + 1 === valLength) return foundIndex * indexSize } else foundIndex !== -1 && (i -= i - foundIndex), foundIndex = -1 } else for (byteOffset + valLength > arrLength && (byteOffset = arrLength - valLength), i = byteOffset; i >= 0; i--) { for (var found = !0, j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { found = !1; break } if (found) return i } return -1 } function hexWrite(buf, string, offset, length) { offset = Number(offset) || 0; var remaining = buf.length - offset; length ? (length = Number(length), length > remaining && (length = remaining)) : length = remaining; var strLen = string.length; if (strLen % 2 !== 0) throw new TypeError("Invalid hex string"); length > strLen / 2 && (length = strLen / 2); for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(2 * i, 2), 16); if (isNaN(parsed)) return i; buf[offset + i] = parsed } return i } function utf8Write(buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite(buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write(buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write(buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write(buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } function base64Slice(buf, start, end) { return 0 === start && end === buf.length ? base64.fromByteArray(buf) : base64.fromByteArray(buf.slice(start, end)) } function utf8Slice(buf, start, end) { end = Math.min(buf.length, end); for (var res = [], i = start; i < end;) { var firstByte = buf[i], codePoint = null, bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint; switch (bytesPerSequence) { case 1: firstByte < 128 && (codePoint = firstByte); break; case 2: secondByte = buf[i + 1], 128 === (192 & secondByte) && (tempCodePoint = (31 & firstByte) << 6 | 63 & secondByte, tempCodePoint > 127 && (codePoint = tempCodePoint)); break; case 3: secondByte = buf[i + 1], thirdByte = buf[i + 2], 128 === (192 & secondByte) && 128 === (192 & thirdByte) && (tempCodePoint = (15 & firstByte) << 12 | (63 & secondByte) << 6 | 63 & thirdByte, tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343) && (codePoint = tempCodePoint)); break; case 4: secondByte = buf[i + 1], thirdByte = buf[i + 2], fourthByte = buf[i + 3], 128 === (192 & secondByte) && 128 === (192 & thirdByte) && 128 === (192 & fourthByte) && (tempCodePoint = (15 & firstByte) << 18 | (63 & secondByte) << 12 | (63 & thirdByte) << 6 | 63 & fourthByte, tempCodePoint > 65535 && tempCodePoint < 1114112 && (codePoint = tempCodePoint)) } } null === codePoint ? (codePoint = 65533, bytesPerSequence = 1) : codePoint > 65535 && (codePoint -= 65536, res.push(codePoint >>> 10 & 1023 | 55296), codePoint = 56320 | 1023 & codePoint), res.push(codePoint), i += bytesPerSequence } return decodeCodePointsArray(res) } function decodeCodePointsArray(codePoints) { var len = codePoints.length; if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints); for (var res = "", i = 0; i < len;)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); return res } function asciiSlice(buf, start, end) { var ret = ""; end = Math.min(buf.length, end); for (var i = start; i < end; ++i)ret += String.fromCharCode(127 & buf[i]); return ret } function latin1Slice(buf, start, end) { var ret = ""; end = Math.min(buf.length, end); for (var i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); return ret } function hexSlice(buf, start, end) { var len = buf.length; (!start || start < 0) && (start = 0), (!end || end < 0 || end > len) && (end = len); for (var out = "", i = start; i < end; ++i)out += toHex(buf[i]); return out } function utf16leSlice(buf, start, end) { for (var bytes = buf.slice(start, end), res = "", i = 0; i < bytes.length; i += 2)res += String.fromCharCode(bytes[i] + 256 * bytes[i + 1]); return res } function checkOffset(offset, ext, length) { if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint"); if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length") } function checkInt(buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); if (offset + ext > buf.length) throw new RangeError("Index out of range") } function objectWriteUInt16(buf, value, offset, littleEndian) { value < 0 && (value = 65535 + value + 1); for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i)buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> 8 * (littleEndian ? i : 1 - i) } function objectWriteUInt32(buf, value, offset, littleEndian) { value < 0 && (value = 4294967295 + value + 1); for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i)buf[offset + i] = value >>> 8 * (littleEndian ? i : 3 - i) & 255 } function checkIEEE754(buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError("Index out of range"); if (offset < 0) throw new RangeError("Index out of range") } function writeFloat(buf, value, offset, littleEndian, noAssert) { return noAssert || checkIEEE754(buf, value, offset, 4, 3.4028234663852886e38, -3.4028234663852886e38), ieee754.write(buf, value, offset, littleEndian, 23, 4), offset + 4 } function writeDouble(buf, value, offset, littleEndian, noAssert) { return noAssert || checkIEEE754(buf, value, offset, 8, 1.7976931348623157e308, -1.7976931348623157e308), ieee754.write(buf, value, offset, littleEndian, 52, 8), offset + 8 } function base64clean(str) { if (str = stringtrim(str).replace(INVALID_BASE64_RE, ""), str.length < 2) return ""; for (; str.length % 4 !== 0;)str += "="; return str } function stringtrim(str) { return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "") } function toHex(n) { return n < 16 ? "0" + n.toString(16) : n.toString(16) } function utf8ToBytes(string, units) { units = units || 1 / 0; for (var codePoint, length = string.length, leadSurrogate = null, bytes = [], i = 0; i < length; ++i) { if (codePoint = string.charCodeAt(i), codePoint > 55295 && codePoint < 57344) { if (!leadSurrogate) { if (codePoint > 56319) { (units -= 3) > -1 && bytes.push(239, 191, 189); continue } if (i + 1 === length) { (units -= 3) > -1 && bytes.push(239, 191, 189); continue } leadSurrogate = codePoint; continue } if (codePoint < 56320) { (units -= 3) > -1 && bytes.push(239, 191, 189), leadSurrogate = codePoint; continue } codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536 } else leadSurrogate && (units -= 3) > -1 && bytes.push(239, 191, 189); if (leadSurrogate = null, codePoint < 128) { if ((units -= 1) < 0) break; bytes.push(codePoint) } else if (codePoint < 2048) { if ((units -= 2) < 0) break; bytes.push(codePoint >> 6 | 192, 63 & codePoint | 128) } else if (codePoint < 65536) { if ((units -= 3) < 0) break; bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, 63 & codePoint | 128) } else { if (!(codePoint < 1114112)) throw new Error("Invalid code point"); if ((units -= 4) < 0) break; bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, 63 & codePoint | 128) } } return bytes } function asciiToBytes(str) { for (var byteArray = [], i = 0; i < str.length; ++i)byteArray.push(255 & str.charCodeAt(i)); return byteArray } function utf16leToBytes(str, units) { for (var c, hi, lo, byteArray = [], i = 0; i < str.length && !((units -= 2) < 0); ++i)c = str.charCodeAt(i), hi = c >> 8, lo = c % 256, byteArray.push(lo), byteArray.push(hi); return byteArray } function base64ToBytes(str) { return base64.toByteArray(base64clean(str)) } function blitBuffer(src, dst, offset, length) { for (var i = 0; i < length && !(i + offset >= dst.length || i >= src.length); ++i)dst[i + offset] = src[i]; return i } function isnan(val) { return val !== val } var base64 = __webpack_require__(119), ieee754 = __webpack_require__(120), isArray = __webpack_require__(121); exports.Buffer = Buffer, exports.SlowBuffer = SlowBuffer, exports.INSPECT_MAX_BYTES = 50, Buffer.TYPED_ARRAY_SUPPORT = void 0 !== global.TYPED_ARRAY_SUPPORT ? global.TYPED_ARRAY_SUPPORT : typedArraySupport(), exports.kMaxLength = kMaxLength(), Buffer.poolSize = 8192, Buffer._augment = function (arr) { return arr.__proto__ = Buffer.prototype, arr }, Buffer.from = function (value, encodingOrOffset, length) { return from(null, value, encodingOrOffset, length) }, Buffer.TYPED_ARRAY_SUPPORT && (Buffer.prototype.__proto__ = Uint8Array.prototype, Buffer.__proto__ = Uint8Array, "undefined" != typeof Symbol && Symbol.species && Buffer[Symbol.species] === Buffer && Object.defineProperty(Buffer, Symbol.species, { value: null, configurable: !0 })), Buffer.alloc = function (size, fill, encoding) { return alloc(null, size, fill, encoding) }, Buffer.allocUnsafe = function (size) { return allocUnsafe(null, size) }, Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(null, size) }, Buffer.isBuffer = function (b) { return !(null == b || !b._isBuffer) }, Buffer.compare = function (a, b) { if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError("Arguments must be Buffers"); if (a === b) return 0; for (var x = a.length, y = b.length, i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { x = a[i], y = b[i]; break } return x < y ? -1 : y < x ? 1 : 0 }, Buffer.isEncoding = function (encoding) { switch (String(encoding).toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "latin1": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return !0; default: return !1 } }, Buffer.concat = function (list, length) { if (!isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); if (0 === list.length) return Buffer.alloc(0); var i; if (void 0 === length) for (length = 0, i = 0; i < list.length; ++i)length += list[i].length; var buffer = Buffer.allocUnsafe(length), pos = 0; for (i = 0; i < list.length; ++i) { var buf = list[i]; if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); buf.copy(buffer, pos), pos += buf.length } return buffer }, Buffer.byteLength = byteLength, Buffer.prototype._isBuffer = !0, Buffer.prototype.swap16 = function () { var len = this.length; if (len % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var i = 0; i < len; i += 2)swap(this, i, i + 1); return this }, Buffer.prototype.swap32 = function () { var len = this.length; if (len % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var i = 0; i < len; i += 4)swap(this, i, i + 3), swap(this, i + 1, i + 2); return this }, Buffer.prototype.swap64 = function () { var len = this.length; if (len % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var i = 0; i < len; i += 8)swap(this, i, i + 7), swap(this, i + 1, i + 6), swap(this, i + 2, i + 5), swap(this, i + 3, i + 4); return this }, Buffer.prototype.toString = function () { var length = 0 | this.length; return 0 === length ? "" : 0 === arguments.length ? utf8Slice(this, 0, length) : slowToString.apply(this, arguments) }, Buffer.prototype.equals = function (b) { if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); return this === b || 0 === Buffer.compare(this, b) }, Buffer.prototype.inspect = function () { var str = "", max = exports.INSPECT_MAX_BYTES; return this.length > 0 && (str = this.toString("hex", 0, max).match(/.{2}/g).join(" "), this.length > max && (str += " ... ")), "" }, Buffer.prototype.compare = function (target, start, end, thisStart, thisEnd) { if (!Buffer.isBuffer(target)) throw new TypeError("Argument must be a Buffer"); if (void 0 === start && (start = 0), void 0 === end && (end = target ? target.length : 0), void 0 === thisStart && (thisStart = 0), void 0 === thisEnd && (thisEnd = this.length), start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError("out of range index"); if (thisStart >= thisEnd && start >= end) return 0; if (thisStart >= thisEnd) return -1; if (start >= end) return 1; if (start >>>= 0, end >>>= 0, thisStart >>>= 0, thisEnd >>>= 0, this === target) return 0; for (var x = thisEnd - thisStart, y = end - start, len = Math.min(x, y), thisCopy = this.slice(thisStart, thisEnd), targetCopy = target.slice(start, end), i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i], y = targetCopy[i]; break } return x < y ? -1 : y < x ? 1 : 0 }, Buffer.prototype.includes = function (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 }, Buffer.prototype.indexOf = function (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, !0) }, Buffer.prototype.lastIndexOf = function (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, !1) }, Buffer.prototype.write = function (string, offset, length, encoding) { if (void 0 === offset) encoding = "utf8", length = this.length, offset = 0; else if (void 0 === length && "string" == typeof offset) encoding = offset, length = this.length, offset = 0; else { if (!isFinite(offset)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); offset |= 0, isFinite(length) ? (length |= 0, void 0 === encoding && (encoding = "utf8")) : (encoding = length, length = void 0) } var remaining = this.length - offset; if ((void 0 === length || length > remaining) && (length = remaining), string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError("Attempt to write outside buffer bounds"); encoding || (encoding = "utf8"); for (var loweredCase = !1; ;)switch (encoding) { case "hex": return hexWrite(this, string, offset, length); case "utf8": case "utf-8": return utf8Write(this, string, offset, length); case "ascii": return asciiWrite(this, string, offset, length); case "latin1": case "binary": return latin1Write(this, string, offset, length); case "base64": return base64Write(this, string, offset, length); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return ucs2Write(this, string, offset, length); default: if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); encoding = ("" + encoding).toLowerCase(), loweredCase = !0 } }, Buffer.prototype.toJSON = function () { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) } }; var MAX_ARGUMENTS_LENGTH = 4096; Buffer.prototype.slice = function (start, end) { var len = this.length; start = ~~start, end = void 0 === end ? len : ~~end, start < 0 ? (start += len, start < 0 && (start = 0)) : start > len && (start = len), end < 0 ? (end += len, end < 0 && (end = 0)) : end > len && (end = len), end < start && (end = start); var newBuf; if (Buffer.TYPED_ARRAY_SUPPORT) newBuf = this.subarray(start, end), newBuf.__proto__ = Buffer.prototype; else { var sliceLen = end - start; newBuf = new Buffer(sliceLen, void 0); for (var i = 0; i < sliceLen; ++i)newBuf[i] = this[i + start] } return newBuf }, Buffer.prototype.readUIntLE = function (offset, byteLength, noAssert) { offset |= 0, byteLength |= 0, noAssert || checkOffset(offset, byteLength, this.length); for (var val = this[offset], mul = 1, i = 0; ++i < byteLength && (mul *= 256);)val += this[offset + i] * mul; return val }, Buffer.prototype.readUIntBE = function (offset, byteLength, noAssert) { offset |= 0, byteLength |= 0, noAssert || checkOffset(offset, byteLength, this.length); for (var val = this[offset + --byteLength], mul = 1; byteLength > 0 && (mul *= 256);)val += this[offset + --byteLength] * mul; return val }, Buffer.prototype.readUInt8 = function (offset, noAssert) { return noAssert || checkOffset(offset, 1, this.length), this[offset] }, Buffer.prototype.readUInt16LE = function (offset, noAssert) { return noAssert || checkOffset(offset, 2, this.length), this[offset] | this[offset + 1] << 8 }, Buffer.prototype.readUInt16BE = function (offset, noAssert) { return noAssert || checkOffset(offset, 2, this.length), this[offset] << 8 | this[offset + 1] }, Buffer.prototype.readUInt32LE = function (offset, noAssert) { return noAssert || checkOffset(offset, 4, this.length), (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + 16777216 * this[offset + 3] }, Buffer.prototype.readUInt32BE = function (offset, noAssert) { return noAssert || checkOffset(offset, 4, this.length), 16777216 * this[offset] + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]) }, Buffer.prototype.readIntLE = function (offset, byteLength, noAssert) { offset |= 0, byteLength |= 0, noAssert || checkOffset(offset, byteLength, this.length); for (var val = this[offset], mul = 1, i = 0; ++i < byteLength && (mul *= 256);)val += this[offset + i] * mul; return mul *= 128, val >= mul && (val -= Math.pow(2, 8 * byteLength)), val }, Buffer.prototype.readIntBE = function (offset, byteLength, noAssert) { offset |= 0, byteLength |= 0, noAssert || checkOffset(offset, byteLength, this.length); for (var i = byteLength, mul = 1, val = this[offset + --i]; i > 0 && (mul *= 256);)val += this[offset + --i] * mul; return mul *= 128, val >= mul && (val -= Math.pow(2, 8 * byteLength)), val }, Buffer.prototype.readInt8 = function (offset, noAssert) { return noAssert || checkOffset(offset, 1, this.length), 128 & this[offset] ? (255 - this[offset] + 1) * -1 : this[offset] }, Buffer.prototype.readInt16LE = function (offset, noAssert) { noAssert || checkOffset(offset, 2, this.length); var val = this[offset] | this[offset + 1] << 8; return 32768 & val ? 4294901760 | val : val }, Buffer.prototype.readInt16BE = function (offset, noAssert) { noAssert || checkOffset(offset, 2, this.length); var val = this[offset + 1] | this[offset] << 8; return 32768 & val ? 4294901760 | val : val }, Buffer.prototype.readInt32LE = function (offset, noAssert) { return noAssert || checkOffset(offset, 4, this.length), this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24 }, Buffer.prototype.readInt32BE = function (offset, noAssert) { return noAssert || checkOffset(offset, 4, this.length), this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3] }, Buffer.prototype.readFloatLE = function (offset, noAssert) { return noAssert || checkOffset(offset, 4, this.length), ieee754.read(this, offset, !0, 23, 4) }, Buffer.prototype.readFloatBE = function (offset, noAssert) { return noAssert || checkOffset(offset, 4, this.length), ieee754.read(this, offset, !1, 23, 4) }, Buffer.prototype.readDoubleLE = function (offset, noAssert) { return noAssert || checkOffset(offset, 8, this.length), ieee754.read(this, offset, !0, 52, 8) }, Buffer.prototype.readDoubleBE = function (offset, noAssert) { return noAssert || checkOffset(offset, 8, this.length), ieee754.read(this, offset, !1, 52, 8) }, Buffer.prototype.writeUIntLE = function (value, offset, byteLength, noAssert) { if (value = +value, offset |= 0, byteLength |= 0, !noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1; checkInt(this, value, offset, byteLength, maxBytes, 0) } var mul = 1, i = 0; for (this[offset] = 255 & value; ++i < byteLength && (mul *= 256);)this[offset + i] = value / mul & 255; return offset + byteLength }, Buffer.prototype.writeUIntBE = function (value, offset, byteLength, noAssert) { if (value = +value, offset |= 0, byteLength |= 0, !noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1; checkInt(this, value, offset, byteLength, maxBytes, 0) } var i = byteLength - 1, mul = 1; for (this[offset + i] = 255 & value; --i >= 0 && (mul *= 256);)this[offset + i] = value / mul & 255; return offset + byteLength }, Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 1, 255, 0), Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)), this[offset] = 255 & value, offset + 1 }, Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, !0), offset + 2 }, Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8, this[offset + 1] = 255 & value) : objectWriteUInt16(this, value, offset, !1), offset + 2 }, Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset + 3] = value >>> 24, this[offset + 2] = value >>> 16, this[offset + 1] = value >>> 8, this[offset] = 255 & value) : objectWriteUInt32(this, value, offset, !0), offset + 4 }, Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24, this[offset + 1] = value >>> 16, this[offset + 2] = value >>> 8, this[offset + 3] = 255 & value) : objectWriteUInt32(this, value, offset, !1), offset + 4 }, Buffer.prototype.writeIntLE = function (value, offset, byteLength, noAssert) { if (value = +value, offset |= 0, !noAssert) { var limit = Math.pow(2, 8 * byteLength - 1); checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0, mul = 1, sub = 0; for (this[offset] = 255 & value; ++i < byteLength && (mul *= 256);)value < 0 && 0 === sub && 0 !== this[offset + i - 1] && (sub = 1), this[offset + i] = (value / mul >> 0) - sub & 255; return offset + byteLength }, Buffer.prototype.writeIntBE = function (value, offset, byteLength, noAssert) { if (value = +value, offset |= 0, !noAssert) { var limit = Math.pow(2, 8 * byteLength - 1); checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1, mul = 1, sub = 0; for (this[offset + i] = 255 & value; --i >= 0 && (mul *= 256);)value < 0 && 0 === sub && 0 !== this[offset + i + 1] && (sub = 1), this[offset + i] = (value / mul >> 0) - sub & 255; return offset + byteLength }, Buffer.prototype.writeInt8 = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 1, 127, -128), Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)), value < 0 && (value = 255 + value + 1), this[offset] = 255 & value, offset + 1 }, Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, !0), offset + 2 }, Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8, this[offset + 1] = 255 & value) : objectWriteUInt16(this, value, offset, !1), offset + 2 }, Buffer.prototype.writeInt32LE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8, this[offset + 2] = value >>> 16, this[offset + 3] = value >>> 24) : objectWriteUInt32(this, value, offset, !0), offset + 4 }, Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { return value = +value, offset |= 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), value < 0 && (value = 4294967295 + value + 1), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24, this[offset + 1] = value >>> 16, this[offset + 2] = value >>> 8, this[offset + 3] = 255 & value) : objectWriteUInt32(this, value, offset, !1), offset + 4 }, Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { return writeFloat(this, value, offset, !0, noAssert) }, Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { return writeFloat(this, value, offset, !1, noAssert) }, Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { return writeDouble(this, value, offset, !0, noAssert) }, Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) { return writeDouble(this, value, offset, !1, noAssert) }, Buffer.prototype.copy = function (target, targetStart, start, end) { if (start || (start = 0), end || 0 === end || (end = this.length), targetStart >= target.length && (targetStart = target.length), targetStart || (targetStart = 0), end > 0 && end < start && (end = start), end === start) return 0; if (0 === target.length || 0 === this.length) return 0; if (targetStart < 0) throw new RangeError("targetStart out of bounds"); if (start < 0 || start >= this.length) throw new RangeError("sourceStart out of bounds"); if (end < 0) throw new RangeError("sourceEnd out of bounds"); end > this.length && (end = this.length), target.length - targetStart < end - start && (end = target.length - targetStart + start); var i, len = end - start; if (this === target && start < targetStart && targetStart < end) for (i = len - 1; i >= 0; --i)target[i + targetStart] = this[i + start]; else if (len < 1e3 || !Buffer.TYPED_ARRAY_SUPPORT) for (i = 0; i < len; ++i)target[i + targetStart] = this[i + start]; else Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart); return len }, Buffer.prototype.fill = function (val, start, end, encoding) { if ("string" == typeof val) { if ("string" == typeof start ? (encoding = start, start = 0, end = this.length) : "string" == typeof end && (encoding = end, end = this.length), 1 === val.length) { var code = val.charCodeAt(0); code < 256 && (val = code) } if (void 0 !== encoding && "string" != typeof encoding) throw new TypeError("encoding must be a string"); if ("string" == typeof encoding && !Buffer.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding) } else "number" == typeof val && (val &= 255); if (start < 0 || this.length < start || this.length < end) throw new RangeError("Out of range index"); if (end <= start) return this; start >>>= 0, end = void 0 === end ? this.length : end >>> 0, val || (val = 0); var i; if ("number" == typeof val) for (i = start; i < end; ++i)this[i] = val; else { var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()), len = bytes.length; for (i = 0; i < end - start; ++i)this[i + start] = bytes[i % len] } return this }; var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g }).call(exports, function () { return this }()) }, function(module, exports) { "use strict"; function getLens(b64) { var len = b64.length; if (len % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); var validLen = b64.indexOf("="); validLen === -1 && (validLen = len); var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; return [validLen, placeHoldersLen] } function byteLength(b64) { var lens = getLens(b64), validLen = lens[0], placeHoldersLen = lens[1]; return 3 * (validLen + placeHoldersLen) / 4 - placeHoldersLen } function _byteLength(b64, validLen, placeHoldersLen) { return 3 * (validLen + placeHoldersLen) / 4 - placeHoldersLen } function toByteArray(b64) { var tmp, i, lens = getLens(b64), validLen = lens[0], placeHoldersLen = lens[1], arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)), curByte = 0, len = placeHoldersLen > 0 ? validLen - 4 : validLen; for (i = 0; i < len; i += 4)tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)], arr[curByte++] = tmp >> 16 & 255, arr[curByte++] = tmp >> 8 & 255, arr[curByte++] = 255 & tmp; return 2 === placeHoldersLen && (tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4, arr[curByte++] = 255 & tmp), 1 === placeHoldersLen && (tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2, arr[curByte++] = tmp >> 8 & 255, arr[curByte++] = 255 & tmp), arr } function tripletToBase64(num) { return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[63 & num] } function encodeChunk(uint8, start, end) { for (var tmp, output = [], i = start; i < end; i += 3)tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (255 & uint8[i + 2]), output.push(tripletToBase64(tmp)); return output.join("") } function fromByteArray(uint8) { for (var tmp, len = uint8.length, extraBytes = len % 3, parts = [], maxChunkLength = 16383, i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); return 1 === extraBytes ? (tmp = uint8[len - 1], parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==")) : 2 === extraBytes && (tmp = (uint8[len - 2] << 8) + uint8[len - 1], parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=")), parts.join("") } exports.byteLength = byteLength, exports.toByteArray = toByteArray, exports.fromByteArray = fromByteArray; for (var lookup = [], revLookup = [], Arr = "undefined" != typeof Uint8Array ? Uint8Array : Array, code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, len = code.length; i < len; ++i)lookup[i] = code[i], revLookup[code.charCodeAt(i)] = i; revLookup["-".charCodeAt(0)] = 62, revLookup["_".charCodeAt(0)] = 63 }, function(module, exports) {/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m, eLen = 8 * nBytes - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, nBits = -7, i = isLE ? nBytes - 1 : 0, d = isLE ? -1 : 1, s = buffer[offset + i]; for (i += d, e = s & (1 << -nBits) - 1, s >>= -nBits, nBits += eLen; nBits > 0; e = 256 * e + buffer[offset + i], i += d, nBits -= 8); for (m = e & (1 << -nBits) - 1, e >>= -nBits, nBits += mLen; nBits > 0; m = 256 * m + buffer[offset + i], i += d, nBits -= 8); if (0 === e) e = 1 - eBias; else { if (e === eMax) return m ? NaN : (s ? -1 : 1) * (1 / 0); m += Math.pow(2, mLen), e -= eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) }, exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c, eLen = 8 * nBytes - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, rt = 23 === mLen ? Math.pow(2, -24) - Math.pow(2, -77) : 0, i = isLE ? 0 : nBytes - 1, d = isLE ? 1 : -1, s = value < 0 || 0 === value && 1 / value < 0 ? 1 : 0; for (value = Math.abs(value), isNaN(value) || value === 1 / 0 ? (m = isNaN(value) ? 1 : 0, e = eMax) : (e = Math.floor(Math.log(value) / Math.LN2), value * (c = Math.pow(2, -e)) < 1 && (e-- , c *= 2), value += e + eBias >= 1 ? rt / c : rt * Math.pow(2, 1 - eBias), value * c >= 2 && (e++ , c /= 2), e + eBias >= eMax ? (m = 0, e = eMax) : e + eBias >= 1 ? (m = (value * c - 1) * Math.pow(2, mLen), e += eBias) : (m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen), e = 0)); mLen >= 8; buffer[offset + i] = 255 & m, i += d, m /= 256, mLen -= 8); for (e = e << mLen | m, eLen += mLen; eLen > 0; buffer[offset + i] = 255 & e, i += d, e /= 256, eLen -= 8); buffer[offset + i - d] |= 128 * s } }, function(module, exports) { var toString = {}.toString; module.exports = Array.isArray || function (arr) { return "[object Array]" == toString.call(arr) } }, function(module, exports, __webpack_require__) { (function (global, Buffer) { !function () { var g = ("undefined" == typeof window ? global : window) || {}; _crypto = g.crypto || g.msCrypto || __webpack_require__(123), module.exports = function (size) { if (_crypto.getRandomValues) { var bytes = new Buffer(size); return _crypto.getRandomValues(bytes), bytes } if (_crypto.randomBytes) return _crypto.randomBytes(size); throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11") } }() }).call(exports, function () { return this }(), __webpack_require__(118).Buffer) }, function(module, exports) { }, function(module, exports, __webpack_require__) { (function (Buffer) { function toConstructor(fn) { return function () { var buffers = [], m = { update: function (data, enc) { return Buffer.isBuffer(data) || (data = new Buffer(data, enc)), buffers.push(data), this }, digest: function (enc) { var buf = Buffer.concat(buffers), r = fn(buf); return buffers = null, enc ? r.toString(enc) : r } }; return m } } var createHash = __webpack_require__(125), md5 = toConstructor(__webpack_require__(133)), rmd160 = toConstructor(__webpack_require__(135)); module.exports = function (alg) { return "md5" === alg ? new md5 : "rmd160" === alg ? new rmd160 : createHash(alg) } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { var exports = module.exports = function (alg) { var Alg = exports[alg]; if (!Alg) throw new Error(alg + " is not supported (we accept pull requests)"); return new Alg }, Buffer = __webpack_require__(118).Buffer, Hash = __webpack_require__(126)(Buffer); exports.sha1 = __webpack_require__(127)(Buffer, Hash), exports.sha256 = __webpack_require__(131)(Buffer, Hash), exports.sha512 = __webpack_require__(132)(Buffer, Hash) }, function(module, exports) { module.exports = function (Buffer) { function Hash(blockSize, finalSize) { this._block = new Buffer(blockSize), this._finalSize = finalSize, this._blockSize = blockSize, this._len = 0, this._s = 0 } return Hash.prototype.init = function () { this._s = 0, this._len = 0 }, Hash.prototype.update = function (data, enc) { "string" == typeof data && (enc = enc || "utf8", data = new Buffer(data, enc)); for (var l = this._len += data.length, s = this._s = this._s || 0, f = 0, buffer = this._block; s < l;) { for (var t = Math.min(data.length, f + this._blockSize - s % this._blockSize), ch = t - f, i = 0; i < ch; i++)buffer[s % this._blockSize + i] = data[i + f]; s += ch, f += ch, s % this._blockSize === 0 && this._update(buffer) } return this._s = s, this }, Hash.prototype.digest = function (enc) { var l = 8 * this._len; this._block[this._len % this._blockSize] = 128, this._block.fill(0, this._len % this._blockSize + 1), l % (8 * this._blockSize) >= 8 * this._finalSize && (this._update(this._block), this._block.fill(0)), this._block.writeInt32BE(l, this._blockSize - 4); var hash = this._update(this._block) || this._hash(); return enc ? hash.toString(enc) : hash }, Hash.prototype._update = function () { throw new Error("_update must be implemented by subclass") }, Hash } }, function(module, exports, __webpack_require__) { var inherits = __webpack_require__(128).inherits; module.exports = function (Buffer, Hash) { function Sha1() { return POOL.length ? POOL.pop().init() : this instanceof Sha1 ? (this._w = W, Hash.call(this, 64, 56), this._h = null, void this.init()) : new Sha1 } function sha1_ft(t, b, c, d) { return t < 20 ? b & c | ~b & d : t < 40 ? b ^ c ^ d : t < 60 ? b & c | b & d | c & d : b ^ c ^ d } function sha1_kt(t) { return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514 } function add(x, y) { return x + y | 0 } function rol(num, cnt) { return num << cnt | num >>> 32 - cnt } var A = 0, B = 4, C = 8, D = 12, E = 16, W = new ("undefined" == typeof Int32Array ? Array : Int32Array)(80), POOL = []; return inherits(Sha1, Hash), Sha1.prototype.init = function () { return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, Hash.prototype.init.call(this), this }, Sha1.prototype._POOL = POOL, Sha1.prototype._update = function (X) { var a, b, c, d, e, _a, _b, _c, _d, _e; a = _a = this._a, b = _b = this._b, c = _c = this._c, d = _d = this._d, e = _e = this._e; for (var w = this._w, j = 0; j < 80; j++) { var W = w[j] = j < 16 ? X.readInt32BE(4 * j) : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1), t = add(add(rol(a, 5), sha1_ft(j, b, c, d)), add(add(e, W), sha1_kt(j))); e = d, d = c, c = rol(b, 30), b = a, a = t } this._a = add(a, _a), this._b = add(b, _b), this._c = add(c, _c), this._d = add(d, _d), this._e = add(e, _e) }, Sha1.prototype._hash = function () { POOL.length < 100 && POOL.push(this); var H = new Buffer(20); return H.writeInt32BE(0 | this._a, A), H.writeInt32BE(0 | this._b, B), H.writeInt32BE(0 | this._c, C), H.writeInt32BE(0 | this._d, D), H.writeInt32BE(0 | this._e, E), H }, Sha1 } }, function(module, exports, __webpack_require__) { (function (global, process) { function inspect(obj, opts) { var ctx = { seen: [], stylize: stylizeNoColor }; return arguments.length >= 3 && (ctx.depth = arguments[2]), arguments.length >= 4 && (ctx.colors = arguments[3]), isBoolean(opts) ? ctx.showHidden = opts : opts && exports._extend(ctx, opts), isUndefined(ctx.showHidden) && (ctx.showHidden = !1), isUndefined(ctx.depth) && (ctx.depth = 2), isUndefined(ctx.colors) && (ctx.colors = !1), isUndefined(ctx.customInspect) && (ctx.customInspect = !0), ctx.colors && (ctx.stylize = stylizeWithColor), formatValue(ctx, obj, ctx.depth) } function stylizeWithColor(str, styleType) { var style = inspect.styles[styleType]; return style ? "[" + inspect.colors[style][0] + "m" + str + "[" + inspect.colors[style][1] + "m" : str } function stylizeNoColor(str, styleType) { return str } function arrayToHash(array) { var hash = {}; return array.forEach(function (val, idx) { hash[val] = !0 }), hash } function formatValue(ctx, value, recurseTimes) { if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && (!value.constructor || value.constructor.prototype !== value)) { var ret = value.inspect(recurseTimes, ctx); return isString(ret) || (ret = formatValue(ctx, ret, recurseTimes)), ret } var primitive = formatPrimitive(ctx, value); if (primitive) return primitive; var keys = Object.keys(value), visibleKeys = arrayToHash(keys); if (ctx.showHidden && (keys = Object.getOwnPropertyNames(value)), isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) return formatError(value); if (0 === keys.length) { if (isFunction(value)) { var name = value.name ? ": " + value.name : ""; return ctx.stylize("[Function" + name + "]", "special") } if (isRegExp(value)) return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); if (isDate(value)) return ctx.stylize(Date.prototype.toString.call(value), "date"); if (isError(value)) return formatError(value) } var base = "", array = !1, braces = ["{", "}"]; if (isArray(value) && (array = !0, braces = ["[", "]"]), isFunction(value)) { var n = value.name ? ": " + value.name : ""; base = " [Function" + n + "]" } if (isRegExp(value) && (base = " " + RegExp.prototype.toString.call(value)), isDate(value) && (base = " " + Date.prototype.toUTCString.call(value)), isError(value) && (base = " " + formatError(value)), 0 === keys.length && (!array || 0 == value.length)) return braces[0] + base + braces[1]; if (recurseTimes < 0) return isRegExp(value) ? ctx.stylize(RegExp.prototype.toString.call(value), "regexp") : ctx.stylize("[Object]", "special"); ctx.seen.push(value); var output; return output = array ? formatArray(ctx, value, recurseTimes, visibleKeys, keys) : keys.map(function (key) { return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) }), ctx.seen.pop(), reduceToSingleString(output, base, braces) } function formatPrimitive(ctx, value) { if (isUndefined(value)) return ctx.stylize("undefined", "undefined"); if (isString(value)) { var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; return ctx.stylize(simple, "string") } return isNumber(value) ? ctx.stylize("" + value, "number") : isBoolean(value) ? ctx.stylize("" + value, "boolean") : isNull(value) ? ctx.stylize("null", "null") : void 0 } function formatError(value) { return "[" + Error.prototype.toString.call(value) + "]" } function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { for (var output = [], i = 0, l = value.length; i < l; ++i)hasOwnProperty(value, String(i)) ? output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), !0)) : output.push(""); return keys.forEach(function (key) { key.match(/^\d+$/) || output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, !0)) }), output } function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { var name, str, desc; if (desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }, desc.get ? str = desc.set ? ctx.stylize("[Getter/Setter]", "special") : ctx.stylize("[Getter]", "special") : desc.set && (str = ctx.stylize("[Setter]", "special")), hasOwnProperty(visibleKeys, key) || (name = "[" + key + "]"), str || (ctx.seen.indexOf(desc.value) < 0 ? (str = isNull(recurseTimes) ? formatValue(ctx, desc.value, null) : formatValue(ctx, desc.value, recurseTimes - 1), str.indexOf("\n") > -1 && (str = array ? str.split("\n").map(function (line) { return " " + line }).join("\n").substr(2) : "\n" + str.split("\n").map(function (line) { return " " + line }).join("\n"))) : str = ctx.stylize("[Circular]", "special")), isUndefined(name)) { if (array && key.match(/^\d+$/)) return str; name = JSON.stringify("" + key), name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (name = name.substr(1, name.length - 2), name = ctx.stylize(name, "name")) : (name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), name = ctx.stylize(name, "string")) } return name + ": " + str } function reduceToSingleString(output, base, braces) { var numLinesEst = 0, length = output.reduce(function (prev, cur) { return numLinesEst++ , cur.indexOf("\n") >= 0 && numLinesEst++ , prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1 }, 0); return length > 60 ? braces[0] + ("" === base ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1] : braces[0] + base + " " + output.join(", ") + " " + braces[1] } function isArray(ar) { return Array.isArray(ar) } function isBoolean(arg) { return "boolean" == typeof arg } function isNull(arg) { return null === arg } function isNullOrUndefined(arg) { return null == arg } function isNumber(arg) { return "number" == typeof arg } function isString(arg) { return "string" == typeof arg } function isSymbol(arg) { return "symbol" == typeof arg } function isUndefined(arg) { return void 0 === arg } function isRegExp(re) { return isObject(re) && "[object RegExp]" === objectToString(re) } function isObject(arg) { return "object" == typeof arg && null !== arg } function isDate(d) { return isObject(d) && "[object Date]" === objectToString(d) } function isError(e) { return isObject(e) && ("[object Error]" === objectToString(e) || e instanceof Error) } function isFunction(arg) { return "function" == typeof arg } function isPrimitive(arg) { return null === arg || "boolean" == typeof arg || "number" == typeof arg || "string" == typeof arg || "symbol" == typeof arg || "undefined" == typeof arg } function objectToString(o) { return Object.prototype.toString.call(o) } function pad(n) { return n < 10 ? "0" + n.toString(10) : n.toString(10) } function timestamp() { var d = new Date, time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":"); return [d.getDate(), months[d.getMonth()], time].join(" ") } function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop) } var formatRegExp = /%[sdj%]/g; exports.format = function (f) { if (!isString(f)) { for (var objects = [], i = 0; i < arguments.length; i++)objects.push(inspect(arguments[i])); return objects.join(" ") } for (var i = 1, args = arguments, len = args.length, str = String(f).replace(formatRegExp, function (x) { if ("%%" === x) return "%"; if (i >= len) return x; switch (x) { case "%s": return String(args[i++]); case "%d": return Number(args[i++]); case "%j": try { return JSON.stringify(args[i++]) } catch (_) { return "[Circular]" } default: return x } }), x = args[i]; i < len; x = args[++i])str += isNull(x) || !isObject(x) ? " " + x : " " + inspect(x); return str }, exports.deprecate = function (fn, msg) { function deprecated() { if (!warned) { if (process.throwDeprecation) throw new Error(msg); process.traceDeprecation ? console.trace(msg) : console.error(msg), warned = !0 } return fn.apply(this, arguments) } if (isUndefined(global.process)) return function () { return exports.deprecate(fn, msg).apply(this, arguments) }; if (process.noDeprecation === !0) return fn; var warned = !1; return deprecated }; var debugEnviron, debugs = {}; exports.debuglog = function (set) { if (isUndefined(debugEnviron) && (debugEnviron = process.env.NODE_DEBUG || ""), set = set.toUpperCase(), !debugs[set]) if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) { var pid = process.pid; debugs[set] = function () { var msg = exports.format.apply(exports, arguments); console.error("%s %d: %s", set, pid, msg) } } else debugs[set] = function () { }; return debugs[set] }, exports.inspect = inspect, inspect.colors = { bold: [1, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], white: [37, 39], grey: [90, 39], black: [30, 39], blue: [34, 39], cyan: [36, 39], green: [32, 39], magenta: [35, 39], red: [31, 39], yellow: [33, 39] }, inspect.styles = { special: "cyan", number: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", date: "magenta", regexp: "red" }, exports.isArray = isArray, exports.isBoolean = isBoolean, exports.isNull = isNull, exports.isNullOrUndefined = isNullOrUndefined, exports.isNumber = isNumber, exports.isString = isString, exports.isSymbol = isSymbol, exports.isUndefined = isUndefined, exports.isRegExp = isRegExp, exports.isObject = isObject, exports.isDate = isDate, exports.isError = isError, exports.isFunction = isFunction, exports.isPrimitive = isPrimitive, exports.isBuffer = __webpack_require__(129); var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; exports.log = function () { console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)) }, exports.inherits = __webpack_require__(130), exports._extend = function (origin, add) { if (!add || !isObject(add)) return origin; for (var keys = Object.keys(add), i = keys.length; i--;)origin[keys[i]] = add[keys[i]]; return origin } }).call(exports, function () { return this }(), __webpack_require__(30)) }, function(module, exports) { module.exports = function (arg) { return arg && "object" == typeof arg && "function" == typeof arg.copy && "function" == typeof arg.fill && "function" == typeof arg.readUInt8 } }, function(module, exports) { "function" == typeof Object.create ? module.exports = function (ctor, superCtor) { ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: !1, writable: !0, configurable: !0 } }) } : module.exports = function (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () { }; TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor, ctor.prototype.constructor = ctor } }, function(module, exports, __webpack_require__) { var inherits = __webpack_require__(128).inherits; module.exports = function (Buffer, Hash) { function Sha256() { this.init(), this._w = W, Hash.call(this, 64, 56) } function S(X, n) { return X >>> n | X << 32 - n } function R(X, n) { return X >>> n } function Ch(x, y, z) { return x & y ^ ~x & z } function Maj(x, y, z) { return x & y ^ x & z ^ y & z } function Sigma0256(x) { return S(x, 2) ^ S(x, 13) ^ S(x, 22) } function Sigma1256(x) { return S(x, 6) ^ S(x, 11) ^ S(x, 25) } function Gamma0256(x) { return S(x, 7) ^ S(x, 18) ^ R(x, 3) } function Gamma1256(x) { return S(x, 17) ^ S(x, 19) ^ R(x, 10) } var K = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298], W = new Array(64); return inherits(Sha256, Hash), Sha256.prototype.init = function () { return this._a = 1779033703, this._b = -1150833019, this._c = 1013904242, this._d = -1521486534, this._e = 1359893119, this._f = -1694144372, this._g = 528734635, this._h = 1541459225, this._len = this._s = 0, this }, Sha256.prototype._update = function (M) { var a, b, c, d, e, f, g, h, T1, T2, W = this._w; a = 0 | this._a, b = 0 | this._b, c = 0 | this._c, d = 0 | this._d, e = 0 | this._e, f = 0 | this._f, g = 0 | this._g, h = 0 | this._h; for (var j = 0; j < 64; j++) { var w = W[j] = j < 16 ? M.readInt32BE(4 * j) : Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16]; T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w, T2 = Sigma0256(a) + Maj(a, b, c), h = g, g = f, f = e, e = d + T1, d = c, c = b, b = a, a = T1 + T2 } this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, this._d = d + this._d | 0, this._e = e + this._e | 0, this._f = f + this._f | 0, this._g = g + this._g | 0, this._h = h + this._h | 0 }, Sha256.prototype._hash = function () { var H = new Buffer(32); return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), H.writeInt32BE(this._g, 24), H.writeInt32BE(this._h, 28), H }, Sha256 } }, function(module, exports, __webpack_require__) { var inherits = __webpack_require__(128).inherits; module.exports = function (Buffer, Hash) { function Sha512() { this.init(), this._w = W, Hash.call(this, 128, 112) } function S(X, Xl, n) { return X >>> n | Xl << 32 - n } function Ch(x, y, z) { return x & y ^ ~x & z } function Maj(x, y, z) { return x & y ^ x & z ^ y & z } var K = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591], W = new Array(160); return inherits(Sha512, Hash), Sha512.prototype.init = function () { return this._a = 1779033703, this._b = -1150833019, this._c = 1013904242, this._d = -1521486534, this._e = 1359893119, this._f = -1694144372, this._g = 528734635, this._h = 1541459225, this._al = -205731576, this._bl = -2067093701, this._cl = -23791573, this._dl = 1595750129, this._el = -1377402159, this._fl = 725511199, this._gl = -79577749, this._hl = 327033209, this._len = this._s = 0, this }, Sha512.prototype._update = function (M) { var a, b, c, d, e, f, g, h, al, bl, cl, dl, el, fl, gl, hl, W = this._w; a = 0 | this._a, b = 0 | this._b, c = 0 | this._c, d = 0 | this._d, e = 0 | this._e, f = 0 | this._f, g = 0 | this._g, h = 0 | this._h, al = 0 | this._al, bl = 0 | this._bl, cl = 0 | this._cl, dl = 0 | this._dl, el = 0 | this._el, fl = 0 | this._fl, gl = 0 | this._gl, hl = 0 | this._hl; for (var i = 0; i < 80; i++) { var Wi, Wil, j = 2 * i; if (i < 16) Wi = W[j] = M.readInt32BE(4 * j), Wil = W[j + 1] = M.readInt32BE(4 * j + 4); else { var x = W[j - 30], xl = W[j - 30 + 1], gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ x >>> 7, gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7); x = W[j - 4], xl = W[j - 4 + 1]; var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ x >>> 6, gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6), Wi7 = W[j - 14], Wi7l = W[j - 14 + 1], Wi16 = W[j - 32], Wi16l = W[j - 32 + 1]; Wil = gamma0l + Wi7l, Wi = gamma0 + Wi7 + (Wil >>> 0 < gamma0l >>> 0 ? 1 : 0), Wil += gamma1l, Wi = Wi + gamma1 + (Wil >>> 0 < gamma1l >>> 0 ? 1 : 0), Wil += Wi16l, Wi = Wi + Wi16 + (Wil >>> 0 < Wi16l >>> 0 ? 1 : 0), W[j] = Wi, W[j + 1] = Wil } var maj = Maj(a, b, c), majl = Maj(al, bl, cl), sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7), sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7), sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9), sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9), Ki = K[j], Kil = K[j + 1], ch = Ch(e, f, g), chl = Ch(el, fl, gl), t1l = hl + sigma1l, t1 = h + sigma1h + (t1l >>> 0 < hl >>> 0 ? 1 : 0); t1l += chl, t1 = t1 + ch + (t1l >>> 0 < chl >>> 0 ? 1 : 0), t1l += Kil, t1 = t1 + Ki + (t1l >>> 0 < Kil >>> 0 ? 1 : 0), t1l += Wil, t1 = t1 + Wi + (t1l >>> 0 < Wil >>> 0 ? 1 : 0); var t2l = sigma0l + majl, t2 = sigma0h + maj + (t2l >>> 0 < sigma0l >>> 0 ? 1 : 0); h = g, hl = gl, g = f, gl = fl, f = e, fl = el, el = dl + t1l | 0, e = d + t1 + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0, d = c, dl = cl, c = b, cl = bl, b = a, bl = al, al = t1l + t2l | 0, a = t1 + t2 + (al >>> 0 < t1l >>> 0 ? 1 : 0) | 0 } this._al = this._al + al | 0, this._bl = this._bl + bl | 0, this._cl = this._cl + cl | 0, this._dl = this._dl + dl | 0, this._el = this._el + el | 0, this._fl = this._fl + fl | 0, this._gl = this._gl + gl | 0, this._hl = this._hl + hl | 0, this._a = this._a + a + (this._al >>> 0 < al >>> 0 ? 1 : 0) | 0, this._b = this._b + b + (this._bl >>> 0 < bl >>> 0 ? 1 : 0) | 0, this._c = this._c + c + (this._cl >>> 0 < cl >>> 0 ? 1 : 0) | 0, this._d = this._d + d + (this._dl >>> 0 < dl >>> 0 ? 1 : 0) | 0, this._e = this._e + e + (this._el >>> 0 < el >>> 0 ? 1 : 0) | 0, this._f = this._f + f + (this._fl >>> 0 < fl >>> 0 ? 1 : 0) | 0, this._g = this._g + g + (this._gl >>> 0 < gl >>> 0 ? 1 : 0) | 0, this._h = this._h + h + (this._hl >>> 0 < hl >>> 0 ? 1 : 0) | 0 }, Sha512.prototype._hash = function () { function writeInt64BE(h, l, offset) { H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4) } var H = new Buffer(64); return writeInt64BE(this._a, this._al, 0), writeInt64BE(this._b, this._bl, 8), writeInt64BE(this._c, this._cl, 16), writeInt64BE(this._d, this._dl, 24), writeInt64BE(this._e, this._el, 32), writeInt64BE(this._f, this._fl, 40), writeInt64BE(this._g, this._gl, 48), writeInt64BE(this._h, this._hl, 56), H }, Sha512 } }, function(module, exports, __webpack_require__) { function core_md5(x, len) { x[len >> 5] |= 128 << len % 32, x[(len + 64 >>> 9 << 4) + 14] = len; for (var a = 1732584193, b = -271733879, c = -1732584194, d = 271733878, i = 0; i < x.length; i += 16) { var olda = a, oldb = b, oldc = c, oldd = d; a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936), d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586), c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819), b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330), a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897), d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426), c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341), b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983), a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416), d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417), c = md5_ff(c, d, a, b, x[i + 10], 17, -42063), b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162), a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682), d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101), c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290), b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329), a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510), d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632), c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713), b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302), a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691), d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083), c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335), b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848), a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438), d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690), c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961), b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501), a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467), d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784), c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473), b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734), a = md5_hh(a, b, c, d, x[i + 5], 4, -378558), d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463), c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562), b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556), a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060), d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353), c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632), b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640), a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174), d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222), c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979), b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189), a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487), d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835), c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520), b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651), a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844), d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415), c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905), b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055), a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571), d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606), c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523), b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799), a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359), d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744), c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380), b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649), a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070), d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379), c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259), b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551), a = safe_add(a, olda), b = safe_add(b, oldb), c = safe_add(c, oldc), d = safe_add(d, oldd) } return Array(a, b, c, d) } function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b) } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn(b & c | ~b & d, a, b, x, s, t) } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn(b & d | c & ~d, a, b, x, s, t) } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t) } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | ~d), a, b, x, s, t) } function safe_add(x, y) { var lsw = (65535 & x) + (65535 & y), msw = (x >> 16) + (y >> 16) + (lsw >> 16); return msw << 16 | 65535 & lsw } function bit_rol(num, cnt) { return num << cnt | num >>> 32 - cnt } var helpers = __webpack_require__(134); module.exports = function (buf) { return helpers.hash(buf, core_md5, 16) } }, function(module, exports, __webpack_require__) { (function (Buffer) { function toArray(buf, bigEndian) { if (buf.length % intSize !== 0) { var len = buf.length + (intSize - buf.length % intSize); buf = Buffer.concat([buf, zeroBuffer], len) } for (var arr = [], fn = bigEndian ? buf.readInt32BE : buf.readInt32LE, i = 0; i < buf.length; i += intSize)arr.push(fn.call(buf, i)); return arr } function toBuffer(arr, size, bigEndian) { for (var buf = new Buffer(size), fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE, i = 0; i < arr.length; i++)fn.call(buf, arr[i], 4 * i, !0); return buf } function hash(buf, fn, hashSize, bigEndian) { Buffer.isBuffer(buf) || (buf = new Buffer(buf)); var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); return toBuffer(arr, hashSize, bigEndian) } var intSize = 4, zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); var chrsz = 8; module.exports = { hash: hash } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function f1(x, y, z) { return x ^ y ^ z } function f2(x, y, z) { return x & y | ~x & z } function f3(x, y, z) { return (x | ~y) ^ z } function f4(x, y, z) { return x & z | y & ~z } function f5(x, y, z) { return x ^ (y | ~z) } function rotl(x, n) { return x << n | x >>> 32 - n } function ripemd160(message) { var H = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]; "string" == typeof message && (message = new Buffer(message, "utf8")); var m = bytesToWords(message), nBitsLeft = 8 * message.length, nBitsTotal = 8 * message.length; m[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32, m[(nBitsLeft + 64 >>> 9 << 4) + 14] = 16711935 & (nBitsTotal << 8 | nBitsTotal >>> 24) | 4278255360 & (nBitsTotal << 24 | nBitsTotal >>> 8); for (var i = 0; i < m.length; i += 16)processBlock(H, m, i); for (var i = 0; i < 5; i++) { var H_i = H[i]; H[i] = 16711935 & (H_i << 8 | H_i >>> 24) | 4278255360 & (H_i << 24 | H_i >>> 8) } var digestbytes = wordsToBytes(H); return new Buffer(digestbytes) } module.exports = ripemd160;/** @preserve (c) 2012 by Cédric Mesnil. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var zl = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13], zr = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11], sl = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6], sr = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11], hl = [0, 1518500249, 1859775393, 2400959708, 2840853838], hr = [1352829926, 1548603684, 1836072691, 2053994217, 0], bytesToWords = function (bytes) { for (var words = [], i = 0, b = 0; i < bytes.length; i++ , b += 8)words[b >>> 5] |= bytes[i] << 24 - b % 32; return words }, wordsToBytes = function (words) { for (var bytes = [], b = 0; b < 32 * words.length; b += 8)bytes.push(words[b >>> 5] >>> 24 - b % 32 & 255); return bytes }, processBlock = function (H, M, offset) { for (var i = 0; i < 16; i++) { var offset_i = offset + i, M_offset_i = M[offset_i]; M[offset_i] = 16711935 & (M_offset_i << 8 | M_offset_i >>> 24) | 4278255360 & (M_offset_i << 24 | M_offset_i >>> 8) } var al, bl, cl, dl, el, ar, br, cr, dr, er; ar = al = H[0], br = bl = H[1], cr = cl = H[2], dr = dl = H[3], er = el = H[4]; for (var t, i = 0; i < 80; i += 1)t = al + M[offset + zl[i]] | 0, t += i < 16 ? f1(bl, cl, dl) + hl[0] : i < 32 ? f2(bl, cl, dl) + hl[1] : i < 48 ? f3(bl, cl, dl) + hl[2] : i < 64 ? f4(bl, cl, dl) + hl[3] : f5(bl, cl, dl) + hl[4], t |= 0, t = rotl(t, sl[i]), t = t + el | 0, al = el, el = dl, dl = rotl(cl, 10), cl = bl, bl = t, t = ar + M[offset + zr[i]] | 0, t += i < 16 ? f5(br, cr, dr) + hr[0] : i < 32 ? f4(br, cr, dr) + hr[1] : i < 48 ? f3(br, cr, dr) + hr[2] : i < 64 ? f2(br, cr, dr) + hr[3] : f1(br, cr, dr) + hr[4], t |= 0, t = rotl(t, sr[i]), t = t + er | 0, ar = er, er = dr, dr = rotl(cr, 10), cr = br, br = t; t = H[1] + cl + dr | 0, H[1] = H[2] + dl + er | 0, H[2] = H[3] + el + ar | 0, H[3] = H[4] + al + br | 0, H[4] = H[0] + bl + cr | 0, H[0] = t } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function Hmac(alg, key) { if (!(this instanceof Hmac)) return new Hmac(alg, key); this._opad = opad, this._alg = alg; var blocksize = "sha512" === alg ? 128 : 64; key = this._key = Buffer.isBuffer(key) ? key : new Buffer(key), key.length > blocksize ? key = createHash(alg).update(key).digest() : key.length < blocksize && (key = Buffer.concat([key, zeroBuffer], blocksize)); for (var ipad = this._ipad = new Buffer(blocksize), opad = this._opad = new Buffer(blocksize), i = 0; i < blocksize; i++)ipad[i] = 54 ^ key[i], opad[i] = 92 ^ key[i]; this._hash = createHash(alg).update(ipad) } var createHash = __webpack_require__(124), zeroBuffer = new Buffer(128); zeroBuffer.fill(0), module.exports = Hmac, Hmac.prototype.update = function (data, enc) { return this._hash.update(data, enc), this }, Hmac.prototype.digest = function (enc) { var h = this._hash.digest(); return createHash(this._alg).update(this._opad).update(h).digest(enc) } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { var pbkdf2Export = __webpack_require__(138); module.exports = function (crypto, exports) { exports = exports || {}; var exported = pbkdf2Export(crypto); return exports.pbkdf2 = exported.pbkdf2, exports.pbkdf2Sync = exported.pbkdf2Sync, exports } }, function(module, exports, __webpack_require__) { (function (Buffer) { module.exports = function (crypto) { function pbkdf2(password, salt, iterations, keylen, digest, callback) { if ("function" == typeof digest && (callback = digest, digest = void 0), "function" != typeof callback) throw new Error("No callback provided to pbkdf2"); setTimeout(function () { var result; try { result = pbkdf2Sync(password, salt, iterations, keylen, digest) } catch (e) { return callback(e) } callback(void 0, result) }) } function pbkdf2Sync(password, salt, iterations, keylen, digest) { if ("number" != typeof iterations) throw new TypeError("Iterations not a number"); if (iterations < 0) throw new TypeError("Bad iterations"); if ("number" != typeof keylen) throw new TypeError("Key length not a number"); if (keylen < 0) throw new TypeError("Bad key length"); digest = digest || "sha1", Buffer.isBuffer(password) || (password = new Buffer(password)), Buffer.isBuffer(salt) || (salt = new Buffer(salt)); var hLen, r, T, l = 1, DK = new Buffer(keylen), block1 = new Buffer(salt.length + 4); salt.copy(block1, 0, 0, salt.length); for (var i = 1; i <= l; i++) { block1.writeUInt32BE(i, salt.length); var U = crypto.createHmac(digest, password).update(block1).digest(); if (!hLen && (hLen = U.length, T = new Buffer(hLen), l = Math.ceil(keylen / hLen), r = keylen - (l - 1) * hLen, keylen > (Math.pow(2, 32) - 1) * hLen)) throw new TypeError("keylen exceeds maximum length"); U.copy(T, 0, 0, hLen); for (var j = 1; j < iterations; j++) { U = crypto.createHmac(digest, password).update(U).digest(); for (var k = 0; k < hLen; k++)T[k] ^= U[k] } var destPos = (i - 1) * hLen, len = i == l ? r : hLen; T.copy(DK, destPos, 0, len) } return DK } return { pbkdf2: pbkdf2, pbkdf2Sync: pbkdf2Sync } } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { module.exports = function (crypto, exports) { function listCiphers() { return Object.keys(modes) } exports = exports || {}; var ciphers = __webpack_require__(140)(crypto); exports.createCipher = ciphers.createCipher, exports.createCipheriv = ciphers.createCipheriv; var deciphers = __webpack_require__(175)(crypto); exports.createDecipher = deciphers.createDecipher, exports.createDecipheriv = deciphers.createDecipheriv; var modes = __webpack_require__(166); exports.listCiphers = listCiphers } }, function(module, exports, __webpack_require__) { (function (Buffer) { function Cipher(mode, key, iv) { return this instanceof Cipher ? (Transform.call(this), this._cache = new Splitter, this._cipher = new aes.AES(key), this._prev = new Buffer(iv.length), iv.copy(this._prev), void (this._mode = mode)) : new Cipher(mode, key, iv) } function Splitter() { return this instanceof Splitter ? void (this.cache = new Buffer("")) : new Splitter } var aes = __webpack_require__(141), Transform = __webpack_require__(142), inherits = __webpack_require__(145), modes = __webpack_require__(166), ebtk = __webpack_require__(167), StreamCipher = __webpack_require__(168); inherits(Cipher, Transform), Cipher.prototype._transform = function (data, _, next) { this._cache.add(data); for (var chunk, thing; chunk = this._cache.get();)thing = this._mode.encrypt(this, chunk), this.push(thing); next() }, Cipher.prototype._flush = function (next) { var chunk = this._cache.flush(); this.push(this._mode.encrypt(this, chunk)), this._cipher.scrub(), next() }, Splitter.prototype.add = function (data) { this.cache = Buffer.concat([this.cache, data]) }, Splitter.prototype.get = function () { if (this.cache.length > 15) { var out = this.cache.slice(0, 16); return this.cache = this.cache.slice(16), out } return null }, Splitter.prototype.flush = function () { for (var len = 16 - this.cache.length, padBuff = new Buffer(len), i = -1; ++i < len;)padBuff.writeUInt8(len, i); var out = Buffer.concat([this.cache, padBuff]); return out }; var modelist = { ECB: __webpack_require__(169), CBC: __webpack_require__(170), CFB: __webpack_require__(172), OFB: __webpack_require__(173), CTR: __webpack_require__(174) }; module.exports = function (crypto) { function createCipheriv(suite, password, iv) { var config = modes[suite]; if (!config) throw new TypeError("invalid suite type"); if ("string" == typeof iv && (iv = new Buffer(iv)), "string" == typeof password && (password = new Buffer(password)), password.length !== config.key / 8) throw new TypeError("invalid key length " + password.length); if (iv.length !== config.iv) throw new TypeError("invalid iv length " + iv.length); return "stream" === config.type ? new StreamCipher(modelist[config.mode], password, iv) : new Cipher(modelist[config.mode], password, iv) } function createCipher(suite, password) { var config = modes[suite]; if (!config) throw new TypeError("invalid suite type"); var keys = ebtk(crypto, password, config.key, config.iv); return createCipheriv(suite, keys.key, keys.iv) } return { createCipher: createCipher, createCipheriv: createCipheriv } } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function fixup_uint32(x) { var ret, x_pos; return ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x } function scrub_vec(v) { var i, _i, _ref; for (i = _i = 0, _ref = v.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i)v[i] = 0; return !1 } function Global() { var i; this.SBOX = [], this.INV_SBOX = [], this.SUB_MIX = function () { var _i, _results; for (_results = [], i = _i = 0; _i < 4; i = ++_i)_results.push([]); return _results }(), this.INV_SUB_MIX = function () { var _i, _results; for (_results = [], i = _i = 0; _i < 4; i = ++_i)_results.push([]); return _results }(), this.init(), this.RCON = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54] } function bufferToArray(buf) { for (var len = buf.length / 4, out = new Array(len), i = -1; ++i < len;)out[i] = buf.readUInt32BE(4 * i); return out } function AES(key) { this._key = bufferToArray(key), this._doReset() } var uint_max = Math.pow(2, 32); Global.prototype.init = function () { var d, i, sx, t, x, x2, x4, x8, xi, _i; for (d = function () { var _i, _results; for (_results = [], i = _i = 0; _i < 256; i = ++_i)i < 128 ? _results.push(i << 1) : _results.push(i << 1 ^ 283); return _results }(), x = 0, xi = 0, i = _i = 0; _i < 256; i = ++_i)sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4, sx = sx >>> 8 ^ 255 & sx ^ 99, this.SBOX[x] = sx, this.INV_SBOX[sx] = x, x2 = d[x], x4 = d[x2], x8 = d[x4], t = 257 * d[sx] ^ 16843008 * sx, this.SUB_MIX[0][x] = t << 24 | t >>> 8, this.SUB_MIX[1][x] = t << 16 | t >>> 16, this.SUB_MIX[2][x] = t << 8 | t >>> 24, this.SUB_MIX[3][x] = t, t = 16843009 * x8 ^ 65537 * x4 ^ 257 * x2 ^ 16843008 * x, this.INV_SUB_MIX[0][sx] = t << 24 | t >>> 8, this.INV_SUB_MIX[1][sx] = t << 16 | t >>> 16, this.INV_SUB_MIX[2][sx] = t << 8 | t >>> 24, this.INV_SUB_MIX[3][sx] = t, 0 === x ? x = xi = 1 : (x = x2 ^ d[d[d[x8 ^ x2]]], xi ^= d[d[xi]]); return !0 }; var G = new Global; AES.blockSize = 16, AES.prototype.blockSize = AES.blockSize, AES.keySize = 32, AES.prototype.keySize = AES.keySize, AES.ivSize = AES.blockSize, AES.prototype.ivSize = AES.ivSize, AES.prototype._doReset = function () { var invKsRow, keySize, keyWords, ksRow, ksRows, t, _i, _j; for (keyWords = this._key, keySize = keyWords.length, this._nRounds = keySize + 6, ksRows = 4 * (this._nRounds + 1), this._keySchedule = [], ksRow = _i = 0; 0 <= ksRows ? _i < ksRows : _i > ksRows; ksRow = 0 <= ksRows ? ++_i : --_i)this._keySchedule[ksRow] = ksRow < keySize ? keyWords[ksRow] : (t = this._keySchedule[ksRow - 1], ksRow % keySize === 0 ? (t = t << 8 | t >>> 24, t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[255 & t], t ^= G.RCON[ksRow / keySize | 0] << 24) : keySize > 6 && ksRow % keySize === 4 ? t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[255 & t] : void 0, this._keySchedule[ksRow - keySize] ^ t); for (this._invKeySchedule = [], invKsRow = _j = 0; 0 <= ksRows ? _j < ksRows : _j > ksRows; invKsRow = 0 <= ksRows ? ++_j : --_j)ksRow = ksRows - invKsRow, t = this._keySchedule[ksRow - (invKsRow % 4 ? 0 : 4)], this._invKeySchedule[invKsRow] = invKsRow < 4 || ksRow <= 4 ? t : G.INV_SUB_MIX[0][G.SBOX[t >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[t >>> 16 & 255]] ^ G.INV_SUB_MIX[2][G.SBOX[t >>> 8 & 255]] ^ G.INV_SUB_MIX[3][G.SBOX[255 & t]]; return !0 }, AES.prototype.encryptBlock = function (M) { M = bufferToArray(new Buffer(M)); var out = this._doCryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX), buf = new Buffer(16); return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[1], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[3], 12), buf }, AES.prototype.decryptBlock = function (M) { M = bufferToArray(new Buffer(M)); var temp = [M[3], M[1]]; M[1] = temp[0], M[3] = temp[1]; var out = this._doCryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX), buf = new Buffer(16); return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[3], 4), buf.writeUInt32BE(out[2], 8), buf.writeUInt32BE(out[1], 12), buf }, AES.prototype.scrub = function () { scrub_vec(this._keySchedule), scrub_vec(this._invKeySchedule), scrub_vec(this._key) }, AES.prototype._doCryptBlock = function (M, keySchedule, SUB_MIX, SBOX) { var ksRow, round, s0, s1, s2, s3, t0, t1, t2, t3, _i, _ref; for (s0 = M[0] ^ keySchedule[0], s1 = M[1] ^ keySchedule[1], s2 = M[2] ^ keySchedule[2], s3 = M[3] ^ keySchedule[3], ksRow = 4, round = _i = 1, _ref = this._nRounds; 1 <= _ref ? _i < _ref : _i > _ref; round = 1 <= _ref ? ++_i : --_i)t0 = SUB_MIX[0][s0 >>> 24] ^ SUB_MIX[1][s1 >>> 16 & 255] ^ SUB_MIX[2][s2 >>> 8 & 255] ^ SUB_MIX[3][255 & s3] ^ keySchedule[ksRow++], t1 = SUB_MIX[0][s1 >>> 24] ^ SUB_MIX[1][s2 >>> 16 & 255] ^ SUB_MIX[2][s3 >>> 8 & 255] ^ SUB_MIX[3][255 & s0] ^ keySchedule[ksRow++], t2 = SUB_MIX[0][s2 >>> 24] ^ SUB_MIX[1][s3 >>> 16 & 255] ^ SUB_MIX[2][s0 >>> 8 & 255] ^ SUB_MIX[3][255 & s1] ^ keySchedule[ksRow++], t3 = SUB_MIX[0][s3 >>> 24] ^ SUB_MIX[1][s0 >>> 16 & 255] ^ SUB_MIX[2][s1 >>> 8 & 255] ^ SUB_MIX[3][255 & s2] ^ keySchedule[ksRow++], s0 = t0, s1 = t1, s2 = t2, s3 = t3; return t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 255] << 16 | SBOX[s2 >>> 8 & 255] << 8 | SBOX[255 & s3]) ^ keySchedule[ksRow++], t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 255] << 16 | SBOX[s3 >>> 8 & 255] << 8 | SBOX[255 & s0]) ^ keySchedule[ksRow++], t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 255] << 16 | SBOX[s0 >>> 8 & 255] << 8 | SBOX[255 & s1]) ^ keySchedule[ksRow++], t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 255] << 16 | SBOX[s1 >>> 8 & 255] << 8 | SBOX[255 & s2]) ^ keySchedule[ksRow++], [fixup_uint32(t0), fixup_uint32(t1), fixup_uint32(t2), fixup_uint32(t3)] }, exports.AES = AES }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function CipherBase() { Transform.call(this) } var Transform = __webpack_require__(143).Transform, inherits = __webpack_require__(145); module.exports = CipherBase, inherits(CipherBase, Transform), CipherBase.prototype.update = function (data, inputEnd, outputEnc) { this.write(data, inputEnd); for (var chunk, outData = new Buffer(""); chunk = this.read();)outData = Buffer.concat([outData, chunk]); return outputEnc && (outData = outData.toString(outputEnc)), outData }, CipherBase.prototype.final = function (outputEnc) { this.end(); for (var chunk, outData = new Buffer(""); chunk = this.read();)outData = Buffer.concat([outData, chunk]); return outputEnc && (outData = outData.toString(outputEnc)), outData } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { function Stream() { EE.call(this) } module.exports = Stream; var EE = __webpack_require__(144).EventEmitter, inherits = __webpack_require__(145); inherits(Stream, EE), Stream.Readable = __webpack_require__(146), Stream.Writable = __webpack_require__(162), Stream.Duplex = __webpack_require__(163), Stream.Transform = __webpack_require__(164), Stream.PassThrough = __webpack_require__(165), Stream.Stream = Stream, Stream.prototype.pipe = function (dest, options) { function ondata(chunk) { dest.writable && !1 === dest.write(chunk) && source.pause && source.pause() } function ondrain() { source.readable && source.resume && source.resume() } function onend() { didOnEnd || (didOnEnd = !0, dest.end()) } function onclose() { didOnEnd || (didOnEnd = !0, "function" == typeof dest.destroy && dest.destroy()) } function onerror(er) { if (cleanup(), 0 === EE.listenerCount(this, "error")) throw er } function cleanup() { source.removeListener("data", ondata), dest.removeListener("drain", ondrain), source.removeListener("end", onend), source.removeListener("close", onclose), source.removeListener("error", onerror), dest.removeListener("error", onerror), source.removeListener("end", cleanup), source.removeListener("close", cleanup), dest.removeListener("close", cleanup) } var source = this; source.on("data", ondata), dest.on("drain", ondrain), dest._isStdio || options && options.end === !1 || (source.on("end", onend), source.on("close", onclose)); var didOnEnd = !1; return source.on("error", onerror), dest.on("error", onerror), source.on("end", cleanup), source.on("close", cleanup), dest.on("close", cleanup), dest.emit("pipe", source), dest } }, function(module, exports) { function EventEmitter() { this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0 } function isFunction(arg) { return "function" == typeof arg } function isNumber(arg) { return "number" == typeof arg } function isObject(arg) { return "object" == typeof arg && null !== arg } function isUndefined(arg) { return void 0 === arg } module.exports = EventEmitter, EventEmitter.EventEmitter = EventEmitter, EventEmitter.prototype._events = void 0, EventEmitter.prototype._maxListeners = void 0, EventEmitter.defaultMaxListeners = 10, EventEmitter.prototype.setMaxListeners = function (n) { if (!isNumber(n) || n < 0 || isNaN(n)) throw TypeError("n must be a positive number"); return this._maxListeners = n, this }, EventEmitter.prototype.emit = function (type) { var er, handler, len, args, i, listeners; if (this._events || (this._events = {}), "error" === type && (!this._events.error || isObject(this._events.error) && !this._events.error.length)) { if (er = arguments[1], er instanceof Error) throw er; var err = new Error('Uncaught, unspecified "error" event. (' + er + ")"); throw err.context = er, err } if (handler = this._events[type], isUndefined(handler)) return !1; if (isFunction(handler)) switch (arguments.length) { case 1: handler.call(this); break; case 2: handler.call(this, arguments[1]); break; case 3: handler.call(this, arguments[1], arguments[2]); break; default: args = Array.prototype.slice.call(arguments, 1), handler.apply(this, args) } else if (isObject(handler)) for (args = Array.prototype.slice.call(arguments, 1), listeners = handler.slice(), len = listeners.length, i = 0; i < len; i++)listeners[i].apply(this, args); return !0 }, EventEmitter.prototype.addListener = function (type, listener) { var m; if (!isFunction(listener)) throw TypeError("listener must be a function"); return this._events || (this._events = {}), this._events.newListener && this.emit("newListener", type, isFunction(listener.listener) ? listener.listener : listener), this._events[type] ? isObject(this._events[type]) ? this._events[type].push(listener) : this._events[type] = [this._events[type], listener] : this._events[type] = listener, isObject(this._events[type]) && !this._events[type].warned && (m = isUndefined(this._maxListeners) ? EventEmitter.defaultMaxListeners : this._maxListeners, m && m > 0 && this._events[type].length > m && (this._events[type].warned = !0, console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[type].length), "function" == typeof console.trace && console.trace())), this }, EventEmitter.prototype.on = EventEmitter.prototype.addListener, EventEmitter.prototype.once = function (type, listener) { function g() { this.removeListener(type, g), fired || (fired = !0, listener.apply(this, arguments)) } if (!isFunction(listener)) throw TypeError("listener must be a function"); var fired = !1; return g.listener = listener, this.on(type, g), this }, EventEmitter.prototype.removeListener = function (type, listener) { var list, position, length, i; if (!isFunction(listener)) throw TypeError("listener must be a function"); if (!this._events || !this._events[type]) return this; if (list = this._events[type], length = list.length, position = -1, list === listener || isFunction(list.listener) && list.listener === listener) delete this._events[type], this._events.removeListener && this.emit("removeListener", type, listener); else if (isObject(list)) { for (i = length; i-- > 0;)if (list[i] === listener || list[i].listener && list[i].listener === listener) { position = i; break } if (position < 0) return this; 1 === list.length ? (list.length = 0, delete this._events[type]) : list.splice(position, 1), this._events.removeListener && this.emit("removeListener", type, listener) } return this }, EventEmitter.prototype.removeAllListeners = function (type) { var key, listeners; if (!this._events) return this; if (!this._events.removeListener) return 0 === arguments.length ? this._events = {} : this._events[type] && delete this._events[type], this; if (0 === arguments.length) { for (key in this._events) "removeListener" !== key && this.removeAllListeners(key); return this.removeAllListeners("removeListener"), this._events = {}, this } if (listeners = this._events[type], isFunction(listeners)) this.removeListener(type, listeners); else if (listeners) for (; listeners.length;)this.removeListener(type, listeners[listeners.length - 1]); return delete this._events[type], this }, EventEmitter.prototype.listeners = function (type) { var ret; return ret = this._events && this._events[type] ? isFunction(this._events[type]) ? [this._events[type]] : this._events[type].slice() : [] }, EventEmitter.prototype.listenerCount = function (type) { if (this._events) { var evlistener = this._events[type]; if (isFunction(evlistener)) return 1; if (evlistener) return evlistener.length } return 0 }, EventEmitter.listenerCount = function (emitter, type) { return emitter.listenerCount(type) } }, function(module, exports) { "function" == typeof Object.create ? module.exports = function (ctor, superCtor) { superCtor && (ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: !1, writable: !0, configurable: !0 } })) } : module.exports = function (ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; var TempCtor = function () { }; TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor, ctor.prototype.constructor = ctor } } }, function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(147), exports.Stream = exports, exports.Readable = exports, exports.Writable = __webpack_require__(157), exports.Duplex = __webpack_require__(156), exports.Transform = __webpack_require__(160), exports.PassThrough = __webpack_require__(161) }, function(module, exports, __webpack_require__) { (function (global, process) { "use strict"; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk) } function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array } function prependListener(emitter, event, fn) { return "function" == typeof emitter.prependListener ? emitter.prependListener(event, fn) : void (emitter._events && emitter._events[event] ? isArray(emitter._events[event]) ? emitter._events[event].unshift(fn) : emitter._events[event] = [fn, emitter._events[event]] : emitter.on(event, fn)) } function ReadableState(options, stream) { Duplex = Duplex || __webpack_require__(156), options = options || {}; var isDuplex = stream instanceof Duplex; this.objectMode = !!options.objectMode, isDuplex && (this.objectMode = this.objectMode || !!options.readableObjectMode); var hwm = options.highWaterMark, readableHwm = options.readableHighWaterMark, defaultHwm = this.objectMode ? 16 : 16384; hwm || 0 === hwm ? this.highWaterMark = hwm : isDuplex && (readableHwm || 0 === readableHwm) ? this.highWaterMark = readableHwm : this.highWaterMark = defaultHwm, this.highWaterMark = Math.floor(this.highWaterMark), this.buffer = new BufferList, this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.destroyed = !1, this.defaultEncoding = options.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, options.encoding && (StringDecoder || (StringDecoder = __webpack_require__(159).StringDecoder), this.decoder = new StringDecoder(options.encoding), this.encoding = options.encoding) } function Readable(options) { return Duplex = Duplex || __webpack_require__(156), this instanceof Readable ? (this._readableState = new ReadableState(options, this), this.readable = !0, options && ("function" == typeof options.read && (this._read = options.read), "function" == typeof options.destroy && (this._destroy = options.destroy)), void Stream.call(this)) : new Readable(options) } function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { var state = stream._readableState; if (null === chunk) state.reading = !1, onEofChunk(stream, state); else { var er; skipChunkCheck || (er = chunkInvalid(state, chunk)), er ? stream.emit("error", er) : state.objectMode || chunk && chunk.length > 0 ? ("string" == typeof chunk || state.objectMode || Object.getPrototypeOf(chunk) === Buffer.prototype || (chunk = _uint8ArrayToBuffer(chunk)), addToFront ? state.endEmitted ? stream.emit("error", new Error("stream.unshift() after end event")) : addChunk(stream, state, chunk, !0) : state.ended ? stream.emit("error", new Error("stream.push() after EOF")) : (state.reading = !1, state.decoder && !encoding ? (chunk = state.decoder.write(chunk), state.objectMode || 0 !== chunk.length ? addChunk(stream, state, chunk, !1) : maybeReadMore(stream, state)) : addChunk(stream, state, chunk, !1))) : addToFront || (state.reading = !1) } return needMoreData(state) } function addChunk(stream, state, chunk, addToFront) { state.flowing && 0 === state.length && !state.sync ? (stream.emit("data", chunk), stream.read(0)) : (state.length += state.objectMode ? 1 : chunk.length, addToFront ? state.buffer.unshift(chunk) : state.buffer.push(chunk), state.needReadable && emitReadable(stream)), maybeReadMore(stream, state) } function chunkInvalid(state, chunk) { var er; return _isUint8Array(chunk) || "string" == typeof chunk || void 0 === chunk || state.objectMode || (er = new TypeError("Invalid non-string/buffer chunk")), er } function needMoreData(state) { return !state.ended && (state.needReadable || state.length < state.highWaterMark || 0 === state.length) } function computeNewHighWaterMark(n) { return n >= MAX_HWM ? n = MAX_HWM : (n-- , n |= n >>> 1, n |= n >>> 2, n |= n >>> 4, n |= n >>> 8, n |= n >>> 16, n++), n } function howMuchToRead(n, state) { return n <= 0 || 0 === state.length && state.ended ? 0 : state.objectMode ? 1 : n !== n ? state.flowing && state.length ? state.buffer.head.data.length : state.length : (n > state.highWaterMark && (state.highWaterMark = computeNewHighWaterMark(n)), n <= state.length ? n : state.ended ? state.length : (state.needReadable = !0, 0)) } function onEofChunk(stream, state) { if (!state.ended) { if (state.decoder) { var chunk = state.decoder.end(); chunk && chunk.length && (state.buffer.push(chunk), state.length += state.objectMode ? 1 : chunk.length) } state.ended = !0, emitReadable(stream) } } function emitReadable(stream) { var state = stream._readableState; state.needReadable = !1, state.emittedReadable || (debug("emitReadable", state.flowing), state.emittedReadable = !0, state.sync ? pna.nextTick(emitReadable_, stream) : emitReadable_(stream)) } function emitReadable_(stream) { debug("emit readable"), stream.emit("readable"), flow(stream) } function maybeReadMore(stream, state) { state.readingMore || (state.readingMore = !0, pna.nextTick(maybeReadMore_, stream, state)) } function maybeReadMore_(stream, state) { for (var len = state.length; !state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark && (debug("maybeReadMore read 0"), stream.read(0), len !== state.length);)len = state.length; state.readingMore = !1 } function pipeOnDrain(src) { return function () { var state = src._readableState; debug("pipeOnDrain", state.awaitDrain), state.awaitDrain && state.awaitDrain-- , 0 === state.awaitDrain && EElistenerCount(src, "data") && (state.flowing = !0, flow(src)) } } function nReadingNextTick(self) { debug("readable nexttick read 0"), self.read(0) } function resume(stream, state) { state.resumeScheduled || (state.resumeScheduled = !0, pna.nextTick(resume_, stream, state)) } function resume_(stream, state) { state.reading || (debug("resume read 0"), stream.read(0)), state.resumeScheduled = !1, state.awaitDrain = 0, stream.emit("resume"), flow(stream), state.flowing && !state.reading && stream.read(0) } function flow(stream) { var state = stream._readableState; for (debug("flow", state.flowing); state.flowing && null !== stream.read();); } function fromList(n, state) { if (0 === state.length) return null; var ret; return state.objectMode ? ret = state.buffer.shift() : !n || n >= state.length ? (ret = state.decoder ? state.buffer.join("") : 1 === state.buffer.length ? state.buffer.head.data : state.buffer.concat(state.length), state.buffer.clear()) : ret = fromListPartial(n, state.buffer, state.decoder), ret } function fromListPartial(n, list, hasStrings) { var ret; return n < list.head.data.length ? (ret = list.head.data.slice(0, n), list.head.data = list.head.data.slice(n)) : ret = n === list.head.data.length ? list.shift() : hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list), ret } function copyFromBufferString(n, list) { var p = list.head, c = 1, ret = p.data; for (n -= ret.length; p = p.next;) { var str = p.data, nb = n > str.length ? str.length : n; if (ret += nb === str.length ? str : str.slice(0, n), n -= nb, 0 === n) { nb === str.length ? (++c, p.next ? list.head = p.next : list.head = list.tail = null) : (list.head = p, p.data = str.slice(nb)); break } ++c } return list.length -= c, ret } function copyFromBuffer(n, list) { var ret = Buffer.allocUnsafe(n), p = list.head, c = 1; for (p.data.copy(ret), n -= p.data.length; p = p.next;) { var buf = p.data, nb = n > buf.length ? buf.length : n; if (buf.copy(ret, ret.length - n, 0, nb), n -= nb, 0 === n) { nb === buf.length ? (++c, p.next ? list.head = p.next : list.head = list.tail = null) : (list.head = p, p.data = buf.slice(nb)); break } ++c } return list.length -= c, ret } function endReadable(stream) { var state = stream._readableState; if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); state.endEmitted || (state.ended = !0, pna.nextTick(endReadableNT, state, stream)) } function endReadableNT(state, stream) { state.endEmitted || 0 !== state.length || (state.endEmitted = !0, stream.readable = !1, stream.emit("end")) } function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++)if (xs[i] === x) return i; return -1 } var pna = __webpack_require__(148); module.exports = Readable; var Duplex, isArray = __webpack_require__(121); Readable.ReadableState = ReadableState; var EElistenerCount = (__webpack_require__(144).EventEmitter, function (emitter, type) { return emitter.listeners(type).length }), Stream = __webpack_require__(149), Buffer = __webpack_require__(150).Buffer, OurUint8Array = ("undefined" != typeof global ? global : "undefined" != typeof window ? window : "undefined" != typeof self ? self : {}).Uint8Array || function () { }, util = Object.create(__webpack_require__(151)); util.inherits = __webpack_require__(145); var debugUtil = __webpack_require__(152), debug = void 0; debug = debugUtil && debugUtil.debuglog ? debugUtil.debuglog("stream") : function () { }; var StringDecoder, BufferList = __webpack_require__(153), destroyImpl = __webpack_require__(155); util.inherits(Readable, Stream); var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; Object.defineProperty(Readable.prototype, "destroyed", { get: function () { return void 0 !== this._readableState && this._readableState.destroyed }, set: function (value) { this._readableState && (this._readableState.destroyed = value) } }), Readable.prototype.destroy = destroyImpl.destroy, Readable.prototype._undestroy = destroyImpl.undestroy, Readable.prototype._destroy = function (err, cb) { this.push(null), cb(err) }, Readable.prototype.push = function (chunk, encoding) { var skipChunkCheck, state = this._readableState; return state.objectMode ? skipChunkCheck = !0 : "string" == typeof chunk && (encoding = encoding || state.defaultEncoding, encoding !== state.encoding && (chunk = Buffer.from(chunk, encoding), encoding = ""), skipChunkCheck = !0), readableAddChunk(this, chunk, encoding, !1, skipChunkCheck) }, Readable.prototype.unshift = function (chunk) { return readableAddChunk(this, chunk, null, !0, !1) }, Readable.prototype.isPaused = function () { return this._readableState.flowing === !1 }, Readable.prototype.setEncoding = function (enc) { return StringDecoder || (StringDecoder = __webpack_require__(159).StringDecoder), this._readableState.decoder = new StringDecoder(enc), this._readableState.encoding = enc, this }; var MAX_HWM = 8388608; Readable.prototype.read = function (n) { debug("read", n), n = parseInt(n, 10); var state = this._readableState, nOrig = n; if (0 !== n && (state.emittedReadable = !1), 0 === n && state.needReadable && (state.length >= state.highWaterMark || state.ended)) return debug("read: emitReadable", state.length, state.ended), 0 === state.length && state.ended ? endReadable(this) : emitReadable(this), null; if (n = howMuchToRead(n, state), 0 === n && state.ended) return 0 === state.length && endReadable(this), null; var doRead = state.needReadable; debug("need readable", doRead), (0 === state.length || state.length - n < state.highWaterMark) && (doRead = !0, debug("length less than watermark", doRead)), state.ended || state.reading ? (doRead = !1, debug("reading or ended", doRead)) : doRead && (debug("do read"), state.reading = !0, state.sync = !0, 0 === state.length && (state.needReadable = !0), this._read(state.highWaterMark), state.sync = !1, state.reading || (n = howMuchToRead(nOrig, state))); var ret; return ret = n > 0 ? fromList(n, state) : null, null === ret ? (state.needReadable = !0, n = 0) : state.length -= n, 0 === state.length && (state.ended || (state.needReadable = !0), nOrig !== n && state.ended && endReadable(this)), null !== ret && this.emit("data", ret), ret }, Readable.prototype._read = function (n) { this.emit("error", new Error("_read() is not implemented")) }, Readable.prototype.pipe = function (dest, pipeOpts) { function onunpipe(readable, unpipeInfo) { debug("onunpipe"), readable === src && unpipeInfo && unpipeInfo.hasUnpiped === !1 && (unpipeInfo.hasUnpiped = !0, cleanup()) } function onend() { debug("onend"), dest.end() } function cleanup() { debug("cleanup"), dest.removeListener("close", onclose), dest.removeListener("finish", onfinish), dest.removeListener("drain", ondrain), dest.removeListener("error", onerror), dest.removeListener("unpipe", onunpipe), src.removeListener("end", onend), src.removeListener("end", unpipe), src.removeListener("data", ondata), cleanedUp = !0, !state.awaitDrain || dest._writableState && !dest._writableState.needDrain || ondrain() } function ondata(chunk) { debug("ondata"), increasedAwaitDrain = !1; var ret = dest.write(chunk); !1 !== ret || increasedAwaitDrain || ((1 === state.pipesCount && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp && (debug("false write response, pause", state.awaitDrain), state.awaitDrain++ , increasedAwaitDrain = !0), src.pause()) } function onerror(er) { debug("onerror", er), unpipe(), dest.removeListener("error", onerror), 0 === EElistenerCount(dest, "error") && dest.emit("error", er) } function onclose() { dest.removeListener("finish", onfinish), unpipe() } function onfinish() { debug("onfinish"), dest.removeListener("close", onclose), unpipe() } function unpipe() { debug("unpipe"), src.unpipe(dest) } var src = this, state = this._readableState; switch (state.pipesCount) { case 0: state.pipes = dest; break; case 1: state.pipes = [state.pipes, dest]; break; default: state.pipes.push(dest) }state.pipesCount += 1, debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); var doEnd = (!pipeOpts || pipeOpts.end !== !1) && dest !== process.stdout && dest !== process.stderr, endFn = doEnd ? onend : unpipe; state.endEmitted ? pna.nextTick(endFn) : src.once("end", endFn), dest.on("unpipe", onunpipe); var ondrain = pipeOnDrain(src); dest.on("drain", ondrain); var cleanedUp = !1, increasedAwaitDrain = !1; return src.on("data", ondata), prependListener(dest, "error", onerror), dest.once("close", onclose), dest.once("finish", onfinish), dest.emit("pipe", src), state.flowing || (debug("pipe resume"), src.resume()), dest }, Readable.prototype.unpipe = function (dest) { var state = this._readableState, unpipeInfo = { hasUnpiped: !1 }; if (0 === state.pipesCount) return this; if (1 === state.pipesCount) return dest && dest !== state.pipes ? this : (dest || (dest = state.pipes), state.pipes = null, state.pipesCount = 0, state.flowing = !1, dest && dest.emit("unpipe", this, unpipeInfo), this); if (!dest) { var dests = state.pipes, len = state.pipesCount; state.pipes = null, state.pipesCount = 0, state.flowing = !1; for (var i = 0; i < len; i++)dests[i].emit("unpipe", this, { hasUnpiped: !1 }); return this } var index = indexOf(state.pipes, dest); return index === -1 ? this : (state.pipes.splice(index, 1), state.pipesCount -= 1, 1 === state.pipesCount && (state.pipes = state.pipes[0]), dest.emit("unpipe", this, unpipeInfo), this) }, Readable.prototype.on = function (ev, fn) { var res = Stream.prototype.on.call(this, ev, fn); if ("data" === ev) this._readableState.flowing !== !1 && this.resume(); else if ("readable" === ev) { var state = this._readableState; state.endEmitted || state.readableListening || (state.readableListening = state.needReadable = !0, state.emittedReadable = !1, state.reading ? state.length && emitReadable(this) : pna.nextTick(nReadingNextTick, this)) } return res }, Readable.prototype.addListener = Readable.prototype.on, Readable.prototype.resume = function () { var state = this._readableState; return state.flowing || (debug("resume"), state.flowing = !0, resume(this, state)), this }, Readable.prototype.pause = function () { return debug("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState.flowing && (debug("pause"), this._readableState.flowing = !1, this.emit("pause")), this }, Readable.prototype.wrap = function (stream) { var _this = this, state = this._readableState, paused = !1; stream.on("end", function () { if (debug("wrapped end"), state.decoder && !state.ended) { var chunk = state.decoder.end(); chunk && chunk.length && _this.push(chunk) } _this.push(null) }), stream.on("data", function (chunk) { if (debug("wrapped data"), state.decoder && (chunk = state.decoder.write(chunk)), (!state.objectMode || null !== chunk && void 0 !== chunk) && (state.objectMode || chunk && chunk.length)) { var ret = _this.push(chunk); ret || (paused = !0, stream.pause()) } }); for (var i in stream) void 0 === this[i] && "function" == typeof stream[i] && (this[i] = function (method) { return function () { return stream[method].apply(stream, arguments) } }(i)); for (var n = 0; n < kProxyEvents.length; n++)stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); return this._read = function (n) { debug("wrapped _read", n), paused && (paused = !1, stream.resume()) }, this }, Object.defineProperty(Readable.prototype, "readableHighWaterMark", { enumerable: !1, get: function () { return this._readableState.highWaterMark } }), Readable._fromList = fromList }).call(exports, function () { return this }(), __webpack_require__(30)) }, function(module, exports, __webpack_require__) { (function (process) { "use strict"; function nextTick(fn, arg1, arg2, arg3) { if ("function" != typeof fn) throw new TypeError('"callback" argument must be a function'); var args, i, len = arguments.length; switch (len) { case 0: case 1: return process.nextTick(fn); case 2: return process.nextTick(function () { fn.call(null, arg1) }); case 3: return process.nextTick(function () { fn.call(null, arg1, arg2) }); case 4: return process.nextTick(function () { fn.call(null, arg1, arg2, arg3) }); default: for (args = new Array(len - 1), i = 0; i < args.length;)args[i++] = arguments[i]; return process.nextTick(function () { fn.apply(null, args) }) } } "undefined" == typeof process || !process.version || 0 === process.version.indexOf("v0.") || 0 === process.version.indexOf("v1.") && 0 !== process.version.indexOf("v1.8.") ? module.exports = { nextTick: nextTick } : module.exports = process }).call(exports, __webpack_require__(30)) }, function(module, exports, __webpack_require__) { module.exports = __webpack_require__(144).EventEmitter }, function(module, exports, __webpack_require__) { function copyProps(src, dst) { for (var key in src) dst[key] = src[key] } function SafeBuffer(arg, encodingOrOffset, length) { return Buffer(arg, encodingOrOffset, length) } var buffer = __webpack_require__(118), Buffer = buffer.Buffer; Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow ? module.exports = buffer : (copyProps(buffer, exports), exports.Buffer = SafeBuffer), copyProps(Buffer, SafeBuffer), SafeBuffer.from = function (arg, encodingOrOffset, length) { if ("number" == typeof arg) throw new TypeError("Argument must not be a number"); return Buffer(arg, encodingOrOffset, length) }, SafeBuffer.alloc = function (size, fill, encoding) { if ("number" != typeof size) throw new TypeError("Argument must be a number"); var buf = Buffer(size); return void 0 !== fill ? "string" == typeof encoding ? buf.fill(fill, encoding) : buf.fill(fill) : buf.fill(0), buf }, SafeBuffer.allocUnsafe = function (size) { if ("number" != typeof size) throw new TypeError("Argument must be a number"); return Buffer(size) }, SafeBuffer.allocUnsafeSlow = function (size) { if ("number" != typeof size) throw new TypeError("Argument must be a number"); return buffer.SlowBuffer(size) } }, function(module, exports, __webpack_require__) { function isArray(arg) { return Array.isArray ? Array.isArray(arg) : "[object Array]" === objectToString(arg) } function isBoolean(arg) { return "boolean" == typeof arg } function isNull(arg) { return null === arg } function isNullOrUndefined(arg) { return null == arg } function isNumber(arg) { return "number" == typeof arg } function isString(arg) { return "string" == typeof arg } function isSymbol(arg) { return "symbol" == typeof arg } function isUndefined(arg) { return void 0 === arg } function isRegExp(re) { return "[object RegExp]" === objectToString(re) } function isObject(arg) { return "object" == typeof arg && null !== arg } function isDate(d) { return "[object Date]" === objectToString(d) } function isError(e) { return "[object Error]" === objectToString(e) || e instanceof Error } function isFunction(arg) { return "function" == typeof arg } function isPrimitive(arg) { return null === arg || "boolean" == typeof arg || "number" == typeof arg || "string" == typeof arg || "symbol" == typeof arg || "undefined" == typeof arg } function objectToString(o) { return Object.prototype.toString.call(o) } exports.isArray = isArray, exports.isBoolean = isBoolean, exports.isNull = isNull, exports.isNullOrUndefined = isNullOrUndefined, exports.isNumber = isNumber, exports.isString = isString, exports.isSymbol = isSymbol, exports.isUndefined = isUndefined, exports.isRegExp = isRegExp, exports.isObject = isObject, exports.isDate = isDate, exports.isError = isError, exports.isFunction = isFunction, exports.isPrimitive = isPrimitive, exports.isBuffer = __webpack_require__(118).Buffer.isBuffer }, function(module, exports) { }, function(module, exports, __webpack_require__) { "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function copyBuffer(src, target, offset) { src.copy(target, offset) } var Buffer = __webpack_require__(150).Buffer, util = __webpack_require__(154); module.exports = function () { function BufferList() { _classCallCheck(this, BufferList), this.head = null, this.tail = null, this.length = 0 } return BufferList.prototype.push = function (v) { var entry = { data: v, next: null }; this.length > 0 ? this.tail.next = entry : this.head = entry, this.tail = entry, ++this.length }, BufferList.prototype.unshift = function (v) { var entry = { data: v, next: this.head }; 0 === this.length && (this.tail = entry), this.head = entry, ++this.length }, BufferList.prototype.shift = function () { if (0 !== this.length) { var ret = this.head.data; return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, --this.length, ret } }, BufferList.prototype.clear = function () { this.head = this.tail = null, this.length = 0 }, BufferList.prototype.join = function (s) { if (0 === this.length) return ""; for (var p = this.head, ret = "" + p.data; p = p.next;)ret += s + p.data; return ret }, BufferList.prototype.concat = function (n) { if (0 === this.length) return Buffer.alloc(0); for (var ret = Buffer.allocUnsafe(n >>> 0), p = this.head, i = 0; p;)copyBuffer(p.data, ret, i), i += p.data.length, p = p.next; return ret }, BufferList }(), util && util.inspect && util.inspect.custom && (module.exports.prototype[util.inspect.custom] = function () { var obj = util.inspect({ length: this.length }); return this.constructor.name + " " + obj }) }, function(module, exports) { }, function(module, exports, __webpack_require__) { "use strict"; function destroy(err, cb) { var _this = this, readableDestroyed = this._readableState && this._readableState.destroyed, writableDestroyed = this._writableState && this._writableState.destroyed; return readableDestroyed || writableDestroyed ? (cb ? cb(err) : err && (this._writableState ? this._writableState.errorEmitted || (this._writableState.errorEmitted = !0, pna.nextTick(emitErrorNT, this, err)) : pna.nextTick(emitErrorNT, this, err)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(err || null, function (err) { !cb && err ? _this._writableState ? _this._writableState.errorEmitted || (_this._writableState.errorEmitted = !0, pna.nextTick(emitErrorNT, _this, err)) : pna.nextTick(emitErrorNT, _this, err) : cb && cb(err) }), this) } function undestroy() { this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1) } function emitErrorNT(self, err) { self.emit("error", err) } var pna = __webpack_require__(148); module.exports = { destroy: destroy, undestroy: undestroy } }, function(module, exports, __webpack_require__) { "use strict"; function Duplex(options) { return this instanceof Duplex ? (Readable.call(this, options), Writable.call(this, options), options && options.readable === !1 && (this.readable = !1), options && options.writable === !1 && (this.writable = !1), this.allowHalfOpen = !0, options && options.allowHalfOpen === !1 && (this.allowHalfOpen = !1), void this.once("end", onend)) : new Duplex(options) } function onend() { this.allowHalfOpen || this._writableState.ended || pna.nextTick(onEndNT, this) } function onEndNT(self) { self.end() } var pna = __webpack_require__(148), objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) keys.push(key); return keys }; module.exports = Duplex; var util = Object.create(__webpack_require__(151)); util.inherits = __webpack_require__(145); var Readable = __webpack_require__(147), Writable = __webpack_require__(157); util.inherits(Duplex, Readable); for (var keys = objectKeys(Writable.prototype), v = 0; v < keys.length; v++) { var method = keys[v]; Duplex.prototype[method] || (Duplex.prototype[method] = Writable.prototype[method]) } Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { enumerable: !1, get: function () { return this._writableState.highWaterMark } }), Object.defineProperty(Duplex.prototype, "destroyed", { get: function () { return void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState.destroyed && this._writableState.destroyed) }, set: function (value) { void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState.destroyed = value, this._writableState.destroyed = value) } }), Duplex.prototype._destroy = function (err, cb) { this.push(null), this.end(), pna.nextTick(cb, err) } }, function(module, exports, __webpack_require__) { (function (process, setImmediate, global) { "use strict"; function CorkedRequest(state) { var _this = this; this.next = null, this.entry = null, this.finish = function () { onCorkedFinish(_this, state) } } function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk) } function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array } function nop() { } function WritableState(options, stream) { Duplex = Duplex || __webpack_require__(156), options = options || {}; var isDuplex = stream instanceof Duplex; this.objectMode = !!options.objectMode, isDuplex && (this.objectMode = this.objectMode || !!options.writableObjectMode); var hwm = options.highWaterMark, writableHwm = options.writableHighWaterMark, defaultHwm = this.objectMode ? 16 : 16384; hwm || 0 === hwm ? this.highWaterMark = hwm : isDuplex && (writableHwm || 0 === writableHwm) ? this.highWaterMark = writableHwm : this.highWaterMark = defaultHwm, this.highWaterMark = Math.floor(this.highWaterMark), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1; var noDecode = options.decodeStrings === !1; this.decodeStrings = !noDecode, this.defaultEncoding = options.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function (er) { onwrite(stream, er) }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new CorkedRequest(this) } function Writable(options) { return Duplex = Duplex || __webpack_require__(156), realHasInstance.call(Writable, this) || this instanceof Duplex ? (this._writableState = new WritableState(options, this), this.writable = !0, options && ("function" == typeof options.write && (this._write = options.write), "function" == typeof options.writev && (this._writev = options.writev), "function" == typeof options.destroy && (this._destroy = options.destroy), "function" == typeof options.final && (this._final = options.final)), void Stream.call(this)) : new Writable(options) } function writeAfterEnd(stream, cb) { var er = new Error("write after end"); stream.emit("error", er), pna.nextTick(cb, er) } function validChunk(stream, state, chunk, cb) { var valid = !0, er = !1; return null === chunk ? er = new TypeError("May not write null values to stream") : "string" == typeof chunk || void 0 === chunk || state.objectMode || (er = new TypeError("Invalid non-string/buffer chunk")), er && (stream.emit("error", er), pna.nextTick(cb, er), valid = !1), valid } function decodeChunk(state, chunk, encoding) { return state.objectMode || state.decodeStrings === !1 || "string" != typeof chunk || (chunk = Buffer.from(chunk, encoding)), chunk } function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { if (!isBuf) { var newChunk = decodeChunk(state, chunk, encoding); chunk !== newChunk && (isBuf = !0, encoding = "buffer", chunk = newChunk) } var len = state.objectMode ? 1 : chunk.length; state.length += len; var ret = state.length < state.highWaterMark; if (ret || (state.needDrain = !0), state.writing || state.corked) { var last = state.lastBufferedRequest; state.lastBufferedRequest = { chunk: chunk, encoding: encoding, isBuf: isBuf, callback: cb, next: null }, last ? last.next = state.lastBufferedRequest : state.bufferedRequest = state.lastBufferedRequest, state.bufferedRequestCount += 1 } else doWrite(stream, state, !1, len, chunk, encoding, cb); return ret } function doWrite(stream, state, writev, len, chunk, encoding, cb) { state.writelen = len, state.writecb = cb, state.writing = !0, state.sync = !0, writev ? stream._writev(chunk, state.onwrite) : stream._write(chunk, encoding, state.onwrite), state.sync = !1 } function onwriteError(stream, state, sync, er, cb) { --state.pendingcb, sync ? (pna.nextTick(cb, er), pna.nextTick(finishMaybe, stream, state), stream._writableState.errorEmitted = !0, stream.emit("error", er)) : (cb(er), stream._writableState.errorEmitted = !0, stream.emit("error", er), finishMaybe(stream, state)) } function onwriteStateUpdate(state) { state.writing = !1, state.writecb = null, state.length -= state.writelen, state.writelen = 0 } function onwrite(stream, er) { var state = stream._writableState, sync = state.sync, cb = state.writecb; if (onwriteStateUpdate(state), er) onwriteError(stream, state, sync, er, cb); else { var finished = needFinish(state); finished || state.corked || state.bufferProcessing || !state.bufferedRequest || clearBuffer(stream, state), sync ? asyncWrite(afterWrite, stream, state, finished, cb) : afterWrite(stream, state, finished, cb) } } function afterWrite(stream, state, finished, cb) { finished || onwriteDrain(stream, state), state.pendingcb-- , cb(), finishMaybe(stream, state) } function onwriteDrain(stream, state) { 0 === state.length && state.needDrain && (state.needDrain = !1, stream.emit("drain")) } function clearBuffer(stream, state) { state.bufferProcessing = !0; var entry = state.bufferedRequest; if (stream._writev && entry && entry.next) { var l = state.bufferedRequestCount, buffer = new Array(l), holder = state.corkedRequestsFree; holder.entry = entry; for (var count = 0, allBuffers = !0; entry;)buffer[count] = entry, entry.isBuf || (allBuffers = !1), entry = entry.next, count += 1; buffer.allBuffers = allBuffers, doWrite(stream, state, !0, state.length, buffer, "", holder.finish), state.pendingcb++ , state.lastBufferedRequest = null, holder.next ? (state.corkedRequestsFree = holder.next, holder.next = null) : state.corkedRequestsFree = new CorkedRequest(state), state.bufferedRequestCount = 0 } else { for (; entry;) { var chunk = entry.chunk, encoding = entry.encoding, cb = entry.callback, len = state.objectMode ? 1 : chunk.length; if (doWrite(stream, state, !1, len, chunk, encoding, cb), entry = entry.next, state.bufferedRequestCount-- , state.writing) break } null === entry && (state.lastBufferedRequest = null) } state.bufferedRequest = entry, state.bufferProcessing = !1 } function needFinish(state) { return state.ending && 0 === state.length && null === state.bufferedRequest && !state.finished && !state.writing } function callFinal(stream, state) { stream._final(function (err) { state.pendingcb-- , err && stream.emit("error", err), state.prefinished = !0, stream.emit("prefinish"), finishMaybe(stream, state) }) } function prefinish(stream, state) { state.prefinished || state.finalCalled || ("function" == typeof stream._final ? (state.pendingcb++ , state.finalCalled = !0, pna.nextTick(callFinal, stream, state)) : (state.prefinished = !0, stream.emit("prefinish"))) } function finishMaybe(stream, state) { var need = needFinish(state); return need && (prefinish(stream, state), 0 === state.pendingcb && (state.finished = !0, stream.emit("finish"))), need } function endWritable(stream, state, cb) { state.ending = !0, finishMaybe(stream, state), cb && (state.finished ? pna.nextTick(cb) : stream.once("finish", cb)), state.ended = !0, stream.writable = !1 } function onCorkedFinish(corkReq, state, err) { var entry = corkReq.entry; for (corkReq.entry = null; entry;) { var cb = entry.callback; state.pendingcb-- , cb(err), entry = entry.next } state.corkedRequestsFree.next = corkReq } var pna = __webpack_require__(148); module.exports = Writable; var Duplex, asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; Writable.WritableState = WritableState; var util = Object.create(__webpack_require__(151)); util.inherits = __webpack_require__(145); var internalUtil = { deprecate: __webpack_require__(158) }, Stream = __webpack_require__(149), Buffer = __webpack_require__(150).Buffer, OurUint8Array = ("undefined" != typeof global ? global : "undefined" != typeof window ? window : "undefined" != typeof self ? self : {}).Uint8Array || function () { }, destroyImpl = __webpack_require__(155); util.inherits(Writable, Stream), WritableState.prototype.getBuffer = function () { for (var current = this.bufferedRequest, out = []; current;)out.push(current), current = current.next; return out }, function () { try { Object.defineProperty(WritableState.prototype, "buffer", { get: internalUtil.deprecate(function () { return this.getBuffer() }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }) } catch (_) { } }(); var realHasInstance; "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[Symbol.hasInstance] ? (realHasInstance = Function.prototype[Symbol.hasInstance], Object.defineProperty(Writable, Symbol.hasInstance, { value: function (object) { return !!realHasInstance.call(this, object) || this === Writable && (object && object._writableState instanceof WritableState) } })) : realHasInstance = function (object) { return object instanceof this }, Writable.prototype.pipe = function () { this.emit("error", new Error("Cannot pipe, not readable")) }, Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState, ret = !1, isBuf = !state.objectMode && _isUint8Array(chunk); return isBuf && !Buffer.isBuffer(chunk) && (chunk = _uint8ArrayToBuffer(chunk)), "function" == typeof encoding && (cb = encoding, encoding = null), isBuf ? encoding = "buffer" : encoding || (encoding = state.defaultEncoding), "function" != typeof cb && (cb = nop), state.ended ? writeAfterEnd(this, cb) : (isBuf || validChunk(this, state, chunk, cb)) && (state.pendingcb++ , ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb)), ret }, Writable.prototype.cork = function () { var state = this._writableState; state.corked++ }, Writable.prototype.uncork = function () { var state = this._writableState; state.corked && (state.corked-- , state.writing || state.corked || state.bufferProcessing || !state.bufferedRequest || clearBuffer(this, state)) }, Writable.prototype.setDefaultEncoding = function (encoding) { if ("string" == typeof encoding && (encoding = encoding.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + encoding); return this._writableState.defaultEncoding = encoding, this }, Object.defineProperty(Writable.prototype, "writableHighWaterMark", { enumerable: !1, get: function () { return this._writableState.highWaterMark } }), Writable.prototype._write = function (chunk, encoding, cb) { cb(new Error("_write() is not implemented")) }, Writable.prototype._writev = null, Writable.prototype.end = function (chunk, encoding, cb) { var state = this._writableState; "function" == typeof chunk ? (cb = chunk, chunk = null, encoding = null) : "function" == typeof encoding && (cb = encoding, encoding = null), null !== chunk && void 0 !== chunk && this.write(chunk, encoding), state.corked && (state.corked = 1, this.uncork()), state.ending || endWritable(this, state, cb) }, Object.defineProperty(Writable.prototype, "destroyed", { get: function () { return void 0 !== this._writableState && this._writableState.destroyed }, set: function (value) { this._writableState && (this._writableState.destroyed = value) } }), Writable.prototype.destroy = destroyImpl.destroy, Writable.prototype._undestroy = destroyImpl.undestroy, Writable.prototype._destroy = function (err, cb) { this.end(), cb(err) } }).call(exports, __webpack_require__(30), __webpack_require__(31).setImmediate, function () { return this }()) }, function(module, exports) { (function (global) { function deprecate(fn, msg) { function deprecated() { if (!warned) { if (config("throwDeprecation")) throw new Error(msg); config("traceDeprecation") ? console.trace(msg) : console.warn(msg), warned = !0 } return fn.apply(this, arguments) } if (config("noDeprecation")) return fn; var warned = !1; return deprecated } function config(name) { try { if (!global.localStorage) return !1 } catch (_) { return !1 } var val = global.localStorage[name]; return null != val && "true" === String(val).toLowerCase() } module.exports = deprecate }).call(exports, function () { return this }()) }, function(module, exports, __webpack_require__) { "use strict"; function _normalizeEncoding(enc) { if (!enc) return "utf8"; for (var retried; ;)switch (enc) { case "utf8": case "utf-8": return "utf8"; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return "utf16le"; case "latin1": case "binary": return "latin1"; case "base64": case "ascii": case "hex": return enc; default: if (retried) return; enc = ("" + enc).toLowerCase(), retried = !0 } } function normalizeEncoding(enc) { var nenc = _normalizeEncoding(enc); if ("string" != typeof nenc && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc); return nenc || enc } function StringDecoder(encoding) { this.encoding = normalizeEncoding(encoding); var nb; switch (this.encoding) { case "utf16le": this.text = utf16Text, this.end = utf16End, nb = 4; break; case "utf8": this.fillLast = utf8FillLast, nb = 4; break; case "base64": this.text = base64Text, this.end = base64End, nb = 3; break; default: return this.write = simpleWrite, void (this.end = simpleEnd) }this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Buffer.allocUnsafe(nb) } function utf8CheckByte(byte) { return byte <= 127 ? 0 : byte >> 5 === 6 ? 2 : byte >> 4 === 14 ? 3 : byte >> 3 === 30 ? 4 : byte >> 6 === 2 ? -1 : -2 } function utf8CheckIncomplete(self, buf, i) { var j = buf.length - 1; if (j < i) return 0; var nb = utf8CheckByte(buf[j]); return nb >= 0 ? (nb > 0 && (self.lastNeed = nb - 1), nb) : --j < i || nb === -2 ? 0 : (nb = utf8CheckByte(buf[j]), nb >= 0 ? (nb > 0 && (self.lastNeed = nb - 2), nb) : --j < i || nb === -2 ? 0 : (nb = utf8CheckByte(buf[j]), nb >= 0 ? (nb > 0 && (2 === nb ? nb = 0 : self.lastNeed = nb - 3), nb) : 0)) } function utf8CheckExtraBytes(self, buf, p) { if (128 !== (192 & buf[0])) return self.lastNeed = 0, "�"; if (self.lastNeed > 1 && buf.length > 1) { if (128 !== (192 & buf[1])) return self.lastNeed = 1, "�"; if (self.lastNeed > 2 && buf.length > 2 && 128 !== (192 & buf[2])) return self.lastNeed = 2, "�" } } function utf8FillLast(buf) { var p = this.lastTotal - this.lastNeed, r = utf8CheckExtraBytes(this, buf, p); return void 0 !== r ? r : this.lastNeed <= buf.length ? (buf.copy(this.lastChar, p, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (buf.copy(this.lastChar, p, 0, buf.length), void (this.lastNeed -= buf.length)) } function utf8Text(buf, i) { var total = utf8CheckIncomplete(this, buf, i); if (!this.lastNeed) return buf.toString("utf8", i); this.lastTotal = total; var end = buf.length - (total - this.lastNeed); return buf.copy(this.lastChar, 0, end), buf.toString("utf8", i, end) } function utf8End(buf) { var r = buf && buf.length ? this.write(buf) : ""; return this.lastNeed ? r + "�" : r } function utf16Text(buf, i) { if ((buf.length - i) % 2 === 0) { var r = buf.toString("utf16le", i); if (r) { var c = r.charCodeAt(r.length - 1); if (c >= 55296 && c <= 56319) return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = buf[buf.length - 2], this.lastChar[1] = buf[buf.length - 1], r.slice(0, -1) } return r } return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = buf[buf.length - 1], buf.toString("utf16le", i, buf.length - 1) } function utf16End(buf) { var r = buf && buf.length ? this.write(buf) : ""; if (this.lastNeed) { var end = this.lastTotal - this.lastNeed; return r + this.lastChar.toString("utf16le", 0, end) } return r } function base64Text(buf, i) { var n = (buf.length - i) % 3; return 0 === n ? buf.toString("base64", i) : (this.lastNeed = 3 - n, this.lastTotal = 3, 1 === n ? this.lastChar[0] = buf[buf.length - 1] : (this.lastChar[0] = buf[buf.length - 2], this.lastChar[1] = buf[buf.length - 1]), buf.toString("base64", i, buf.length - n)) } function base64End(buf) { var r = buf && buf.length ? this.write(buf) : ""; return this.lastNeed ? r + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : r } function simpleWrite(buf) { return buf.toString(this.encoding) } function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : "" } var Buffer = __webpack_require__(150).Buffer, isEncoding = Buffer.isEncoding || function (encoding) { switch (encoding = "" + encoding, encoding && encoding.toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": case "raw": return !0; default: return !1 } }; exports.StringDecoder = StringDecoder, StringDecoder.prototype.write = function (buf) { if (0 === buf.length) return ""; var r, i; if (this.lastNeed) { if (r = this.fillLast(buf), void 0 === r) return ""; i = this.lastNeed, this.lastNeed = 0 } else i = 0; return i < buf.length ? r ? r + this.text(buf, i) : this.text(buf, i) : r || "" }, StringDecoder.prototype.end = utf8End, StringDecoder.prototype.text = utf8Text, StringDecoder.prototype.fillLast = function (buf) { return this.lastNeed <= buf.length ? (buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length), void (this.lastNeed -= buf.length)) } }, function(module, exports, __webpack_require__) { "use strict"; function afterTransform(er, data) { var ts = this._transformState; ts.transforming = !1; var cb = ts.writecb; if (!cb) return this.emit("error", new Error("write callback called multiple times")); ts.writechunk = null, ts.writecb = null, null != data && this.push(data), cb(er); var rs = this._readableState; rs.reading = !1, (rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark) } function Transform(options) { return this instanceof Transform ? (Duplex.call(this, options), this._transformState = { afterTransform: afterTransform.bind(this), needTransform: !1, transforming: !1, writecb: null, writechunk: null, writeencoding: null }, this._readableState.needReadable = !0, this._readableState.sync = !1, options && ("function" == typeof options.transform && (this._transform = options.transform), "function" == typeof options.flush && (this._flush = options.flush)), void this.on("prefinish", prefinish)) : new Transform(options) } function prefinish() { var _this = this; "function" == typeof this._flush ? this._flush(function (er, data) { done(_this, er, data) }) : done(this, null, null) } function done(stream, er, data) { if (er) return stream.emit("error", er); if (null != data && stream.push(data), stream._writableState.length) throw new Error("Calling transform done when ws.length != 0"); if (stream._transformState.transforming) throw new Error("Calling transform done when still transforming"); return stream.push(null) } module.exports = Transform; var Duplex = __webpack_require__(156), util = Object.create(__webpack_require__(151)); util.inherits = __webpack_require__(145), util.inherits(Transform, Duplex), Transform.prototype.push = function (chunk, encoding) { return this._transformState.needTransform = !1, Duplex.prototype.push.call(this, chunk, encoding) }, Transform.prototype._transform = function (chunk, encoding, cb) { throw new Error("_transform() is not implemented") }, Transform.prototype._write = function (chunk, encoding, cb) { var ts = this._transformState; if (ts.writecb = cb, ts.writechunk = chunk, ts.writeencoding = encoding, !ts.transforming) { var rs = this._readableState; (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark) } }, Transform.prototype._read = function (n) { var ts = this._transformState; null !== ts.writechunk && ts.writecb && !ts.transforming ? (ts.transforming = !0, this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform)) : ts.needTransform = !0 }, Transform.prototype._destroy = function (err, cb) { var _this2 = this; Duplex.prototype._destroy.call(this, err, function (err2) { cb(err2), _this2.emit("close") }) } }, function(module, exports, __webpack_require__) { "use strict"; function PassThrough(options) { return this instanceof PassThrough ? void Transform.call(this, options) : new PassThrough(options) } module.exports = PassThrough; var Transform = __webpack_require__(160), util = Object.create(__webpack_require__(151)); util.inherits = __webpack_require__(145), util.inherits(PassThrough, Transform), PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk) } }, function(module, exports, __webpack_require__) { module.exports = __webpack_require__(157) }, function(module, exports, __webpack_require__) { module.exports = __webpack_require__(156) }, function(module, exports, __webpack_require__) { module.exports = __webpack_require__(146).Transform }, function(module, exports, __webpack_require__) { module.exports = __webpack_require__(146).PassThrough }, function(module, exports) { exports["aes-128-ecb"] = { cipher: "AES", key: 128, iv: 0, mode: "ECB", type: "block" }, exports["aes-192-ecb"] = { cipher: "AES", key: 192, iv: 0, mode: "ECB", type: "block" }, exports["aes-256-ecb"] = { cipher: "AES", key: 256, iv: 0, mode: "ECB", type: "block" }, exports["aes-128-cbc"] = { cipher: "AES", key: 128, iv: 16, mode: "CBC", type: "block" }, exports["aes-192-cbc"] = { cipher: "AES", key: 192, iv: 16, mode: "CBC", type: "block" }, exports["aes-256-cbc"] = { cipher: "AES", key: 256, iv: 16, mode: "CBC", type: "block" }, exports.aes128 = exports["aes-128-cbc"], exports.aes192 = exports["aes-192-cbc"], exports.aes256 = exports["aes-256-cbc"], exports["aes-128-cfb"] = { cipher: "AES", key: 128, iv: 16, mode: "CFB", type: "stream" }, exports["aes-192-cfb"] = { cipher: "AES", key: 192, iv: 16, mode: "CFB", type: "stream" }, exports["aes-256-cfb"] = { cipher: "AES", key: 256, iv: 16, mode: "CFB", type: "stream" }, exports["aes-128-ofb"] = { cipher: "AES", key: 128, iv: 16, mode: "OFB", type: "stream" }, exports["aes-192-ofb"] = { cipher: "AES", key: 192, iv: 16, mode: "OFB", type: "stream" }, exports["aes-256-ofb"] = { cipher: "AES", key: 256, iv: 16, mode: "OFB", type: "stream" }, exports["aes-128-ctr"] = { cipher: "AES", key: 128, iv: 16, mode: "CTR", type: "stream" }, exports["aes-192-ctr"] = { cipher: "AES", key: 192, iv: 16, mode: "CTR", type: "stream" }, exports["aes-256-ctr"] = { cipher: "AES", key: 256, iv: 16, mode: "CTR", type: "stream" } }, function(module, exports, __webpack_require__) { (function (Buffer) { module.exports = function (crypto, password, keyLen, ivLen) { keyLen /= 8, ivLen = ivLen || 0; for (var md, md_buf, i, ki = 0, ii = 0, key = new Buffer(keyLen), iv = new Buffer(ivLen), addmd = 0; ;) { if (md = crypto.createHash("md5"), addmd++ > 0 && md.update(md_buf), md.update(password), md_buf = md.digest(), i = 0, keyLen > 0) for (; ;) { if (0 === keyLen) break; if (i === md_buf.length) break; key[ki++] = md_buf[i], keyLen-- , i++ } if (ivLen > 0 && i !== md_buf.length) for (; ;) { if (0 === ivLen) break; if (i === md_buf.length) break; iv[ii++] = md_buf[i], ivLen-- , i++ } if (0 === keyLen && 0 === ivLen) break } for (i = 0; i < md_buf.length; i++)md_buf[i] = 0; return { key: key, iv: iv } } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function StreamCipher(mode, key, iv, decrypt) { return this instanceof StreamCipher ? (Transform.call(this), this._cipher = new aes.AES(key), this._prev = new Buffer(iv.length), this._cache = new Buffer(""), this._secCache = new Buffer(""), this._decrypt = decrypt, iv.copy(this._prev), void (this._mode = mode)) : new StreamCipher(mode, key, iv) } var aes = __webpack_require__(141), Transform = __webpack_require__(142), inherits = __webpack_require__(145); inherits(StreamCipher, Transform), module.exports = StreamCipher, StreamCipher.prototype._transform = function (chunk, _, next) { next(null, this._mode.encrypt(this, chunk, this._decrypt)) }, StreamCipher.prototype._flush = function (next) { this._cipher.scrub(), next() } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports) { exports.encrypt = function (self, block) { return self._cipher.encryptBlock(block) }, exports.decrypt = function (self, block) { return self._cipher.decryptBlock(block) } }, function(module, exports, __webpack_require__) { var xor = __webpack_require__(171); exports.encrypt = function (self, block) { var data = xor(block, self._prev); return self._prev = self._cipher.encryptBlock(data), self._prev }, exports.decrypt = function (self, block) { var pad = self._prev; self._prev = block; var out = self._cipher.decryptBlock(block); return xor(out, pad) } }, function(module, exports, __webpack_require__) { (function (Buffer) { function xor(a, b) { for (var len = Math.min(a.length, b.length), out = new Buffer(len), i = -1; ++i < len;)out.writeUInt8(a[i] ^ b[i], i); return out } module.exports = xor }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function encryptStart(self, data, decrypt) { var len = data.length, out = xor(data, self._cache); return self._cache = self._cache.slice(len), self._prev = Buffer.concat([self._prev, decrypt ? data : out]), out } var xor = __webpack_require__(171); exports.encrypt = function (self, data, decrypt) { for (var len, out = new Buffer(""); data.length;) { if (0 === self._cache.length && (self._cache = self._cipher.encryptBlock(self._prev), self._prev = new Buffer("")), !(self._cache.length <= data.length)) { out = Buffer.concat([out, encryptStart(self, data, decrypt)]); break } len = self._cache.length, out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]), data = data.slice(len) } return out } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function getBlock(self) { return self._prev = self._cipher.encryptBlock(self._prev), self._prev } var xor = __webpack_require__(171); exports.encrypt = function (self, chunk) { for (; self._cache.length < chunk.length;)self._cache = Buffer.concat([self._cache, getBlock(self)]); var pad = self._cache.slice(0, chunk.length); return self._cache = self._cache.slice(chunk.length), xor(chunk, pad) } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function getBlock(self) { var out = self._cipher.encryptBlock(self._prev); return incr32(self._prev), out } function incr32(iv) { for (var item, len = iv.length; len--;) { if (item = iv.readUInt8(len), 255 !== item) { item++ , iv.writeUInt8(item, len); break } iv.writeUInt8(0, len) } } var xor = __webpack_require__(171); exports.encrypt = function (self, chunk) { for (; self._cache.length < chunk.length;)self._cache = Buffer.concat([self._cache, getBlock(self)]); var pad = self._cache.slice(0, chunk.length); return self._cache = self._cache.slice(chunk.length), xor(chunk, pad) } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (Buffer) { function Decipher(mode, key, iv) { return this instanceof Decipher ? (Transform.call(this), this._cache = new Splitter, this._last = void 0, this._cipher = new aes.AES(key), this._prev = new Buffer(iv.length), iv.copy(this._prev), void (this._mode = mode)) : new Decipher(mode, key, iv) } function Splitter() { return this instanceof Splitter ? void (this.cache = new Buffer("")) : new Splitter } function unpad(last) { var padded = last[15]; if (16 !== padded) return last.slice(0, 16 - padded) } var aes = __webpack_require__(141), Transform = __webpack_require__(142), inherits = __webpack_require__(145), modes = __webpack_require__(166), StreamCipher = __webpack_require__(168), ebtk = __webpack_require__(167); inherits(Decipher, Transform), Decipher.prototype._transform = function (data, _, next) { this._cache.add(data); for (var chunk, thing; chunk = this._cache.get();)thing = this._mode.decrypt(this, chunk), this.push(thing); next() }, Decipher.prototype._flush = function (next) { var chunk = this._cache.flush(); return chunk ? (this.push(unpad(this._mode.decrypt(this, chunk))), void next()) : next }, Splitter.prototype.add = function (data) { this.cache = Buffer.concat([this.cache, data]) }, Splitter.prototype.get = function () { if (this.cache.length > 16) { var out = this.cache.slice(0, 16); return this.cache = this.cache.slice(16), out } return null }, Splitter.prototype.flush = function () { if (this.cache.length) return this.cache }; var modelist = { ECB: __webpack_require__(169), CBC: __webpack_require__(170), CFB: __webpack_require__(172), OFB: __webpack_require__(173), CTR: __webpack_require__(174) }; module.exports = function (crypto) { function createDecipheriv(suite, password, iv) { var config = modes[suite]; if (!config) throw new TypeError("invalid suite type"); if ("string" == typeof iv && (iv = new Buffer(iv)), "string" == typeof password && (password = new Buffer(password)), password.length !== config.key / 8) throw new TypeError("invalid key length " + password.length); if (iv.length !== config.iv) throw new TypeError("invalid iv length " + iv.length); return "stream" === config.type ? new StreamCipher(modelist[config.mode], password, iv, !0) : new Decipher(modelist[config.mode], password, iv) } function createDecipher(suite, password) { var config = modes[suite]; if (!config) throw new TypeError("invalid suite type"); var keys = ebtk(crypto, password, config.key, config.iv); return createDecipheriv(suite, keys.key, keys.iv) } return { createDecipher: createDecipher, createDecipheriv: createDecipheriv } } }).call(exports, __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { (function (process, Buffer) { function isInBrowser() { return "browser" === environment || "node" !== environment && ("undefined" != typeof window && "function" == typeof XMLHttpRequest && !(window.require && window.module && window.process && "renderer" === window.process.type)) } function hasGlobalProcessEventEmitter() { return "object" == typeof process && null !== process && "function" == typeof process.on } function handlerExec(list) { return function (arg) { for (var i = 0; i < list.length; i++) { var ret = list[i](arg); if (ret) return ret } return null } } function supportRelativeURL(file, url) { if (!file) return url; var dir = path.dirname(file), match = /^\w+:\/\/[^\/]*/.exec(dir), protocol = match ? match[0] : "", startPath = dir.slice(protocol.length); return protocol && /^\/\w\:/.test(startPath) ? (protocol += "/", protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/")) : protocol + path.resolve(dir.slice(protocol.length), url) } function retrieveSourceMapURL(source) { var fileData; if (isInBrowser()) try { var xhr = new XMLHttpRequest; xhr.open("GET", source, !1), xhr.send(null), fileData = 4 === xhr.readyState ? xhr.responseText : null; var sourceMapHeader = xhr.getResponseHeader("SourceMap") || xhr.getResponseHeader("X-SourceMap"); if (sourceMapHeader) return sourceMapHeader } catch (e) { } fileData = retrieveFile(source); for (var lastMatch, match, re = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm; match = re.exec(fileData);)lastMatch = match; return lastMatch ? lastMatch[1] : null } function mapSourcePosition(position) { var sourceMap = sourceMapCache[position.source]; if (!sourceMap) { var urlAndMap = retrieveSourceMap(position.source); urlAndMap ? (sourceMap = sourceMapCache[position.source] = { url: urlAndMap.url, map: new SourceMapConsumer(urlAndMap.map) }, sourceMap.map.sourcesContent && sourceMap.map.sources.forEach(function (source, i) { var contents = sourceMap.map.sourcesContent[i]; if (contents) { var url = supportRelativeURL(sourceMap.url, source); fileContentsCache[url] = contents } })) : sourceMap = sourceMapCache[position.source] = { url: null, map: null } } if (sourceMap && sourceMap.map) { var originalPosition = sourceMap.map.originalPositionFor(position); if (null !== originalPosition.source) return originalPosition.source = supportRelativeURL(sourceMap.url, originalPosition.source), originalPosition } return position } function mapEvalOrigin(origin) { var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin); if (match) { var position = mapSourcePosition({ source: match[2], line: +match[3], column: match[4] - 1 }); return "eval at " + match[1] + " (" + position.source + ":" + position.line + ":" + (position.column + 1) + ")" } return match = /^eval at ([^(]+) \((.+)\)$/.exec(origin), match ? "eval at " + match[1] + " (" + mapEvalOrigin(match[2]) + ")" : origin } function CallSiteToString() { var fileName, fileLocation = ""; if (this.isNative()) fileLocation = "native"; else { fileName = this.getScriptNameOrSourceURL(), !fileName && this.isEval() && (fileLocation = this.getEvalOrigin(), fileLocation += ", "), fileLocation += fileName ? fileName : ""; var lineNumber = this.getLineNumber(); if (null != lineNumber) { fileLocation += ":" + lineNumber; var columnNumber = this.getColumnNumber(); columnNumber && (fileLocation += ":" + columnNumber) } } var line = "", functionName = this.getFunctionName(), addSuffix = !0, isConstructor = this.isConstructor(), isMethodCall = !(this.isToplevel() || isConstructor); if (isMethodCall) { var typeName = this.getTypeName(); "[object Object]" === typeName && (typeName = "null"); var methodName = this.getMethodName(); functionName ? (typeName && 0 != functionName.indexOf(typeName) && (line += typeName + "."), line += functionName, methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1 && (line += " [as " + methodName + "]")) : line += typeName + "." + (methodName || "") } else isConstructor ? line += "new " + (functionName || "") : functionName ? line += functionName : (line += fileLocation, addSuffix = !1); return addSuffix && (line += " (" + fileLocation + ")"), line } function cloneCallSite(frame) { var object = {}; return Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function (name) { object[name] = /^(?:is|get)/.test(name) ? function () { return frame[name].call(frame) } : frame[name] }), object.toString = CallSiteToString, object } function wrapCallSite(frame) { if (frame.isNative()) return frame; var source = frame.getFileName() || frame.getScriptNameOrSourceURL(); if (source) { var line = frame.getLineNumber(), column = frame.getColumnNumber() - 1, headerLength = 62; 1 === line && column > headerLength && !isInBrowser() && !frame.isEval() && (column -= headerLength); var position = mapSourcePosition({ source: source, line: line, column: column }); return frame = cloneCallSite(frame), frame.getFileName = function () { return position.source }, frame.getLineNumber = function () { return position.line }, frame.getColumnNumber = function () { return position.column + 1 }, frame.getScriptNameOrSourceURL = function () { return position.source }, frame } var origin = frame.isEval() && frame.getEvalOrigin(); return origin ? (origin = mapEvalOrigin(origin), frame = cloneCallSite(frame), frame.getEvalOrigin = function () { return origin }, frame) : frame } function prepareStackTrace(error, stack) { return emptyCacheBetweenOperations && (fileContentsCache = {}, sourceMapCache = {}), error + stack.map(function (frame) { return "\n at " + wrapCallSite(frame) }).join("") } function getErrorSource(error) { var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack); if (match) { var source = match[1], line = +match[2], column = +match[3], contents = fileContentsCache[source]; if (!contents && fs && fs.existsSync(source)) try { contents = fs.readFileSync(source, "utf8") } catch (er) { contents = "" } if (contents) { var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1]; if (code) return source + ":" + line + "\n" + code + "\n" + new Array(column).join(" ") + "^" } } return null } function printErrorAndExit(error) { var source = getErrorSource(error); source && (console.error(), console.error(source)), console.error(error.stack), process.exit(1) } function shimEmitUncaughtException() { var origEmit = process.emit; process.emit = function (type) { if ("uncaughtException" === type) { var hasStack = arguments[1] && arguments[1].stack, hasListeners = this.listeners(type).length > 0; if (hasStack && !hasListeners) return printErrorAndExit(arguments[1]) } return origEmit.apply(this, arguments) } } var fs, SourceMapConsumer = __webpack_require__(177).SourceMapConsumer, path = __webpack_require__(188); try { fs = __webpack_require__(189), fs.existsSync && fs.readFileSync || (fs = null) } catch (err) { } var errorFormatterInstalled = !1, uncaughtShimInstalled = !1, emptyCacheBetweenOperations = !1, environment = "auto", fileContentsCache = {}, sourceMapCache = {}, reSourceMap = /^data:application\/json[^,]+base64,/, retrieveFileHandlers = [], retrieveMapHandlers = [], retrieveFile = handlerExec(retrieveFileHandlers); retrieveFileHandlers.push(function (path) { if (path = path.trim(), /^file:/.test(path) && (path = path.replace(/file:\/\/(\w:\\|\/)/, "")), path in fileContentsCache) return fileContentsCache[path]; var contents = null; if (fs) { if (fs.existsSync(path)) try { contents = fs.readFileSync(path, "utf8") } catch (er) { contents = "" } } else { var xhr = new XMLHttpRequest; xhr.open("GET", path, !1), xhr.send(null); var contents = null; 4 === xhr.readyState && 200 === xhr.status && (contents = xhr.responseText) } return fileContentsCache[path] = contents }); var retrieveSourceMap = handlerExec(retrieveMapHandlers); retrieveMapHandlers.push(function (source) { var sourceMappingURL = retrieveSourceMapURL(source); if (!sourceMappingURL) return null; var sourceMapData; if (reSourceMap.test(sourceMappingURL)) { var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1); sourceMapData = new Buffer(rawData, "base64").toString(), sourceMappingURL = source } else sourceMappingURL = supportRelativeURL(source, sourceMappingURL), sourceMapData = retrieveFile(sourceMappingURL); return sourceMapData ? { url: sourceMappingURL, map: sourceMapData } : null }), exports.wrapCallSite = wrapCallSite, exports.getErrorSource = getErrorSource, exports.mapSourcePosition = mapSourcePosition, exports.retrieveSourceMap = retrieveSourceMap, exports.install = function (options) { if (options = options || {}, options.environment && (environment = options.environment, ["node", "browser", "auto"].indexOf(environment) === -1)) throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}"); if (options.retrieveFile && (options.overrideRetrieveFile && (retrieveFileHandlers.length = 0), retrieveFileHandlers.unshift(options.retrieveFile)), options.retrieveSourceMap && (options.overrideRetrieveSourceMap && (retrieveMapHandlers.length = 0), retrieveMapHandlers.unshift(options.retrieveSourceMap)), options.hookRequire && !isInBrowser()) { var Module; try { Module = __webpack_require__(189) } catch (err) { } var $compile = Module.prototype._compile; $compile.__sourceMapSupport || (Module.prototype._compile = function (content, filename) { return fileContentsCache[filename] = content, sourceMapCache[filename] = void 0, $compile.call(this, content, filename) }, Module.prototype._compile.__sourceMapSupport = !0) } if (emptyCacheBetweenOperations || (emptyCacheBetweenOperations = "emptyCacheBetweenOperations" in options && options.emptyCacheBetweenOperations), errorFormatterInstalled || (errorFormatterInstalled = !0, Error.prepareStackTrace = prepareStackTrace), !uncaughtShimInstalled) { var installHandler = !("handleUncaughtExceptions" in options) || options.handleUncaughtExceptions; installHandler && hasGlobalProcessEventEmitter() && (uncaughtShimInstalled = !0, shimEmitUncaughtException()) } } }).call(exports, __webpack_require__(30), __webpack_require__(118).Buffer) }, function(module, exports, __webpack_require__) { exports.SourceMapGenerator = __webpack_require__(178).SourceMapGenerator, exports.SourceMapConsumer = __webpack_require__(184).SourceMapConsumer, exports.SourceNode = __webpack_require__(187).SourceNode }, function(module, exports, __webpack_require__) { function SourceMapGenerator(aArgs) { aArgs || (aArgs = {}), this._file = util.getArg(aArgs, "file", null), this._sourceRoot = util.getArg(aArgs, "sourceRoot", null), this._skipValidation = util.getArg(aArgs, "skipValidation", !1), this._sources = new ArraySet, this._names = new ArraySet, this._mappings = new MappingList, this._sourcesContents = null } var base64VLQ = __webpack_require__(179), util = __webpack_require__(181), ArraySet = __webpack_require__(182).ArraySet, MappingList = __webpack_require__(183).MappingList; SourceMapGenerator.prototype._version = 3, SourceMapGenerator.fromSourceMap = function (aSourceMapConsumer) { var sourceRoot = aSourceMapConsumer.sourceRoot, generator = new SourceMapGenerator({ file: aSourceMapConsumer.file, sourceRoot: sourceRoot }); return aSourceMapConsumer.eachMapping(function (mapping) { var newMapping = { generated: { line: mapping.generatedLine, column: mapping.generatedColumn } }; null != mapping.source && (newMapping.source = mapping.source, null != sourceRoot && (newMapping.source = util.relative(sourceRoot, newMapping.source)), newMapping.original = { line: mapping.originalLine, column: mapping.originalColumn }, null != mapping.name && (newMapping.name = mapping.name)), generator.addMapping(newMapping) }), aSourceMapConsumer.sources.forEach(function (sourceFile) { var sourceRelative = sourceFile; null !== sourceRoot && (sourceRelative = util.relative(sourceRoot, sourceFile)), generator._sources.has(sourceRelative) || generator._sources.add(sourceRelative); var content = aSourceMapConsumer.sourceContentFor(sourceFile); null != content && generator.setSourceContent(sourceFile, content) }), generator }, SourceMapGenerator.prototype.addMapping = function (aArgs) { var generated = util.getArg(aArgs, "generated"), original = util.getArg(aArgs, "original", null), source = util.getArg(aArgs, "source", null), name = util.getArg(aArgs, "name", null); this._skipValidation || this._validateMapping(generated, original, source, name), null != source && (source = String(source), this._sources.has(source) || this._sources.add(source)), null != name && (name = String(name), this._names.has(name) || this._names.add(name)), this._mappings.add({ generatedLine: generated.line, generatedColumn: generated.column, originalLine: null != original && original.line, originalColumn: null != original && original.column, source: source, name: name }) }, SourceMapGenerator.prototype.setSourceContent = function (aSourceFile, aSourceContent) { var source = aSourceFile; null != this._sourceRoot && (source = util.relative(this._sourceRoot, source)), null != aSourceContent ? (this._sourcesContents || (this._sourcesContents = Object.create(null)), this._sourcesContents[util.toSetString(source)] = aSourceContent) : this._sourcesContents && (delete this._sourcesContents[util.toSetString(source)], 0 === Object.keys(this._sourcesContents).length && (this._sourcesContents = null)) }, SourceMapGenerator.prototype.applySourceMap = function (aSourceMapConsumer, aSourceFile, aSourceMapPath) { var sourceFile = aSourceFile; if (null == aSourceFile) { if (null == aSourceMapConsumer.file) throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.'); sourceFile = aSourceMapConsumer.file } var sourceRoot = this._sourceRoot; null != sourceRoot && (sourceFile = util.relative(sourceRoot, sourceFile)); var newSources = new ArraySet, newNames = new ArraySet; this._mappings.unsortedForEach(function (mapping) { if (mapping.source === sourceFile && null != mapping.originalLine) { var original = aSourceMapConsumer.originalPositionFor({ line: mapping.originalLine, column: mapping.originalColumn }); null != original.source && (mapping.source = original.source, null != aSourceMapPath && (mapping.source = util.join(aSourceMapPath, mapping.source)), null != sourceRoot && (mapping.source = util.relative(sourceRoot, mapping.source)), mapping.originalLine = original.line, mapping.originalColumn = original.column, null != original.name && (mapping.name = original.name)) } var source = mapping.source; null == source || newSources.has(source) || newSources.add(source); var name = mapping.name; null == name || newNames.has(name) || newNames.add(name) }, this), this._sources = newSources, this._names = newNames, aSourceMapConsumer.sources.forEach(function (sourceFile) { var content = aSourceMapConsumer.sourceContentFor(sourceFile); null != content && (null != aSourceMapPath && (sourceFile = util.join(aSourceMapPath, sourceFile)), null != sourceRoot && (sourceFile = util.relative(sourceRoot, sourceFile)), this.setSourceContent(sourceFile, content)) }, this) }, SourceMapGenerator.prototype._validateMapping = function (aGenerated, aOriginal, aSource, aName) { if (aOriginal && "number" != typeof aOriginal.line && "number" != typeof aOriginal.column) throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."); if ((!(aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0) || aOriginal || aSource || aName) && !(aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource)) throw new Error("Invalid mapping: " + JSON.stringify({ generated: aGenerated, source: aSource, original: aOriginal, name: aName })) }, SourceMapGenerator.prototype._serializeMappings = function () { for (var next, mapping, nameIdx, sourceIdx, previousGeneratedColumn = 0, previousGeneratedLine = 1, previousOriginalColumn = 0, previousOriginalLine = 0, previousName = 0, previousSource = 0, result = "", mappings = this._mappings.toArray(), i = 0, len = mappings.length; i < len; i++) { if (mapping = mappings[i], next = "", mapping.generatedLine !== previousGeneratedLine) for (previousGeneratedColumn = 0; mapping.generatedLine !== previousGeneratedLine;)next += ";", previousGeneratedLine++; else if (i > 0) { if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) continue; next += "," } next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn), previousGeneratedColumn = mapping.generatedColumn, null != mapping.source && (sourceIdx = this._sources.indexOf(mapping.source), next += base64VLQ.encode(sourceIdx - previousSource), previousSource = sourceIdx, next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine), previousOriginalLine = mapping.originalLine - 1, next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn), previousOriginalColumn = mapping.originalColumn, null != mapping.name && (nameIdx = this._names.indexOf(mapping.name), next += base64VLQ.encode(nameIdx - previousName), previousName = nameIdx)), result += next } return result }, SourceMapGenerator.prototype._generateSourcesContent = function (aSources, aSourceRoot) { return aSources.map(function (source) { if (!this._sourcesContents) return null; null != aSourceRoot && (source = util.relative(aSourceRoot, source)); var key = util.toSetString(source); return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null }, this) }, SourceMapGenerator.prototype.toJSON = function () { var map = { version: this._version, sources: this._sources.toArray(), names: this._names.toArray(), mappings: this._serializeMappings() }; return null != this._file && (map.file = this._file), null != this._sourceRoot && (map.sourceRoot = this._sourceRoot), this._sourcesContents && (map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot)), map }, SourceMapGenerator.prototype.toString = function () { return JSON.stringify(this.toJSON()) }, exports.SourceMapGenerator = SourceMapGenerator }, function(module, exports, __webpack_require__) { function toVLQSigned(aValue) { return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0 } function fromVLQSigned(aValue) { var isNegative = 1 === (1 & aValue), shifted = aValue >> 1; return isNegative ? -shifted : shifted } var base64 = __webpack_require__(180), VLQ_BASE_SHIFT = 5, VLQ_BASE = 1 << VLQ_BASE_SHIFT, VLQ_BASE_MASK = VLQ_BASE - 1, VLQ_CONTINUATION_BIT = VLQ_BASE; exports.encode = function (aValue) { var digit, encoded = "", vlq = toVLQSigned(aValue); do digit = vlq & VLQ_BASE_MASK, vlq >>>= VLQ_BASE_SHIFT, vlq > 0 && (digit |= VLQ_CONTINUATION_BIT), encoded += base64.encode(digit); while (vlq > 0); return encoded }, exports.decode = function (aStr, aIndex, aOutParam) { var continuation, digit, strLen = aStr.length, result = 0, shift = 0; do { if (aIndex >= strLen) throw new Error("Expected more digits in base 64 VLQ value."); if (digit = base64.decode(aStr.charCodeAt(aIndex++)), digit === -1) throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); continuation = !!(digit & VLQ_CONTINUATION_BIT), digit &= VLQ_BASE_MASK, result += digit << shift, shift += VLQ_BASE_SHIFT } while (continuation); aOutParam.value = fromVLQSigned(result), aOutParam.rest = aIndex } }, function(module, exports) { var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); exports.encode = function (number) { if (0 <= number && number < intToCharMap.length) return intToCharMap[number]; throw new TypeError("Must be between 0 and 63: " + number) }, exports.decode = function (charCode) { var bigA = 65, bigZ = 90, littleA = 97, littleZ = 122, zero = 48, nine = 57, plus = 43, slash = 47, littleOffset = 26, numberOffset = 52; return bigA <= charCode && charCode <= bigZ ? charCode - bigA : littleA <= charCode && charCode <= littleZ ? charCode - littleA + littleOffset : zero <= charCode && charCode <= nine ? charCode - zero + numberOffset : charCode == plus ? 62 : charCode == slash ? 63 : -1 } }, function(module, exports) { function getArg(aArgs, aName, aDefaultValue) { if (aName in aArgs) return aArgs[aName]; if (3 === arguments.length) return aDefaultValue; throw new Error('"' + aName + '" is a required argument.') } function urlParse(aUrl) { var match = aUrl.match(urlRegexp); return match ? { scheme: match[1], auth: match[2], host: match[3], port: match[4], path: match[5] } : null } function urlGenerate(aParsedUrl) { var url = ""; return aParsedUrl.scheme && (url += aParsedUrl.scheme + ":"), url += "//", aParsedUrl.auth && (url += aParsedUrl.auth + "@"), aParsedUrl.host && (url += aParsedUrl.host), aParsedUrl.port && (url += ":" + aParsedUrl.port), aParsedUrl.path && (url += aParsedUrl.path), url } function normalize(aPath) { var path = aPath, url = urlParse(aPath); if (url) { if (!url.path) return aPath; path = url.path } for (var part, isAbsolute = exports.isAbsolute(path), parts = path.split(/\/+/), up = 0, i = parts.length - 1; i >= 0; i--)part = parts[i], "." === part ? parts.splice(i, 1) : ".." === part ? up++ : up > 0 && ("" === part ? (parts.splice(i + 1, up), up = 0) : (parts.splice(i, 2), up--)); return path = parts.join("/"), "" === path && (path = isAbsolute ? "/" : "."), url ? (url.path = path, urlGenerate(url)) : path } function join(aRoot, aPath) { "" === aRoot && (aRoot = "."), "" === aPath && (aPath = "."); var aPathUrl = urlParse(aPath), aRootUrl = urlParse(aRoot); if (aRootUrl && (aRoot = aRootUrl.path || "/"), aPathUrl && !aPathUrl.scheme) return aRootUrl && (aPathUrl.scheme = aRootUrl.scheme), urlGenerate(aPathUrl); if (aPathUrl || aPath.match(dataUrlRegexp)) return aPath; if (aRootUrl && !aRootUrl.host && !aRootUrl.path) return aRootUrl.host = aPath, urlGenerate(aRootUrl); var joined = "/" === aPath.charAt(0) ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath); return aRootUrl ? (aRootUrl.path = joined, urlGenerate(aRootUrl)) : joined } function relative(aRoot, aPath) { "" === aRoot && (aRoot = "."), aRoot = aRoot.replace(/\/$/, ""); for (var level = 0; 0 !== aPath.indexOf(aRoot + "/");) { var index = aRoot.lastIndexOf("/"); if (index < 0) return aPath; if (aRoot = aRoot.slice(0, index), aRoot.match(/^([^\/]+:\/)?\/*$/)) return aPath; ++level } return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1) } function identity(s) { return s } function toSetString(aStr) { return isProtoString(aStr) ? "$" + aStr : aStr } function fromSetString(aStr) { return isProtoString(aStr) ? aStr.slice(1) : aStr } function isProtoString(s) { if (!s) return !1; var length = s.length; if (length < 9) return !1; if (95 !== s.charCodeAt(length - 1) || 95 !== s.charCodeAt(length - 2) || 111 !== s.charCodeAt(length - 3) || 116 !== s.charCodeAt(length - 4) || 111 !== s.charCodeAt(length - 5) || 114 !== s.charCodeAt(length - 6) || 112 !== s.charCodeAt(length - 7) || 95 !== s.charCodeAt(length - 8) || 95 !== s.charCodeAt(length - 9)) return !1; for (var i = length - 10; i >= 0; i--)if (36 !== s.charCodeAt(i)) return !1; return !0 } function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { var cmp = strcmp(mappingA.source, mappingB.source); return 0 !== cmp ? cmp : (cmp = mappingA.originalLine - mappingB.originalLine, 0 !== cmp ? cmp : (cmp = mappingA.originalColumn - mappingB.originalColumn, 0 !== cmp || onlyCompareOriginal ? cmp : (cmp = mappingA.generatedColumn - mappingB.generatedColumn, 0 !== cmp ? cmp : (cmp = mappingA.generatedLine - mappingB.generatedLine, 0 !== cmp ? cmp : strcmp(mappingA.name, mappingB.name))))) } function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { var cmp = mappingA.generatedLine - mappingB.generatedLine; return 0 !== cmp ? cmp : (cmp = mappingA.generatedColumn - mappingB.generatedColumn, 0 !== cmp || onlyCompareGenerated ? cmp : (cmp = strcmp(mappingA.source, mappingB.source), 0 !== cmp ? cmp : (cmp = mappingA.originalLine - mappingB.originalLine, 0 !== cmp ? cmp : (cmp = mappingA.originalColumn - mappingB.originalColumn, 0 !== cmp ? cmp : strcmp(mappingA.name, mappingB.name))))) } function strcmp(aStr1, aStr2) { return aStr1 === aStr2 ? 0 : null === aStr1 ? 1 : null === aStr2 ? -1 : aStr1 > aStr2 ? 1 : -1 } function compareByGeneratedPositionsInflated(mappingA, mappingB) { var cmp = mappingA.generatedLine - mappingB.generatedLine; return 0 !== cmp ? cmp : (cmp = mappingA.generatedColumn - mappingB.generatedColumn, 0 !== cmp ? cmp : (cmp = strcmp(mappingA.source, mappingB.source), 0 !== cmp ? cmp : (cmp = mappingA.originalLine - mappingB.originalLine, 0 !== cmp ? cmp : (cmp = mappingA.originalColumn - mappingB.originalColumn, 0 !== cmp ? cmp : strcmp(mappingA.name, mappingB.name))))) } function parseSourceMapInput(str) { return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, "")) } function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { if (sourceURL = sourceURL || "", sourceRoot && ("/" !== sourceRoot[sourceRoot.length - 1] && "/" !== sourceURL[0] && (sourceRoot += "/"), sourceURL = sourceRoot + sourceURL), sourceMapURL) { var parsed = urlParse(sourceMapURL); if (!parsed) throw new Error("sourceMapURL could not be parsed"); if (parsed.path) { var index = parsed.path.lastIndexOf("/"); index >= 0 && (parsed.path = parsed.path.substring(0, index + 1)) } sourceURL = join(urlGenerate(parsed), sourceURL) } return normalize(sourceURL) } exports.getArg = getArg; var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, dataUrlRegexp = /^data:.+\,.+$/; exports.urlParse = urlParse, exports.urlGenerate = urlGenerate, exports.normalize = normalize, exports.join = join, exports.isAbsolute = function (aPath) { return "/" === aPath.charAt(0) || urlRegexp.test(aPath) }, exports.relative = relative; var supportsNullProto = function () { var obj = Object.create(null); return !("__proto__" in obj) }(); exports.toSetString = supportsNullProto ? identity : toSetString, exports.fromSetString = supportsNullProto ? identity : fromSetString, exports.compareByOriginalPositions = compareByOriginalPositions, exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated, exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated, exports.parseSourceMapInput = parseSourceMapInput, exports.computeSourceURL = computeSourceURL }, function(module, exports, __webpack_require__) { function ArraySet() { this._array = [], this._set = hasNativeMap ? new Map : Object.create(null) } var util = __webpack_require__(181), has = Object.prototype.hasOwnProperty, hasNativeMap = "undefined" != typeof Map; ArraySet.fromArray = function (aArray, aAllowDuplicates) { for (var set = new ArraySet, i = 0, len = aArray.length; i < len; i++)set.add(aArray[i], aAllowDuplicates); return set }, ArraySet.prototype.size = function () { return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length }, ArraySet.prototype.add = function (aStr, aAllowDuplicates) { var sStr = hasNativeMap ? aStr : util.toSetString(aStr), isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr), idx = this._array.length; isDuplicate && !aAllowDuplicates || this._array.push(aStr), isDuplicate || (hasNativeMap ? this._set.set(aStr, idx) : this._set[sStr] = idx) }, ArraySet.prototype.has = function (aStr) { if (hasNativeMap) return this._set.has(aStr); var sStr = util.toSetString(aStr); return has.call(this._set, sStr) }, ArraySet.prototype.indexOf = function (aStr) { if (hasNativeMap) { var idx = this._set.get(aStr); if (idx >= 0) return idx } else { var sStr = util.toSetString(aStr); if (has.call(this._set, sStr)) return this._set[sStr] } throw new Error('"' + aStr + '" is not in the set.') }, ArraySet.prototype.at = function (aIdx) { if (aIdx >= 0 && aIdx < this._array.length) return this._array[aIdx]; throw new Error("No element indexed by " + aIdx) }, ArraySet.prototype.toArray = function () { return this._array.slice() }, exports.ArraySet = ArraySet }, function(module, exports, __webpack_require__) { function generatedPositionAfter(mappingA, mappingB) { var lineA = mappingA.generatedLine, lineB = mappingB.generatedLine, columnA = mappingA.generatedColumn, columnB = mappingB.generatedColumn; return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0 } function MappingList() { this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 } } var util = __webpack_require__(181); MappingList.prototype.unsortedForEach = function (aCallback, aThisArg) { this._array.forEach(aCallback, aThisArg) }, MappingList.prototype.add = function (aMapping) { generatedPositionAfter(this._last, aMapping) ? (this._last = aMapping, this._array.push(aMapping)) : (this._sorted = !1, this._array.push(aMapping)) }, MappingList.prototype.toArray = function () { return this._sorted || (this._array.sort(util.compareByGeneratedPositionsInflated), this._sorted = !0), this._array }, exports.MappingList = MappingList }, function(module, exports, __webpack_require__) { function SourceMapConsumer(aSourceMap, aSourceMapURL) { var sourceMap = aSourceMap; return "string" == typeof aSourceMap && (sourceMap = util.parseSourceMapInput(aSourceMap)), null != sourceMap.sections ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL) } function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { var sourceMap = aSourceMap; "string" == typeof aSourceMap && (sourceMap = util.parseSourceMapInput(aSourceMap)); var version = util.getArg(sourceMap, "version"), sources = util.getArg(sourceMap, "sources"), names = util.getArg(sourceMap, "names", []), sourceRoot = util.getArg(sourceMap, "sourceRoot", null), sourcesContent = util.getArg(sourceMap, "sourcesContent", null), mappings = util.getArg(sourceMap, "mappings"), file = util.getArg(sourceMap, "file", null); if (version != this._version) throw new Error("Unsupported version: " + version); sourceRoot && (sourceRoot = util.normalize(sourceRoot)), sources = sources.map(String).map(util.normalize).map(function (source) { return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source }), this._names = ArraySet.fromArray(names.map(String), !0), this._sources = ArraySet.fromArray(sources, !0), this._absoluteSources = this._sources.toArray().map(function (s) { return util.computeSourceURL(sourceRoot, s, aSourceMapURL) }), this.sourceRoot = sourceRoot, this.sourcesContent = sourcesContent, this._mappings = mappings, this._sourceMapURL = aSourceMapURL, this.file = file } function Mapping() { this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null } function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { var sourceMap = aSourceMap; "string" == typeof aSourceMap && (sourceMap = util.parseSourceMapInput(aSourceMap)); var version = util.getArg(sourceMap, "version"), sections = util.getArg(sourceMap, "sections"); if (version != this._version) throw new Error("Unsupported version: " + version); this._sources = new ArraySet, this._names = new ArraySet; var lastOffset = { line: -1, column: 0 }; this._sections = sections.map(function (s) { if (s.url) throw new Error("Support for url field in sections not implemented."); var offset = util.getArg(s, "offset"), offsetLine = util.getArg(offset, "line"), offsetColumn = util.getArg(offset, "column"); if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) throw new Error("Section offsets must be ordered and non-overlapping."); return lastOffset = offset, { generatedOffset: { generatedLine: offsetLine + 1, generatedColumn: offsetColumn + 1 }, consumer: new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL) } }) } var util = __webpack_require__(181), binarySearch = __webpack_require__(185), ArraySet = __webpack_require__(182).ArraySet, base64VLQ = __webpack_require__(179), quickSort = __webpack_require__(186).quickSort; SourceMapConsumer.fromSourceMap = function (aSourceMap, aSourceMapURL) { return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL) }, SourceMapConsumer.prototype._version = 3, SourceMapConsumer.prototype.__generatedMappings = null, Object.defineProperty(SourceMapConsumer.prototype, "_generatedMappings", { configurable: !0, enumerable: !0, get: function () { return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings } }), SourceMapConsumer.prototype.__originalMappings = null, Object.defineProperty(SourceMapConsumer.prototype, "_originalMappings", { configurable: !0, enumerable: !0, get: function () { return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings } }), SourceMapConsumer.prototype._charIsMappingSeparator = function (aStr, index) { var c = aStr.charAt(index); return ";" === c || "," === c }, SourceMapConsumer.prototype._parseMappings = function (aStr, aSourceRoot) { throw new Error("Subclasses must implement _parseMappings") }, SourceMapConsumer.GENERATED_ORDER = 1, SourceMapConsumer.ORIGINAL_ORDER = 2, SourceMapConsumer.GREATEST_LOWER_BOUND = 1, SourceMapConsumer.LEAST_UPPER_BOUND = 2, SourceMapConsumer.prototype.eachMapping = function (aCallback, aContext, aOrder) { var mappings, context = aContext || null, order = aOrder || SourceMapConsumer.GENERATED_ORDER; switch (order) { case SourceMapConsumer.GENERATED_ORDER: mappings = this._generatedMappings; break; case SourceMapConsumer.ORIGINAL_ORDER: mappings = this._originalMappings; break; default: throw new Error("Unknown order of iteration.") }var sourceRoot = this.sourceRoot; mappings.map(function (mapping) { var source = null === mapping.source ? null : this._sources.at(mapping.source); return source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL), { source: source, generatedLine: mapping.generatedLine, generatedColumn: mapping.generatedColumn, originalLine: mapping.originalLine, originalColumn: mapping.originalColumn, name: null === mapping.name ? null : this._names.at(mapping.name) } }, this).forEach(aCallback, context) }, SourceMapConsumer.prototype.allGeneratedPositionsFor = function (aArgs) { var line = util.getArg(aArgs, "line"), needle = { source: util.getArg(aArgs, "source"), originalLine: line, originalColumn: util.getArg(aArgs, "column", 0) }; if (needle.source = this._findSourceIndex(needle.source), needle.source < 0) return []; var mappings = [], index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND); if (index >= 0) { var mapping = this._originalMappings[index]; if (void 0 === aArgs.column) for (var originalLine = mapping.originalLine; mapping && mapping.originalLine === originalLine;)mappings.push({ line: util.getArg(mapping, "generatedLine", null), column: util.getArg(mapping, "generatedColumn", null), lastColumn: util.getArg(mapping, "lastGeneratedColumn", null) }), mapping = this._originalMappings[++index]; else for (var originalColumn = mapping.originalColumn; mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn;)mappings.push({ line: util.getArg(mapping, "generatedLine", null), column: util.getArg(mapping, "generatedColumn", null), lastColumn: util.getArg(mapping, "lastGeneratedColumn", null) }), mapping = this._originalMappings[++index] } return mappings }, exports.SourceMapConsumer = SourceMapConsumer, BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype), BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer, BasicSourceMapConsumer.prototype._findSourceIndex = function (aSource) { var relativeSource = aSource; if (null != this.sourceRoot && (relativeSource = util.relative(this.sourceRoot, relativeSource)), this._sources.has(relativeSource)) return this._sources.indexOf(relativeSource); var i; for (i = 0; i < this._absoluteSources.length; ++i)if (this._absoluteSources[i] == aSource) return i; return -1 }, BasicSourceMapConsumer.fromSourceMap = function (aSourceMap, aSourceMapURL) { var smc = Object.create(BasicSourceMapConsumer.prototype), names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), !0), sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), !0); smc.sourceRoot = aSourceMap._sourceRoot, smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot), smc.file = aSourceMap._file, smc._sourceMapURL = aSourceMapURL, smc._absoluteSources = smc._sources.toArray().map(function (s) { return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL) }); for (var generatedMappings = aSourceMap._mappings.toArray().slice(), destGeneratedMappings = smc.__generatedMappings = [], destOriginalMappings = smc.__originalMappings = [], i = 0, length = generatedMappings.length; i < length; i++) { var srcMapping = generatedMappings[i], destMapping = new Mapping; destMapping.generatedLine = srcMapping.generatedLine, destMapping.generatedColumn = srcMapping.generatedColumn, srcMapping.source && (destMapping.source = sources.indexOf(srcMapping.source), destMapping.originalLine = srcMapping.originalLine, destMapping.originalColumn = srcMapping.originalColumn, srcMapping.name && (destMapping.name = names.indexOf(srcMapping.name)), destOriginalMappings.push(destMapping)), destGeneratedMappings.push(destMapping) } return quickSort(smc.__originalMappings, util.compareByOriginalPositions), smc }, BasicSourceMapConsumer.prototype._version = 3, Object.defineProperty(BasicSourceMapConsumer.prototype, "sources", { get: function () { return this._absoluteSources.slice() } }), BasicSourceMapConsumer.prototype._parseMappings = function (aStr, aSourceRoot) { for (var mapping, str, segment, end, value, generatedLine = 1, previousGeneratedColumn = 0, previousOriginalLine = 0, previousOriginalColumn = 0, previousSource = 0, previousName = 0, length = aStr.length, index = 0, cachedSegments = {}, temp = {}, originalMappings = [], generatedMappings = []; index < length;)if (";" === aStr.charAt(index)) generatedLine++ , index++ , previousGeneratedColumn = 0; else if ("," === aStr.charAt(index)) index++; else { for (mapping = new Mapping, mapping.generatedLine = generatedLine, end = index; end < length && !this._charIsMappingSeparator(aStr, end); end++); if (str = aStr.slice(index, end), segment = cachedSegments[str]) index += str.length; else { for (segment = []; index < end;)base64VLQ.decode(aStr, index, temp), value = temp.value, index = temp.rest, segment.push(value); if (2 === segment.length) throw new Error("Found a source, but no line and column"); if (3 === segment.length) throw new Error("Found a source and line, but no column"); cachedSegments[str] = segment } mapping.generatedColumn = previousGeneratedColumn + segment[0], previousGeneratedColumn = mapping.generatedColumn, segment.length > 1 && (mapping.source = previousSource + segment[1], previousSource += segment[1], mapping.originalLine = previousOriginalLine + segment[2], previousOriginalLine = mapping.originalLine, mapping.originalLine += 1, mapping.originalColumn = previousOriginalColumn + segment[3], previousOriginalColumn = mapping.originalColumn, segment.length > 4 && (mapping.name = previousName + segment[4], previousName += segment[4])), generatedMappings.push(mapping), "number" == typeof mapping.originalLine && originalMappings.push(mapping) } quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated), this.__generatedMappings = generatedMappings, quickSort(originalMappings, util.compareByOriginalPositions), this.__originalMappings = originalMappings }, BasicSourceMapConsumer.prototype._findMapping = function (aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) { if (aNeedle[aLineName] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]); if (aNeedle[aColumnName] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]); return binarySearch.search(aNeedle, aMappings, aComparator, aBias) }, BasicSourceMapConsumer.prototype.computeColumnSpans = function () { for (var index = 0; index < this._generatedMappings.length; ++index) { var mapping = this._generatedMappings[index]; if (index + 1 < this._generatedMappings.length) { var nextMapping = this._generatedMappings[index + 1]; if (mapping.generatedLine === nextMapping.generatedLine) { mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; continue } } mapping.lastGeneratedColumn = 1 / 0 } }, BasicSourceMapConsumer.prototype.originalPositionFor = function (aArgs) { var needle = { generatedLine: util.getArg(aArgs, "line"), generatedColumn: util.getArg(aArgs, "column") }, index = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util.compareByGeneratedPositionsDeflated, util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)); if (index >= 0) { var mapping = this._generatedMappings[index]; if (mapping.generatedLine === needle.generatedLine) { var source = util.getArg(mapping, "source", null); null !== source && (source = this._sources.at(source), source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL)); var name = util.getArg(mapping, "name", null); return null !== name && (name = this._names.at(name)), { source: source, line: util.getArg(mapping, "originalLine", null), column: util.getArg(mapping, "originalColumn", null), name: name } } } return { source: null, line: null, column: null, name: null } }, BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function () { return !!this.sourcesContent && (this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (sc) { return null == sc })) }, BasicSourceMapConsumer.prototype.sourceContentFor = function (aSource, nullOnMissing) { if (!this.sourcesContent) return null; var index = this._findSourceIndex(aSource); if (index >= 0) return this.sourcesContent[index]; var relativeSource = aSource; null != this.sourceRoot && (relativeSource = util.relative(this.sourceRoot, relativeSource)); var url; if (null != this.sourceRoot && (url = util.urlParse(this.sourceRoot))) { var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); if ("file" == url.scheme && this._sources.has(fileUriAbsPath)) return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]; if ((!url.path || "/" == url.path) && this._sources.has("/" + relativeSource)) return this.sourcesContent[this._sources.indexOf("/" + relativeSource)] } if (nullOnMissing) return null; throw new Error('"' + relativeSource + '" is not in the SourceMap.') }, BasicSourceMapConsumer.prototype.generatedPositionFor = function (aArgs) { var source = util.getArg(aArgs, "source"); if (source = this._findSourceIndex(source), source < 0) return { line: null, column: null, lastColumn: null }; var needle = { source: source, originalLine: util.getArg(aArgs, "line"), originalColumn: util.getArg(aArgs, "column") }, index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)); if (index >= 0) { var mapping = this._originalMappings[index]; if (mapping.source === needle.source) return { line: util.getArg(mapping, "generatedLine", null), column: util.getArg(mapping, "generatedColumn", null), lastColumn: util.getArg(mapping, "lastGeneratedColumn", null) } } return { line: null, column: null, lastColumn: null } }, exports.BasicSourceMapConsumer = BasicSourceMapConsumer, IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype), IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer, IndexedSourceMapConsumer.prototype._version = 3, Object.defineProperty(IndexedSourceMapConsumer.prototype, "sources", { get: function () { for (var sources = [], i = 0; i < this._sections.length; i++)for (var j = 0; j < this._sections[i].consumer.sources.length; j++)sources.push(this._sections[i].consumer.sources[j]); return sources } }), IndexedSourceMapConsumer.prototype.originalPositionFor = function (aArgs) { var needle = { generatedLine: util.getArg(aArgs, "line"), generatedColumn: util.getArg(aArgs, "column") }, sectionIndex = binarySearch.search(needle, this._sections, function (needle, section) { var cmp = needle.generatedLine - section.generatedOffset.generatedLine; return cmp ? cmp : needle.generatedColumn - section.generatedOffset.generatedColumn }), section = this._sections[sectionIndex]; return section ? section.consumer.originalPositionFor({ line: needle.generatedLine - (section.generatedOffset.generatedLine - 1), column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), bias: aArgs.bias }) : { source: null, line: null, column: null, name: null } }, IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function () { return this._sections.every(function (s) { return s.consumer.hasContentsOfAllSources() }) }, IndexedSourceMapConsumer.prototype.sourceContentFor = function (aSource, nullOnMissing) { for (var i = 0; i < this._sections.length; i++) { var section = this._sections[i], content = section.consumer.sourceContentFor(aSource, !0); if (content) return content } if (nullOnMissing) return null; throw new Error('"' + aSource + '" is not in the SourceMap.') }, IndexedSourceMapConsumer.prototype.generatedPositionFor = function (aArgs) { for (var i = 0; i < this._sections.length; i++) { var section = this._sections[i]; if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) !== -1) { var generatedPosition = section.consumer.generatedPositionFor(aArgs); if (generatedPosition) { var ret = { line: generatedPosition.line + (section.generatedOffset.generatedLine - 1), column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0) }; return ret } } } return { line: null, column: null } }, IndexedSourceMapConsumer.prototype._parseMappings = function (aStr, aSourceRoot) { this.__generatedMappings = [], this.__originalMappings = []; for (var i = 0; i < this._sections.length; i++)for (var section = this._sections[i], sectionMappings = section.consumer._generatedMappings, j = 0; j < sectionMappings.length; j++) { var mapping = sectionMappings[j], source = section.consumer._sources.at(mapping.source); source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL), this._sources.add(source), source = this._sources.indexOf(source); var name = null; mapping.name && (name = section.consumer._names.at(mapping.name), this._names.add(name), name = this._names.indexOf(name)); var adjustedMapping = { source: source, generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1), generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), originalLine: mapping.originalLine, originalColumn: mapping.originalColumn, name: name }; this.__generatedMappings.push(adjustedMapping), "number" == typeof adjustedMapping.originalLine && this.__originalMappings.push(adjustedMapping) } quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated), quickSort(this.__originalMappings, util.compareByOriginalPositions) }, exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer }, function(module, exports) { function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { var mid = Math.floor((aHigh - aLow) / 2) + aLow, cmp = aCompare(aNeedle, aHaystack[mid], !0); return 0 === cmp ? mid : cmp > 0 ? aHigh - mid > 1 ? recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias) : aBias == exports.LEAST_UPPER_BOUND ? aHigh < aHaystack.length ? aHigh : -1 : mid : mid - aLow > 1 ? recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias) : aBias == exports.LEAST_UPPER_BOUND ? mid : aLow < 0 ? -1 : aLow } exports.GREATEST_LOWER_BOUND = 1, exports.LEAST_UPPER_BOUND = 2, exports.search = function (aNeedle, aHaystack, aCompare, aBias) { if (0 === aHaystack.length) return -1; var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND); if (index < 0) return -1; for (; index - 1 >= 0 && 0 === aCompare(aHaystack[index], aHaystack[index - 1], !0);)--index; return index } }, function(module, exports) { function swap(ary, x, y) { var temp = ary[x]; ary[x] = ary[y], ary[y] = temp } function randomIntInRange(low, high) { return Math.round(low + Math.random() * (high - low)) } function doQuickSort(ary, comparator, p, r) { if (p < r) { var pivotIndex = randomIntInRange(p, r), i = p - 1; swap(ary, pivotIndex, r); for (var pivot = ary[r], j = p; j < r; j++)comparator(ary[j], pivot) <= 0 && (i += 1, swap(ary, i, j)); swap(ary, i + 1, j); var q = i + 1; doQuickSort(ary, comparator, p, q - 1), doQuickSort(ary, comparator, q + 1, r) } } exports.quickSort = function (ary, comparator) { doQuickSort(ary, comparator, 0, ary.length - 1) } }, function(module, exports, __webpack_require__) { function SourceNode(aLine, aColumn, aSource, aChunks, aName) { this.children = [], this.sourceContents = {}, this.line = null == aLine ? null : aLine, this.column = null == aColumn ? null : aColumn, this.source = null == aSource ? null : aSource, this.name = null == aName ? null : aName, this[isSourceNode] = !0, null != aChunks && this.add(aChunks) } var SourceMapGenerator = __webpack_require__(178).SourceMapGenerator, util = __webpack_require__(181), REGEX_NEWLINE = /(\r?\n)/, NEWLINE_CODE = 10, isSourceNode = "$$$isSourceNode$$$"; SourceNode.fromStringWithSourceMap = function (aGeneratedCode, aSourceMapConsumer, aRelativePath) { function addMappingWithCode(mapping, code) { if (null === mapping || void 0 === mapping.source) node.add(code); else { var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source; node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name)) } } var node = new SourceNode, remainingLines = aGeneratedCode.split(REGEX_NEWLINE), remainingLinesIndex = 0, shiftNextLine = function () { function getNextLine() { return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0 } var lineContents = getNextLine(), newLine = getNextLine() || ""; return lineContents + newLine }, lastGeneratedLine = 1, lastGeneratedColumn = 0, lastMapping = null; return aSourceMapConsumer.eachMapping(function (mapping) { if (null !== lastMapping) { if (!(lastGeneratedLine < mapping.generatedLine)) { var nextLine = remainingLines[remainingLinesIndex] || "", code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn); return remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn), lastGeneratedColumn = mapping.generatedColumn, addMappingWithCode(lastMapping, code), void (lastMapping = mapping) } addMappingWithCode(lastMapping, shiftNextLine()), lastGeneratedLine++ , lastGeneratedColumn = 0 } for (; lastGeneratedLine < mapping.generatedLine;)node.add(shiftNextLine()), lastGeneratedLine++; if (lastGeneratedColumn < mapping.generatedColumn) { var nextLine = remainingLines[remainingLinesIndex] || ""; node.add(nextLine.substr(0, mapping.generatedColumn)), remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn), lastGeneratedColumn = mapping.generatedColumn } lastMapping = mapping }, this), remainingLinesIndex < remainingLines.length && (lastMapping && addMappingWithCode(lastMapping, shiftNextLine()), node.add(remainingLines.splice(remainingLinesIndex).join(""))), aSourceMapConsumer.sources.forEach(function (sourceFile) { var content = aSourceMapConsumer.sourceContentFor(sourceFile); null != content && (null != aRelativePath && (sourceFile = util.join(aRelativePath, sourceFile)), node.setSourceContent(sourceFile, content)) }), node }, SourceNode.prototype.add = function (aChunk) { if (Array.isArray(aChunk)) aChunk.forEach(function (chunk) { this.add(chunk) }, this); else { if (!aChunk[isSourceNode] && "string" != typeof aChunk) throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk); aChunk && this.children.push(aChunk) } return this }, SourceNode.prototype.prepend = function (aChunk) { if (Array.isArray(aChunk)) for (var i = aChunk.length - 1; i >= 0; i--)this.prepend(aChunk[i]); else { if (!aChunk[isSourceNode] && "string" != typeof aChunk) throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk); this.children.unshift(aChunk) } return this }, SourceNode.prototype.walk = function (aFn) { for (var chunk, i = 0, len = this.children.length; i < len; i++)chunk = this.children[i], chunk[isSourceNode] ? chunk.walk(aFn) : "" !== chunk && aFn(chunk, { source: this.source, line: this.line, column: this.column, name: this.name }) }, SourceNode.prototype.join = function (aSep) { var newChildren, i, len = this.children.length; if (len > 0) { for (newChildren = [], i = 0; i < len - 1; i++)newChildren.push(this.children[i]), newChildren.push(aSep); newChildren.push(this.children[i]), this.children = newChildren } return this }, SourceNode.prototype.replaceRight = function (aPattern, aReplacement) { var lastChild = this.children[this.children.length - 1]; return lastChild[isSourceNode] ? lastChild.replaceRight(aPattern, aReplacement) : "string" == typeof lastChild ? this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement) : this.children.push("".replace(aPattern, aReplacement)), this }, SourceNode.prototype.setSourceContent = function (aSourceFile, aSourceContent) { this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent }, SourceNode.prototype.walkSourceContents = function (aFn) { for (var i = 0, len = this.children.length; i < len; i++)this.children[i][isSourceNode] && this.children[i].walkSourceContents(aFn); for (var sources = Object.keys(this.sourceContents), i = 0, len = sources.length; i < len; i++)aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]) }, SourceNode.prototype.toString = function () { var str = ""; return this.walk(function (chunk) { str += chunk }), str }, SourceNode.prototype.toStringWithSourceMap = function (aArgs) { var generated = { code: "", line: 1, column: 0 }, map = new SourceMapGenerator(aArgs), sourceMappingActive = !1, lastOriginalSource = null, lastOriginalLine = null, lastOriginalColumn = null, lastOriginalName = null; return this.walk(function (chunk, original) { generated.code += chunk, null !== original.source && null !== original.line && null !== original.column ? (lastOriginalSource === original.source && lastOriginalLine === original.line && lastOriginalColumn === original.column && lastOriginalName === original.name || map.addMapping({ source: original.source, original: { line: original.line, column: original.column }, generated: { line: generated.line, column: generated.column }, name: original.name }), lastOriginalSource = original.source, lastOriginalLine = original.line, lastOriginalColumn = original.column, lastOriginalName = original.name, sourceMappingActive = !0) : sourceMappingActive && (map.addMapping({ generated: { line: generated.line, column: generated.column } }), lastOriginalSource = null, sourceMappingActive = !1); for (var idx = 0, length = chunk.length; idx < length; idx++)chunk.charCodeAt(idx) === NEWLINE_CODE ? (generated.line++ , generated.column = 0, idx + 1 === length ? (lastOriginalSource = null, sourceMappingActive = !1) : sourceMappingActive && map.addMapping({ source: original.source, original: { line: original.line, column: original.column }, generated: { line: generated.line, column: generated.column }, name: original.name })) : generated.column++ }), this.walkSourceContents(function (sourceFile, sourceContent) { map.setSourceContent(sourceFile, sourceContent) }), { code: generated.code, map: map } }, exports.SourceNode = SourceNode }, function(module, exports, __webpack_require__) { (function (process) { function normalizeArray(parts, allowAboveRoot) { for (var up = 0, i = parts.length - 1; i >= 0; i--) { var last = parts[i]; "." === last ? parts.splice(i, 1) : ".." === last ? (parts.splice(i, 1), up++) : up && (parts.splice(i, 1), up--) } if (allowAboveRoot) for (; up--; up)parts.unshift(".."); return parts } function filter(xs, f) { if (xs.filter) return xs.filter(f); for (var res = [], i = 0; i < xs.length; i++)f(xs[i], i, xs) && res.push(xs[i]); return res } var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/, splitPath = function (filename) { return splitPathRe.exec(filename).slice(1) }; exports.resolve = function () { for (var resolvedPath = "", resolvedAbsolute = !1, i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { var path = i >= 0 ? arguments[i] : process.cwd(); if ("string" != typeof path) throw new TypeError("Arguments to path.resolve must be strings"); path && (resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = "/" === path.charAt(0)) } return resolvedPath = normalizeArray(filter(resolvedPath.split("/"), function (p) { return !!p }), !resolvedAbsolute).join("/"), (resolvedAbsolute ? "/" : "") + resolvedPath || "." }, exports.normalize = function (path) { var isAbsolute = exports.isAbsolute(path), trailingSlash = "/" === substr(path, -1); return path = normalizeArray(filter(path.split("/"), function (p) { return !!p }), !isAbsolute).join("/"), path || isAbsolute || (path = "."), path && trailingSlash && (path += "/"), (isAbsolute ? "/" : "") + path }, exports.isAbsolute = function (path) { return "/" === path.charAt(0) }, exports.join = function () { var paths = Array.prototype.slice.call(arguments, 0); return exports.normalize(filter(paths, function (p, index) { if ("string" != typeof p) throw new TypeError("Arguments to path.join must be strings"); return p }).join("/")) }, exports.relative = function (from, to) { function trim(arr) { for (var start = 0; start < arr.length && "" === arr[start]; start++); for (var end = arr.length - 1; end >= 0 && "" === arr[end]; end--); return start > end ? [] : arr.slice(start, end - start + 1) } from = exports.resolve(from).substr(1), to = exports.resolve(to).substr(1); for (var fromParts = trim(from.split("/")), toParts = trim(to.split("/")), length = Math.min(fromParts.length, toParts.length), samePartsLength = length, i = 0; i < length; i++)if (fromParts[i] !== toParts[i]) { samePartsLength = i; break } for (var outputParts = [], i = samePartsLength; i < fromParts.length; i++)outputParts.push(".."); return outputParts = outputParts.concat(toParts.slice(samePartsLength)), outputParts.join("/") }, exports.sep = "/", exports.delimiter = ":", exports.dirname = function (path) { var result = splitPath(path), root = result[0], dir = result[1]; return root || dir ? (dir && (dir = dir.substr(0, dir.length - 1)), root + dir) : "." }, exports.basename = function (path, ext) { var f = splitPath(path)[2]; return ext && f.substr(-1 * ext.length) === ext && (f = f.substr(0, f.length - ext.length)), f }, exports.extname = function (path) { return splitPath(path)[3] }; var substr = "b" === "ab".substr(-1) ? function (str, start, len) { return str.substr(start, len) } : function (str, start, len) { return start < 0 && (start = str.length + start), str.substr(start, len) } }).call(exports, __webpack_require__(30)) }, function(module, exports) { }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _Comments = __webpack_require__(191), _Comments2 = _interopRequireDefault(_Comments), _History = __webpack_require__(192), _History2 = _interopRequireDefault(_History), _constants = __webpack_require__(22), Activity = React.createClass({ displayName: "Activity", propTypes: { sysSerial: React.PropTypes.number.isRequired, stationId: React.PropTypes.number.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, comments: React.PropTypes.arrayOf(_constants.CommentShape).isRequired, history: React.PropTypes.arrayOf(_constants.HistoryShape).isRequired, taggedAssets: React.PropTypes.array }, getDefaultProps: function () { return { taggedAssets: [] } }, getCommentsTabContent: function () { return { id: "commentsTab", key: 1, title: "Comments", content: React.createElement(_Comments2.default, { ref: "Comments", caseSysSerial: this.props.sysSerial, comments: this.props.comments, taggedAssets: this.props.taggedAssets, userInfo: this.props.userInfo }) } }, getHistoryTabContent: function () { return { id: "historyTab", key: 2, title: "History", content: React.createElement(_History2.default, { ref: "History", history: this.props.history }) } }, render: function () { return React.createElement("div", { className: "activity-container" }, React.createElement("label", { className: "section-heading" }, "Activity"), React.createElement(IrsaReactTabstrip, { id: "activityTabstrip", key: 1, items: [this.getCommentsTabContent(), this.getHistoryTabContent()] })) } }); module.exports = Activity }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } var _objectAssign = __webpack_require__(7), _objectAssign2 = _interopRequireDefault(_objectAssign), _constants = __webpack_require__(22), _IrsaReactRichTextEditor = __webpack_require__(25), _IrsaReactRichTextEditor2 = _interopRequireDefault(_IrsaReactRichTextEditor), _commons = __webpack_require__(72), CommentLabel = React.createClass({ displayName: "CommentLabel", propTypes: { FullName: React.PropTypes.string.isRequired, CreatedOnTicks: React.PropTypes.number.isRequired, UpdatedOnTicks: React.PropTypes.number }, getDefaultProps: function () { return { UpdatedOnTicks: 0 } }, render: function () { var _props = this.props, FullName = _props.FullName, CreatedOnTicks = _props.CreatedOnTicks, UpdatedOnTicks = _props.UpdatedOnTicks, editFlag = void 0, date = kendo.toString(new Date(CreatedOnTicks), _stationDateFormat); if (UpdatedOnTicks > 0) { var updateDate = kendo.toString(new Date(UpdatedOnTicks), _stationDateFormat); editFlag = React.createElement("span", { className: "comment-date-edited" }, " - ", React.createElement("span", { className: "comment-edited-flag" }, "edited"), updateDate) } return React.createElement("div", null, React.createElement("span", { className: "comment-user-name" }, FullName), React.createElement("span", { className: "comment-desc" }, "added a comment on "), React.createElement("span", { className: "comment-date" }, " ", date), editFlag) } }), CommentBox = React.createClass({ displayName: "CommentBox", props: { id: React.PropTypes.string.isRequired, parentComp: React.PropTypes.element.isRequired, isEditMode: React.PropTypes.bool.isRequired, hideEditContentButtons: React.PropTypes.bool.isRequired, onSaveComment: React.PropTypes.func.isRequired, onCancel: React.PropTypes.func.isRequired, onEdit: React.PropTypes.func.isRequired, onDelete: React.PropTypes.func.isRequired, comment: _constants.CommentShape.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, taggedAssets: React.PropTypes.array }, getDefaultProps: function () { return { taggedAssets: [] } }, getInitialState: function () { return { comment: null } }, componentWillMount: function () { var comment = this.props.comment; this.setState({ comment: comment }) }, componentWillReceiveProps: function (nextProps) { var comment = nextProps.comment; this.setState({ comment: comment }) }, render: function () { var _props2 = this.props, id = _props2.id, isEditMode = _props2.isEditMode, hideEditContentButtons = _props2.hideEditContentButtons, userInfo = _props2.userInfo, taggedAssets = _props2.taggedAssets, comment = this.state.comment, commentLabel = React.createElement(CommentLabel, { FullName: comment.CreatedByUser.FullName, CreatedOnTicks: comment.CreatedOnTicks, UpdatedOnTicks: comment.UpdatedOnTicks }), hideECButtons = !1; return hideECButtons = comment.CreatedByUser.Id != userInfo.userId || hideEditContentButtons, React.createElement("div", { id: "commentBox_" + id, className: "comment" }, React.createElement(_IrsaReactRichTextEditor2.default, { ref: "commentBoxRTE", isEditMode: isEditMode, hideEditContentButtons: hideECButtons, headerElement: commentLabel, defaultArgs: [comment], showEditButton: !0, showDeleteButton: !1, onEditClick: this.props.onEdit, onDeleteClick: this.props.onDelete, onConfirmEdit: this.props.onSaveComment, onCancelEdit: this.props.onCancel, content: comment.description, requiredContentPromptMsg: "Empty Comment is not allowed", strategies: [{ regex: _commons.rgx, component: _commons.hashtagHTML, context: taggedAssets }] })) } }), NewCommentButton = React.createClass({ displayName: "NewCommentButton", props: { onClick: React.PropTypes.func.isRequired }, getInitialState: function () { return { show: !0 } }, onClick: function (e) { e.preventDefault(), this.props.onClick() }, hide: function () { this.setState({ show: !1 }) }, show: function () { this.setState({ show: !0 }) }, render: function () { var show = this.state.show; return show ? React.createElement("button", { className: "btn btn-primary comment-btn", onClick: this.onClick }, React.createElement("i", { className: "fa fa-comment" }), React.createElement("span", null, "Comment")) : React.createElement("span", null) } }), _newCommentCntr = 0, Comments = React.createClass({ displayName: "Comments", propTypes: { caseSysSerial: React.PropTypes.number.isRequired, comments: React.PropTypes.arrayOf(_constants.CommentShape).isRequired, userInfo: _constants.LoggedInUserShape.isRequired, taggedAssets: React.PropTypes.array }, getDefaultProps: function () { return { taggedAssets: [] } }, getInitialState: function () { return { comments: [], commentToEdit: null, hideEditContentButtons: !1 } }, hideEditContentButtons: function () { this.setState({ hideEditContentButtons: !0 }) }, showEditContentButtons: function () { this.setState({ hideEditContentButtons: !1 }) }, onSaveComment: function (comment) { var _this2 = this, commentId = comment.sysSerial, content = this.refs["commentBox_" + commentId].refs.commentBoxRTE.getEditorContent(), plainText = this.refs["commentBox_" + commentId].refs.commentBoxRTE.getContentAsPlainText(), isValidComment = !0, result = checkForValidInputContent(decodeURI(plainText), "Comment"); result && result.length > 0 && (isValidComment = !1, showErrorMsg({ msg: "Invalid text for Comment. Special Characters are not allowed", msgType: "SUCCESS", callback: function () { var _this = this; this.comp.setState({ commentToEdit: this.comment }), setTimeout(function () { IrsaModulesUtil.scrollToElement($("#commentBox_" + _this.comment.sysSerial).get(0)) }, 100) }, scope: { comp: this, comment: comment } })); var contentString = JSON.stringify(content), newState = this.state.comments.map(function (e) { if (e.sysSerial == commentId) { var o = (0, _objectAssign2.default)({}, e); return o.description = contentString, commentId > 0 && (o.UpdatedOnTicks = (new Date).getTime()), o } return e }); this.setState({ comments: newState, commentToEdit: null }), setTimeout(function () { _this2.refs.NewCommentButton.show() }, 100), 1 == isValidComment && this.saveCommentToDB(commentId, contentString) }, saveCommentToDB: function (commentId, contentString) { makeAjaxRequest({ type: "POST", url: "/Case/SaveComment", async: !0, params: { caseSysSerial: this.props.caseSysSerial, commentId: commentId, description: contentString }, scope: this, onComplete: function (resp) { var json = JSON.parse(resp.responseText); if (1 == json.success) { showSuccessMsg("Comment saved successfully"); var newState = this.state.comments.map(function (e) { if (e.sysSerial == json.oldCommentId) { var o = (0, _objectAssign2.default)({}, e); return json.oldCommentId > 0 ? o.UpdatedOnTicks = json.caseCommentForUI.UpdatedOnTicks : (o.sysSerial = json.caseCommentForUI.sysSerial, o.CreatedOnTicks = json.caseCommentForUI.CreatedOnTicks), o } return e }); this.setState({ comments: newState }) } else showErrorMsg(String.format("Failed to save comment on Server: {0}", json.msg)) } }) }, onCancelComment: function (comment) { var _this3 = this, commentId = comment.sysSerial; if (commentId <= 0) { var newState = this.state.comments.filter(function (e) { return e.sysSerial != commentId }); this.setState({ comments: newState, commentToEdit: null }) } else this.setState({ commentToEdit: null }); setTimeout(function () { _this3.refs.NewCommentButton.show() }, 100) }, onNewComment: function () { var _this4 = this, newComment = { sysSerial: --_newCommentCntr, description: "", CreatedByUser: { Id: this.props.userInfo.userId, FullName: decodeURI(this.props.userInfo.userFullName) }, CreatedOnTicks: (new Date).getTime(), UpdatedByUser: null, UpdatedOnTicks: 0 }, newState = [].concat(_toConsumableArray(this.state.comments), [newComment]); this.setState({ comments: newState, commentToEdit: newComment }), setTimeout(function () { _this4.refs.NewCommentButton.hide(); var body = $("html, body"); body.stop().animate({ scrollTop: document.body.scrollHeight }, "500", "swing", function () { }) }, 100) }, onEditComment: function (comment) { var _this5 = this; this.setState({ commentToEdit: comment }), setTimeout(function () { _this5.refs.NewCommentButton.hide(), IrsaModulesUtil.scrollToElement($("#commentBox_" + comment.sysSerial).get(0)) }, 100) }, onDeleteComment: function (comment) { var newState = this.state.comments.filter(function (e) { return e.sysSerial != comment.sysSerial }); this.setState({ comments: newState }), setTimeout(function () { IrsaModulesUtil.scrollToElement($(".comments-container").get(0)) }, 100) }, componentWillMount: function () { this.setState({ comments: this.props.comments }) }, componentWillReceiveProps: function (nextProps) { this.setState({ comments: nextProps.comments }) }, render: function () { var _this6 = this, _props3 = this.props, userInfo = _props3.userInfo, taggedAssets = _props3.taggedAssets, _state = this.state, comments = _state.comments, commentToEdit = _state.commentToEdit, hideEditContentButtons = _state.hideEditContentButtons, hideECButtons = hideEditContentButtons; 0 == hideECButtons && (hideECButtons = null != commentToEdit); var commentBoxesUI = void 0; return commentBoxesUI = comments.length > 0 ? comments.map(function (e) { var isEditModeForComment = null != commentToEdit && e.sysSerial == commentToEdit.sysSerial; return React.createElement(CommentBox, { id: e.sysSerial, key: e.sysSerial, ref: "commentBox_" + e.sysSerial, parentComp: _this6, comment: e, taggedAssets: taggedAssets, userInfo: userInfo, hideEditContentButtons: hideECButtons, isEditMode: isEditModeForComment, onSaveComment: _this6.onSaveComment, onCancel: _this6.onCancelComment, onEdit: _this6.onEditComment, onDelete: _this6.onDeleteComment }) }) : React.createElement("div", { className: "alert alert-warning case-assets", role: "alert" }, "No Comments yet"), React.createElement("div", { className: "comments-container" }, commentBoxesUI, React.createElement(NewCommentButton, { ref: "NewCommentButton", onClick: this.onNewComment })) } }); module.exports = Comments }, function(module, exports, __webpack_require__) { "use strict"; var _constants = __webpack_require__(22), HistoryUI = function (_ref) { var FullName = _ref.FullName, CreatedOnTicks = _ref.CreatedOnTicks, description = _ref.description, crDate = kendo.toString(new Date(CreatedOnTicks), _stationDateFormat), arr = description.split("
"), cnt = 0, descriptionUI = arr.map(function (d) { var desc = d.replace(/\r?\n/g, "
"); try { desc = decodeURI(desc) } catch (e) { console.log("MalFormed URI: " + desc) } return React.createElement("p", { key: ++cnt, className: "description-part", dangerouslySetInnerHTML: { __html: desc } }) }); return React.createElement("div", { className: "panel panel-default history" }, React.createElement("div", { className: "panel-heading" }, React.createElement("span", { className: "history-user-name" }, FullName), React.createElement("span", null, " " + crDate)), React.createElement("div", { className: "panel-body" }, descriptionUI)) }; HistoryUI.propTypes = { FullName: React.PropTypes.string.isRequired, description: React.PropTypes.string, CreatedOnTicks: React.PropTypes.number.isRequired }; var History = React.createClass({ displayName: "History", propTypes: { history: React.PropTypes.arrayOf(_constants.HistoryShape).isRequired }, render: function () { var history = this.props.history; return React.createElement("div", { className: "history-container" }, history.map(function (e) { return React.createElement(HistoryUI, { key: "hst_" + e.sysSerial, FullName: e.CreatedAgainstUser.FullName, description: e.description, CreatedOnTicks: e.CreatedOnTicks }) })) } }); module.exports = History }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _objectAssign = __webpack_require__(7), _objectAssign2 = _interopRequireDefault(_objectAssign), _constants = __webpack_require__(22), _userSysSerialCnt = 0, Users = React.createClass({ displayName: "Users", propTypes: { usersList: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, label: React.PropTypes.string.isRequired })).isRequired, users: React.PropTypes.arrayOf(_constants.UserShape).isRequired, userInfo: _constants.LoggedInUserShape.isRequired, stationId: React.PropTypes.number.isRequired, caseCreatedByUserId: React.PropTypes.number.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, onChanged: React.PropTypes.func.isRequired }, getInitialState: function () { return { assignedUsers: [] } }, onChangeUsers: function (vls, parentComp) { var values = vls ? vls : [], vals = values.map(function (e) { var option = { value: e.value, label: e.label, Status: e.Status, sysSerial: e.sysSerial ? e.sysSerial : --_userSysSerialCnt, ACL: e.ACL && e.ACL.length > 0 ? e.ACL : "R", ACLComparer: e.ACLComparer ? e.ACLComparer : e.ACL, PdId: e.PdId }; return parentComp.props.caseCreatedByUserId == e.value ? option.clearableValue = !1 : option.clearableValue = !0, option }); parentComp.setState({ assignedUsers: vals }), parentComp.props.onChanged() }, createUserOption: function (e) { var option = { value: e.AssignedUser.Id, label: e.AssignedUser.FullName, Status: e.AssignedUser.Status, sysSerial: e.sysSerial ? e.sysSerial : --_userSysSerialCnt, ACL: e.ACL && e.ACL.length > 0 ? e.ACL : "R", ACLComparer: e.ACLComparer ? e.ACLComparer : e.ACL, PdId: e.AssignedUser.PdId }; return this.props.caseCreatedByUserId == e.AssignedUser.Id ? option.clearableValue = !1 : option.clearableValue = !0, option }, onRemoveWatcher: function (sysSerial) { var newState = this.state.assignedUsers.filter(function (e) { return e.sysSerial != sysSerial }); this.setState({ assignedUsers: newState }), this.props.onChanged() }, onToggleACL: function (sysSerial) { if (this.props.readOnlyMode === !0) return !1; var newState = this.state.assignedUsers.map(function (e) { if (e.sysSerial == sysSerial) { var o = (0, _objectAssign2.default)({}, e); return "RW" == e.ACL ? o.ACL = "R" : o.ACL = "RW", o } return e }); this.setState({ assignedUsers: newState }), this.props.onChanged() }, userValueRenderer: function (e) { var aclUI = void 0; (function (event) { event.preventDefault(), this.onToggleACL(e.sysSerial) }).bind(this); return aclUI = this.props.caseCreatedByUserId != e.value ? React.createElement("a", { href: "#", "data-sysserial": e.sysSerial, className: "Select-value-acl " + e.ACL }, e.ACL) : React.createElement("span", { "data-sysserial": e.sysSerial, className: "Select-value disabled" }), React.createElement("div", null, aclUI, React.createElement("span", null, e.label)) }, setOnClickHandlerForACLLinks: function () { $(".users-container .Select-value-acl").unbind("click"), $(".users-container .Select-value-acl").each(function (idx, elm) { $(elm).bind("click", function (e) { e.preventDefault(); var sysSerial = $(elm).data("sysserial"); this.onToggleACL(sysSerial) }.bind(this)) }.bind(this)) }, componentWillMount: function () { var _this = this, assignedUsers = this.props.users.map(function (e) { return _this.createUserOption(e) }); this.setState({ assignedUsers: assignedUsers }) }, componentWillReceiveProps: function (nextProps) { var _this2 = this, assignedUsers = nextProps.users.map(function (e) { return _this2.createUserOption(e) }); this.setState({ assignedUsers: assignedUsers }) }, componentWillUnmount: function () { $(".Select-value-acl").unbind("click") }, changeAssignedUsers: function (PdId) { var samePdUsers = this.state.assignedUsers.filter(function (e) { return e.PdId == PdId || 0 == e.clearableValue }); this.setState({ assignedUsers: samePdUsers }) }, render: function () { var _this3 = this, _props = this.props, usersList = _props.usersList, readOnlyMode = _props.readOnlyMode, assignedUsers = this.state.assignedUsers, that = this; return setTimeout(function () { _this3.setOnClickHandlerForACLLinks() }, 200), React.createElement("div", { className: "users-container" }, React.createElement(Select, { id: "usersMultiSelect", name: "usersMultiSelect", backspaceRemoves: !1, options: usersList, value: assignedUsers, valueRenderer: this.userValueRenderer, placeholder: "Select Users", onChange: function (e) { _this3.onChangeUsers(e, that) }, delimiter: ",", joinValues: !0, multi: !0, simple: !1, searchable: !0, clearable: !1, disabled: readOnlyMode })) } }); module.exports = Users }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } var _objectAssign = __webpack_require__(7), _objectAssign2 = _interopRequireDefault(_objectAssign), _constants = __webpack_require__(22), _groupSysSerialCnt = 0, UserGroups = React.createClass({ displayName: "UserGroups", propTypes: { groupsList: React.PropTypes.arrayOf(React.PropTypes.shape({ value: React.PropTypes.number.isRequired, label: React.PropTypes.string.isRequired })).isRequired, groups: React.PropTypes.arrayOf(_constants.GroupShape).isRequired, userInfo: _constants.LoggedInUserShape.isRequired, stationId: React.PropTypes.number.isRequired, caseCreatedByUserId: React.PropTypes.number.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, defaultWatchers: React.PropTypes.arrayOf(_constants.GroupShape), onChanged: React.PropTypes.func.isRequired }, getInitialState: function () { return { assignedGroups: [] } }, onChangeGroups: function (vls, parentComp) { var values = vls ? vls : [], vals = values.map(function (e) { var option = { value: e.value, label: e.label, PDId: e.PDId, sysSerial: e.sysSerial ? e.sysSerial : --_groupSysSerialCnt, ACL: e.ACL && e.ACL.length > 0 ? e.ACL : "R", ACLComparer: e.ACLComparer ? e.ACLComparer : e.ACL }; return "DR" == e.ACL || "DRW" == e.ACL ? option.clearableValue = !1 : option.clearableValue = !0, option }); parentComp.setState({ assignedGroups: vals }), parentComp.props.onChanged() }, createUserGroupOption: function (e) { var option = { value: e.AssignedUserGroup.Id, label: e.AssignedUserGroup.Name, PDId: e.AssignedUserGroup.PDId, sysSerial: e.sysSerial ? e.sysSerial : --_groupSysSerialCnt, ACL: e.ACL && e.ACL.length > 0 ? e.ACL : "R", ACLComparer: e.ACLComparer ? e.ACLComparer : e.ACL }; return "DR" == e.ACL || "DRW" == e.ACL ? option.clearableValue = !1 : option.clearableValue = !0, option }, onRemoveWatcher: function (sysSerial) { var newState = this.state.assignedGroups.filter(function (e) { return e.sysSerial != sysSerial }); this.setState({ assignedGroups: newState }), this.props.onChanged() }, onToggleACL: function (sysSerial) { if (this.props.readOnlyMode === !0 || this.props.editUserGroup === !1) return !1; var newState = this.state.assignedGroups.map(function (e) { if (e.sysSerial == sysSerial) { var o = (0, _objectAssign2.default)({}, e); return "RW" == e.ACL ? o.ACL = "R" : o.ACL = "RW", o } return e }); this.setState({ assignedGroups: newState }), this.props.onChanged() }, groupValueRenderer: function (e) { var aclUI = void 0; (function (event) { event.preventDefault(), this.onToggleACL(e.sysSerial) }).bind(this); return aclUI = "DR" == e.ACL ? React.createElement("div", { className: "default-Watchers" }, React.createElement("span", { "data-sysserial": e.sysSerial, className: "Select-value disabled default" }, "R"), React.createElement("span", { className: "default-Label" }, e.label)) : "DRW" == e.ACL ? React.createElement("div", { className: "default-Watchers" }, React.createElement("span", { "data-sysserial": e.sysSerial, className: "Select-value disabled default" }, "RW"), React.createElement("span", { className: "default-Label" }, e.label)) : React.createElement("div", null, React.createElement("a", { href: "#", "data-sysserial": e.sysSerial, className: "Select-value-acl " + e.ACL }, e.ACL), React.createElement("span", null, e.label)) }, setOnClickHandlerForACLLinks: function () { $(".groups-container .Select-value-acl").unbind("click"), $(".groups-container .Select-value-acl").each(function (idx, elm) { $(elm).bind("click", function (e) { e.preventDefault(); var sysSerial = $(elm).data("sysserial"); this.onToggleACL(sysSerial) }.bind(this)) }.bind(this)) }, componentWillMount: function () { var _this = this, assignedGroups = this.props.groups.map(function (e) { return _this.createUserGroupOption(e) }); this.setState({ assignedGroups: assignedGroups }) }, componentWillReceiveProps: function (nextProps) { var _this2 = this, assignedGroups = nextProps.groups.map(function (e) { return _this2.createUserGroupOption(e) }); this.setState({ assignedGroups: assignedGroups }) }, componentWillUnmount: function () { $(".Select-value-acl").unbind("click") }, changeDefaultWatchersGroups: function (defaultStationUserGroups, PdId) { var _this3 = this, samePdGroups = this.state.assignedGroups.filter(function (e) { return e.PDId == PdId && 1 == e.clearableValue }), defaultAssignedGroups = defaultStationUserGroups.map(function (e) { return _this3.createUserGroupOption(e) }), finalSeletedGroups = [].concat(_toConsumableArray(samePdGroups), _toConsumableArray(defaultAssignedGroups)); this.setState({ assignedGroups: finalSeletedGroups }) }, render: function () { var _this4 = this, _props = this.props, groupsList = _props.groupsList, readOnlyMode = _props.readOnlyMode, editUserGroup = _props.editUserGroup, assignedGroups = this.state.assignedGroups, isDisabledUserGroup = !1, that = this; return isDisabledUserGroup = !!readOnlyMode || editUserGroup !== !0, setTimeout(function () { _this4.setOnClickHandlerForACLLinks() }, 200), React.createElement("div", { className: "groups-container" }, React.createElement("label", { className: "section-heading" }, "Watchers"), React.createElement(Select, { id: "groupsMultiSelect", name: "groupsMultiSelect", backspaceRemoves: !1, options: groupsList, value: assignedGroups, valueRenderer: this.groupValueRenderer, placeholder: "Select Groups", onChange: function (e) { _this4.onChangeGroups(e, that) }, delimiter: ",", joinValues: !0, multi: !0, simple: !1, searchable: !0, clearable: !1, disabled: isDisabledUserGroup })) } }); module.exports = UserGroups }, function(module, exports) { "use strict"; var ValidatedInput = React.createClass({ displayName: "ValidatedInput", propTypes: { caseID: React.PropTypes.string, isCaseIDInput: React.PropTypes.bool, Id: React.PropTypes.string.isRequired, placeholder: React.PropTypes.string.isRequired, msgValidate: React.PropTypes.string, msgRequired: React.PropTypes.string, showIntialValidation: React.PropTypes.bool, onChange: React.PropTypes.func }, getInitialState: function () { return { msgRequired: "", msgValidate: "", validationMessage: "", validationClass: "HideActivity", showIntialValidation: !1, value: "" } }, getDefaultProps: function () { return {} }, componentWillMount: function () { var _props = this.props, msgRequired = _props.msgRequired, msgValidate = _props.msgValidate, showIntialValidation = _props.showIntialValidation; this.setState({ msgRequired: msgRequired, msgValidate: msgValidate, showIntialValidation: showIntialValidation }) }, componentWillReceiveProps: function (nextProps) { var msgRequired = nextProps.msgRequired, msgValidate = nextProps.msgValidate, showIntialValidation = nextProps.showIntialValidation; this.setState({ msgRequired: msgRequired, msgValidate: msgValidate, showIntialValidation: showIntialValidation }) }, onChange: function () { var _state = this.state, msgRequired = _state.msgRequired, msgValidate = _state.msgValidate, _props2 = this.props, isCaseIDInput = _props2.isCaseIDInput, _inputValue = (_props2.caseID, $.trim(this.refs.Input.value)), isInputValid = !!(_inputValue && _inputValue.length > 0), result = !1; this.isValid(isInputValid, msgRequired, _inputValue) ? (result = !0, isCaseIDInput && isInputValid && (result = this.isValidCaseID(msgValidate, _inputValue))) : result = !1; var data = { value: _inputValue, isValid: result }; this.props.onChange.apply(window, [data]) }, isValid: function (_isValid2, msgRequired, inputValue) { return _isValid2 ? (this.setState({ validationMessage: "", validationClass: "HideActivity", showIntialValidation: !1, value: inputValue }), !0) : (this.setState({ validationMessage: msgRequired, validationClass: "validation-msg", showIntialValidation: !1, value: inputValue }), !1) }, isValidCaseID: function (msgValidate, inputValue) { var _caseID = this.props.caseID, _isValid = inputValue == _caseID; return _isValid ? (this.setState({ validationMessage: "", validationClass: "HideActivity", showIntialValidation: !1, value: inputValue }), !0) : (this.setState({ validationMessage: msgValidate, validationClass: "validation-msg", showIntialValidation: !1, value: inputValue }), !1) }, render: function () { var _props3 = this.props, Id = _props3.Id, placeholder = _props3.placeholder, validationClass = void 0, validationMessage = void 0; return validationClass = this.state.validationClass, validationMessage = this.state.validationMessage, this.state.showIntialValidation && "" == this.state.value && (validationMessage = this.state.msgRequired, validationClass = "validation-msg"), React.createElement("div", { className: "input-form" }, React.createElement("input", { id: Id, ref: "Input", isRequired: !0, type: "text", placeholder: placeholder, onChange: this.onChange, className: "form-control" }), React.createElement("p", { className: validationClass }, React.createElement("i", { className: "fa fa-info-circle" }), validationMessage)) } }), ActionCaseDeleteActivity = function (List) { var url = "/Case/CaseDeleteActivity", casesList = JSON.stringify(List); showLoaderOnVP(), makeAjaxRequest({ params: { casesList: casesList }, type: "GET", timeout: 3e5, url: url, scope: void 0, onComplete: function (resp) { var jsonResp = $.parseJSON(resp.responseText); hideLoaderOnVP(), jsonResp && 1 == jsonResp.success ? (showSuccessMsg(jsonResp.msg, "Case has been deleted"), window.location = "/Case", hideLoaderOnVP()) : (hideLoaderOnVP(), jsonResp && jsonResp.msg && showMsg(jsonResp.msg)) } }) }, CaseDeleteModal = React.createClass({ displayName: "CaseDeleteModal", props: { show: React.PropTypes.bool.isRequired, OnHide: React.PropTypes.func.isRequired, caseID: React.PropTypes.string.isRequired, caseSysSerial: React.PropTypes.number.isRequired, allowCaseDeleting: React.PropTypes.bool.isRequired, allowCaseWithEvidenceDeleting: React.PropTypes.bool.isRequired }, getInitialState: function () { return { caseIDIsValidate: !1, caseReasonIsValidate: !1, showIntialValidation: !1, cID: "", cIDReason: "" } }, onOK: function () { var caseDeleteType = "", _rdCase = !1, _rdCaseWithEvidecne = !1; void 0 != this.refs.rdcase && (_rdCase = this.refs.rdcase.checked), void 0 != this.refs.rdcasewithasset && (_rdCaseWithEvidecne = this.refs.rdcasewithasset.checked), _rdCase && (caseDeleteType = "dCase"), _rdCaseWithEvidecne && (caseDeleteType = "dCaseWithAsset"); var _state2 = this.state, cID = _state2.cID, cIDReason = _state2.cIDReason, caseIDIsValidate = _state2.caseIDIsValidate, caseReasonIsValidate = _state2.caseReasonIsValidate; if (!caseIDIsValidate || !caseReasonIsValidate) return void this.setState({ showIntialValidation: !0 }); if (caseIDIsValidate && caseReasonIsValidate) { var _tempSelectedData = { CaseSysSerial: this.props.caseSysSerial, CaseID: cID, reason: cIDReason, deleteType: caseDeleteType }; ActionCaseDeleteActivity(_tempSelectedData) } }, onCancel: function () { this.setState({ caseIDIsValidate: !1, caseReasonIsValidate: !1, showIntialValidation: !1 }), this.props.OnHide() }, onCaseIDChange: function (data) { this.setState({ cID: data.value, caseIDIsValidate: data.isValid, showIntialValidation: !1 }) }, onReasonChange: function (data) { this.setState({ cIDReason: data.value, caseReasonIsValidate: data.isValid, showIntialValidation: !1 }) }, getContent: function () { var _this = this, _props4 = this.props, allowCaseDeleting = _props4.allowCaseDeleting, allowCaseWithEvidenceDeleting = _props4.allowCaseWithEvidenceDeleting, caseID = _props4.caseID, _defaultCheckedCaseDelete = !0, _defaultCheckedCaseWithEvidenceDelete = !0, _caseDeleteRadioUI = void 0, _casewithevidecneDeleteRadioUI = void 0; return allowCaseDeleting && allowCaseWithEvidenceDeleting ? (_defaultCheckedCaseDelete = !0, _defaultCheckedCaseWithEvidenceDelete = !1) : !allowCaseDeleting && allowCaseWithEvidenceDeleting ? (_defaultCheckedCaseDelete = !1, _defaultCheckedCaseWithEvidenceDelete = !0) : allowCaseDeleting && !allowCaseWithEvidenceDeleting && (_defaultCheckedCaseDelete = !0, _defaultCheckedCaseWithEvidenceDelete = !1), allowCaseDeleting && (_caseDeleteRadioUI = React.createElement("div", { className: "radio-btn" }, React.createElement("input", { type: "radio", id: "rdcase", name: "caseDeleteGroup", ref: "rdcase", value: "dCase", defaultChecked: _defaultCheckedCaseDelete }), React.createElement("label", { htmlFor: "rdcase" }, "Case"))), allowCaseWithEvidenceDeleting && (_casewithevidecneDeleteRadioUI = React.createElement("div", { className: "radio-btn" }, React.createElement("input", { type: "radio", id: "rdcasewithasset", name: "caseDeleteGroup", ref: "rdcasewithasset", value: "dCaseWithAsset", defaultChecked: _defaultCheckedCaseWithEvidenceDelete }), React.createElement("label", { htmlFor: "rdcasewithasset" }, "Case With Evidence"))), React.createElement("div", { id: "caseDeleteContainer" }, React.createElement("div", { className: "radio-group" }, _caseDeleteRadioUI, _casewithevidecneDeleteRadioUI), React.createElement(ValidatedInput, { Id: "deltCaseId", msgValidate: "Case ID does not match", isCaseIDInput: !0, caseID: caseID, msgRequired: "Enter Case ID", placeholder: "lRes(Caseid)", onChange: function (a) { return _this.onCaseIDChange(a) }, showIntialValidation: this.state.showIntialValidation }), React.createElement(ValidatedInput, { Id: "caseIDReason", msgRequired: "Enter Reason", placeholder: "Reason...", isCaseIDInput: !1, onChange: function (a) { return _this.onReasonChange(a) }, showIntialValidation: this.state.showIntialValidation })) }, render: function () { return React.createElement(IrsaReactModal, { id: "CaseDeleteModal", ref: "CaseDeleteModal", title: "Delete Case", show: this.props.show, content: this.getContent(), width: 100, buttons: [{ key: "ok", text: "Delete", width: 90, className: "btn-glow inverse", onClick: this.onOK }, { key: "cancel", text: "Cancel", width: 90, className: "btn-glow", onClick: this.onCancel }] }) } }), CaseDeleteActivity = React.createClass({ displayName: "CaseDeleteActivity", PropTypes: { caseSysSerial: React.PropTypes.number.isRequired, caseID: React.PropTypes.string, readOnlyMode: React.PropTypes.bool.isRequired, allowCaseDeleting: React.PropTypes.bool.isRequired, allowCaseWithEvidenceDeleting: React.PropTypes.bool.isRequired, showButtonUI: React.PropTypes.bool.isRequired, showFromLister: React.PropTypes.bool }, getInitialState: function () { return { showCaseDeleteAssetModal: !1 } }, onDeleteCaseClick: function (e) { e.preventDefault(), this.setState({ showCaseDeleteAssetModal: !0 }) }, OnHide: function () { this.setState({ showCaseDeleteAssetModal: !1 }) }, componentWillMount: function () { var _props5 = this.props, showButtonUI = _props5.showButtonUI, showFromLister = _props5.showFromLister; !showButtonUI && showFromLister && this.setState({ showCaseDeleteAssetModal: !0 }) }, componentWillReceiveProps: function () { var _props6 = this.props, showButtonUI = _props6.showButtonUI, showFromLister = _props6.showFromLister; !showButtonUI && showFromLister && this.setState({ showCaseDeleteAssetModal: !0 }) }, render: function () { var _props7 = this.props, readOnlyMode = _props7.readOnlyMode, caseID = _props7.caseID, caseSysSerial = _props7.caseSysSerial, allowCaseDeleting = _props7.allowCaseDeleting, allowCaseWithEvidenceDeleting = _props7.allowCaseWithEvidenceDeleting, showButtonUI = _props7.showButtonUI, buttonsUI = (_props7.showFromLister, void 0), DeleteCaseAssetModalUI = void 0; return readOnlyMode !== !0 && caseSysSerial > 0 && (allowCaseDeleting || allowCaseWithEvidenceDeleting) && (DeleteCaseAssetModalUI = React.createElement(CaseDeleteModal, { caseSysSerial: caseSysSerial, caseID: caseID, show: this.state.showCaseDeleteAssetModal, OnHide: this.OnHide, allowCaseDeleting: allowCaseDeleting, allowCaseWithEvidenceDeleting: allowCaseWithEvidenceDeleting }), showButtonUI && (buttonsUI = React.createElement("div", { className: "case-delete-buttons" }, React.createElement("button", { className: "btn btn-default caseDeleteButtonOnPage", onClick: this.onDeleteCaseClick }, React.createElement("i", { className: "fa fa-trash-o", style: { marginRight: "5px", color: "#404040" } }), React.createElement("span", null, "Delete Case"))))), React.createElement("div", null, DeleteCaseAssetModalUI, buttonsUI) } }); module.exports = CaseDeleteActivity }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2 } return Array.from(arr) } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function") } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass) } Object.defineProperty(exports, "__esModule", { value: !0 }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor) } } return function (Constructor, protoProps, staticProps) { return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor } }(), _constants = __webpack_require__(22), _react = __webpack_require__(1), _MergeAssetDescription = __webpack_require__(197), _MergeAssetDescription2 = _interopRequireDefault(_MergeAssetDescription), _commonFunctions = __webpack_require__(74), MergeAssetDescriptionView = function (_React$Component) { function MergeAssetDescriptionView(props) { _classCallCheck(this, MergeAssetDescriptionView); var _this = _possibleConstructorReturn(this, (MergeAssetDescriptionView.__proto__ || Object.getPrototypeOf(MergeAssetDescriptionView)).call(this, props)), assets = _this.convertDataToHierarchyStructure(props.assets); return _this.state = { assets: assets }, _this } return _inherits(MergeAssetDescriptionView, _React$Component), _createClass(MergeAssetDescriptionView, [{ key: "componentWillReceiveProps", value: function (nextProps) { var assets = this.convertDataToHierarchyStructure(nextProps.assets); this.setState({ assets: assets }) } }, { key: "convertDataToHierarchyStructure", value: function (assets) { assets.sort(_commonFunctions.assetComparator); var masterAssets = assets.filter(function (e) { return 1 == e.isMaster }); masterAssets.forEach(function (ma) { var childAssets = assets.filter(function (e) { return e.evidenceGroupId == ma.evidenceGroupId && 0 == e.isMaster }); ma.childAssets = childAssets }); var otherAssets = assets.filter(function (e) { return 0 == e.isMaster }), oAssets = []; return otherAssets.map(function (e) { var found = !1; masterAssets.forEach(function (m) { if (m.assetSysSerial == e.assetSysSerial) found = !0; else { var f = m.childAssets.find(function (b) { return b.assetSysSerial == e.assetSysSerial }); null != f && (found = !0) } }), found || oAssets.push(e) }), [].concat(_toConsumableArray(masterAssets), oAssets) } }, { key: "render", value: function () { var _props = this.props, readOnlyMode = (_props.stationId, _props.userInfo, _props.readOnlyMode), isGuest = _props.isGuest, caseSysSerial = _props.caseSysSerial, MergeCaseID = _props.MergeCaseID, assets = this.state.assets; if (assets.length > 0) return React.createElement("div", { className: "case-assets-container" }, React.createElement("table", { className: "table table-bordered table-striped case-assets" }, React.createElement("tbody", null, assets.map(function (e, idx) { return React.createElement(_MergeAssetDescription2.default, { key: "ta_" + idx, ref: "Asset", asset: e, readOnlyMode: readOnlyMode, caseSysSerial: caseSysSerial, isGuest: isGuest, MergeCaseID: MergeCaseID }) })))) } }]), MergeAssetDescriptionView }(React.Component); exports.default = MergeAssetDescriptionView, MergeAssetDescriptionView.propTypes = { assets: _react.PropTypes.arrayOf(_constants.AssetShape), stationId: _react.PropTypes.number.isRequired, userInfo: _constants.LoggedInUserShape.isRequired, readOnlyMode: _react.PropTypes.bool.isRequired, isGuest: _react.PropTypes.bool.isRequired, caseSysSerial: _react.PropTypes.number.isRequired, MergeCaseID: _react.PropTypes.string.isRequired }, MergeAssetDescriptionView.defaultProps = { assets: [] } }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _MergeEvidenceGroupDetailAssetDescription = __webpack_require__(198), _MergeEvidenceGroupDetailAssetDescription2 = _interopRequireDefault(_MergeEvidenceGroupDetailAssetDescription), _constants = __webpack_require__(22), _AssetImage = __webpack_require__(75), _AssetImage2 = _interopRequireDefault(_AssetImage), _commonFunctions = __webpack_require__(74), _assetDescription = "", GetDescriptionAsset = function (caseId, assetId, evidenceGroupID) { _assetDescription = ""; var url = "/Case/GetDescriptionForAsset"; showLoaderOnVP(), makeAjaxRequest({ params: { caseID: caseId, assetID: assetId, evidenceGroupID: evidenceGroupID }, type: "GET", timeout: 3e5, url: url, async: !1, scope: void 0, onComplete: function (resp) { var jsonResp = $.parseJSON(resp.responseText); hideLoaderOnVP(), jsonResp && 1 == jsonResp.success ? _assetDescription = jsonResp.description : (hideLoaderOnVP(), jsonResp && jsonResp.msg && showMsg(jsonResp.msg)) } }) }, MergeAssetDescription = React.createClass({ displayName: "MergeAssetDescription", propTypes: { asset: _constants.AssetShape.isRequired, MergeCaseID: React.PropTypes.string.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, isGuest: React.PropTypes.bool.isRequired }, getInitialState: function () { return { expanded: !1 } }, onClickMediaLink: function () { var _props = this.props, asset = _props.asset, isGuest = _props.isGuest; if (isGuest) { var mediaPreviewContainer = document.getElementById("mediaPreview"); if ((0, _commonFunctions.isAssetAvailable)(asset.mediaStatus, asset.mediaState)) if (_constants.VIDEO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !1); else if (_constants.AUDIO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !0); else if (_constants.IMAGE_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) { var imageSrc = asset.assetURLForExport; ReactDOM.render(React.createElement(IrsaReactAssetPreview, { url: imageSrc, width: 650, height: 450 }), mediaPreviewContainer) } } }, onClickArrow: function (e) { e.preventDefault(), this.setState({ expanded: !this.state.expanded }) }, render: function () { var _props2 = this.props, readOnlyMode = _props2.readOnlyMode, isGuest = _props2.isGuest, caseSysSerial = _props2.caseSysSerial, MergeCaseID = _props2.MergeCaseID, _props$asset = this.props.asset, orderIdStr = (_props$asset.sysSerial, _props$asset.orderIdStr), assetSysSerial = _props$asset.assetSysSerial, assetID = _props$asset.assetID, evidenceGroupId = _props$asset.evidenceGroupId, thumbnail = _props$asset.thumbnail, description = (_props$asset.incidents, _props$asset.description), mediaTypeId = _props$asset.mediaTypeId, mediaStatus = _props$asset.mediaStatus, mediaState = _props$asset.mediaState, childAssets = (_props$asset.assetURLForExport, _props$asset.HasSubDetail, _props$asset.childAssets), expanded = (_props$asset.Ext_RMSID, _props$asset.isMaster, this.state.expanded), isMediaAvailable = (0, _commonFunctions.isAssetAvailable)(mediaStatus, mediaState), mediaUrl = "/Media/Detail?id=" + assetID + "&EvidenceGroupId=" + evidenceGroupId; mediaUrl += "&showSO=" + !1, isGuest === !0 && (mediaUrl = "#"); var mediaTypeUI = void 0, mediaImageUI = void 0, mediaLinkUI = void 0, mediaStatusUI = void 0, childAssetsUI = void 0, arrowIconUI = void 0, newDescUI = void 0, OldDescUI = void 0; _constants.VIDEO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Video") : _constants.IMAGE_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Image") : _constants.AUDIO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) && (mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Audio")), 1 == isMediaAvailable ? (mediaImageUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, React.createElement(_AssetImage2.default, { src: thumbnail })), mediaLinkUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, assetID)) : (mediaImageUI = React.createElement(_AssetImage2.default, { src: thumbnail }), mediaLinkUI = React.createElement("a", { href: "#", onClick: function (e) { e.preventDefault() }, style: { cursor: "default" } }, assetID)); var resolvedMediaStatus = (0, _commonFunctions.getMediaStatus)(mediaState, mediaStatus); return "" != resolvedMediaStatus && (mediaStatusUI = React.createElement("span", { className: "label label-default asset-status-desc", title: resolvedMediaStatus }, resolvedMediaStatus)), childAssets && childAssets.length > 0 && (arrowIconUI = React.createElement("a", { href: "#", onClick: this.onClickArrow }, React.createElement("i", { className: expanded ? "fa fa-caret-down" : "fa fa-caret-right", "aria-hidden": "true" })), expanded && (childAssetsUI = React.createElement("tr", null, React.createElement("td", { className: "removeBorder", colSpan: "5" }, React.createElement(_MergeEvidenceGroupDetailAssetDescription2.default, { key: "tagChildAsset_" + evidenceGroupId, ref: "AssetSubDetail", assets: childAssets, caseSysSerial: caseSysSerial, readOnlyMode: readOnlyMode, isGuest: isGuest, MergeCaseID: MergeCaseID }))))), GetDescriptionAsset(MergeCaseID, assetSysSerial, evidenceGroupId), OldDescUI = React.createElement("td", { className: "caseMergeDescription noBorder" }, React.createElement("div", { className: "caseElm" }, "Old Description"), React.createElement("div", { className: "caseDesc" }, _assetDescription)), newDescUI = React.createElement("td", { className: "caseMergeDescription" }, React.createElement("div", { className: "caseElm" }, "New Description"), React.createElement("div", { className: "caseDesc" }, description)), React.createElement("tr", { className: "asset parent-row" }, React.createElement("td", { colSpan: "5" }, React.createElement("table", { className: "caseMergeTable" }, React.createElement("tbody", null, React.createElement("tr", null, React.createElement("td", { className: "order-id" }, arrowIconUI, " #", orderIdStr), React.createElement("td", { className: "assetID" }, React.createElement("div", { className: "mediaIDContainer" }, React.createElement("div", { className: "mediaIDImage" }, mediaImageUI), React.createElement("div", { className: "mediaIDContent" }, mediaLinkUI, mediaTypeUI, mediaStatusUI))), newDescUI, OldDescUI), childAssetsUI)))) } }); module.exports = MergeAssetDescription }, function(module, exports, __webpack_require__) { "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var _constants = __webpack_require__(22), _objectAssign = __webpack_require__(7), _AssetImage = (_interopRequireDefault(_objectAssign), __webpack_require__(75)), _AssetImage2 = _interopRequireDefault(_AssetImage), _commonFunctions = __webpack_require__(74), _assetDescription = "", GetDescriptionAsset = function (caseId, assetId, evidenceGroupID) { _assetDescription = ""; var url = "/Case/GetDescriptionForAsset"; showLoaderOnVP(), makeAjaxRequest({ params: { caseID: caseId, assetID: assetId, evidenceGroupID: evidenceGroupID }, type: "GET", timeout: 3e5, url: url, async: !1, scope: void 0, onComplete: function (resp) { var jsonResp = $.parseJSON(resp.responseText); hideLoaderOnVP(), jsonResp && 1 == jsonResp.success ? _assetDescription = jsonResp.description : (hideLoaderOnVP(), jsonResp && jsonResp.msg && showMsg(jsonResp.msg)) } }) }, SubDetailAsset = React.createClass({ displayName: "SubDetailAsset", propTypes: { asset: _constants.AssetShape.isRequired, readOnlyMode: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, isGuest: React.PropTypes.bool.isRequired, MergeCaseID: React.PropTypes.string.isRequired }, onClickMediaLink: function () { var _props = this.props, asset = _props.asset, isGuest = _props.isGuest; if (isGuest) { var mediaPreviewContainer = document.getElementById("mediaPreview"); if ((0, _commonFunctions.isAssetAvailable)(asset.mediaStatus, asset.mediaState)) if (_constants.VIDEO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !1); else if (_constants.AUDIO_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) loadVideoInPlayerWindow(this, asset.assetSysSerial, asset.assetID, asset.evidenceGroupId, !0); else if (_constants.IMAGE_ASSET_TYPES.some(function (e) { return e == asset.mediaTypeId })) { var imageSrc = asset.assetURLForExport; ReactDOM.render(React.createElement(IrsaReactAssetPreview, { url: imageSrc, width: 650, height: 450 }), mediaPreviewContainer) } } }, downloadAsset: function (e, assetURLForExport) { return e.preventDefault(), $.downloadMediaFile(assetURLForExport), !1 }, render: function () { var _props2 = this.props, isGuest = (_props2.readOnlyMode, _props2.isGuest), MergeCaseID = (_props2.caseSysSerial, _props2.onUntagAsset, _props2.MergeCaseID), _props$asset = this.props.asset, orderIdStr = (_props$asset.sysSerial, _props$asset.orderIdStr), assetSysSerial = _props$asset.assetSysSerial, assetID = _props$asset.assetID, evidenceGroupId = _props$asset.evidenceGroupId, thumbnail = _props$asset.thumbnail, description = (_props$asset.incidents, _props$asset.description), mediaTypeId = _props$asset.mediaTypeId, mediaStatus = _props$asset.mediaStatus, mediaState = _props$asset.mediaState, isMediaAvailable = (_props$asset.assetURLForExport, _props$asset.isMaster, (0, _commonFunctions.isAssetAvailable)(mediaStatus, mediaState)), newDescUI = void 0, OldDescUI = void 0, mediaUrl = "/Media/Detail?id=" + assetID + "&EvidenceGroupId=" + evidenceGroupId; mediaUrl += "&showSO=" + !1, isGuest === !0 && (mediaUrl = "#"); var mediaTypeUI = void 0, mediaImageUI = void 0, mediaLinkUI = void 0, mediaStatusUI = void 0; _constants.VIDEO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Video") : _constants.IMAGE_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) ? mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Image") : _constants.AUDIO_ASSET_TYPES.some(function (e) { return e == mediaTypeId }) && (mediaTypeUI = React.createElement("span", { className: "label label-default media-type" }, "Audio")), 1 == isMediaAvailable ? (mediaImageUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, React.createElement(_AssetImage2.default, { src: thumbnail })), mediaLinkUI = React.createElement("a", { href: mediaUrl, onClick: this.onClickMediaLink }, assetID)) : (mediaImageUI = React.createElement(_AssetImage2.default, { src: thumbnail }), mediaLinkUI = React.createElement("a", { href: "#", onClick: function (e) { e.preventDefault() }, style: { cursor: "default" } }, assetID)); var resolvedMediaStatus = (0, _commonFunctions.getMediaStatus)(mediaState, mediaStatus); return "" != resolvedMediaStatus && (mediaStatusUI = React.createElement("span", { className: "label label-default asset-status-desc", title: resolvedMediaStatus }, resolvedMediaStatus)), GetDescriptionAsset(MergeCaseID, assetSysSerial, evidenceGroupId), OldDescUI = React.createElement("td", { className: "caseMergeDescription noBorder" }, React.createElement("div", { className: "caseElm" }, "Old Description"), React.createElement("div", { className: "caseDesc" }, _assetDescription)), newDescUI = React.createElement("td", { className: "caseMergeDescription" }, React.createElement("div", { className: "caseElm" }, "New Description"), React.createElement("div", { className: "caseDesc" }, description)), React.createElement("tr", { className: "asset" }, React.createElement("td", { colSpan: "5" }, React.createElement("table", { className: "caseMergeTable" }, React.createElement("tbody", null, React.createElement("tr", null, React.createElement("td", { className: "order-id" }, "#", orderIdStr), React.createElement("td", { className: "assetID" }, React.createElement("div", { className: "mediaIDContainer" }, React.createElement("div", { className: "mediaIDImage" }, mediaImageUI), React.createElement("div", { className: "mediaIDContent" }, mediaLinkUI, mediaTypeUI, mediaStatusUI))), newDescUI, OldDescUI))))) } }), MergeEvidenceGroupDetailAssetDescription = React.createClass({ displayName: "MergeEvidenceGroupDetailAssetDescription", propTypes: { assets: React.PropTypes.arrayOf(_constants.AssetShape), readOnlyMode: React.PropTypes.bool.isRequired, isGuest: React.PropTypes.bool.isRequired, caseSysSerial: React.PropTypes.number.isRequired, MergeCaseID: React.PropTypes.string.isRequired }, getDefaultProps: function () { return { assets: [] } }, getInitialState: function () { return { assets: [] } }, render: function () { var _props3 = this.props, assets = _props3.assets, readOnlyMode = _props3.readOnlyMode, isGuest = _props3.isGuest, caseSysSerial = (_props3.allowAssetsPlaying, _props3.allowAssetsDownloading, _props3.caseSysSerial), MergeCaseID = (_props3.assetOrderId, _props3.MergeCaseID), taggedAssetCnt = 0; return assets.length > 0 ? React.createElement("div", { className: "case-assets-child-container" }, React.createElement("table", { className: "table case-assets" }, React.createElement("tbody", null, assets.map(function (e) { return ++taggedAssetCnt, React.createElement(SubDetailAsset, { key: "tac_" + taggedAssetCnt, ref: "Asset", asset: e, readOnlyMode: readOnlyMode, caseSysSerial: caseSysSerial, isGuest: isGuest, MergeCaseID: MergeCaseID }) })))) : React.createElement("span", null) } }); module.exports = MergeEvidenceGroupDetailAssetDescription }]); /* * jQuery Templates Plugin 1.0.0pre * http://github.com/jquery/jquery-tmpl * Requires jQuery 1.4.2 * * Copyright 2011, Software Freedom Conservancy, Inc. * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ (function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i").join(">").split('"').join(""").split("'").join("'")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);