diff --git a/demo/demo.js b/demo/demo.js index 009ae89..68baf11 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -218,6 +218,15 @@ function headBucket() { }); } +function deleteBucket() { + cos.deleteBucket({ + Bucket: 'testnew-' + config.Bucket.substr(config.Bucket.lastIndexOf('-') + 1), + Region: 'ap-guangzhou' + }, function (err, data) { + console.log(err || data); + }); +} + function putBucketAcl() { cos.putBucketAcl({ Bucket: config.Bucket, // Bucket 格式:test-1250000000 @@ -275,15 +284,13 @@ function putBucketCors() { cos.putBucketCors({ Bucket: config.Bucket, // Bucket 格式:test-1250000000 Region: config.Region, - CORSConfiguration: { - "CORSRules": [{ - "AllowedOrigin": ["*"], - "AllowedMethod": ["GET", "POST", "PUT", "DELETE", "HEAD"], - "AllowedHeader": ["*"], - "ExposeHeader": ["ETag", "Date", "Content-Length", "x-cos-acl", "x-cos-version-id", "x-cos-delete-marker", "x-cos-server-side-encryption"], - "MaxAgeSeconds": "5" - }] - } + CORSRules: [{ + "AllowedOrigin": ["*"], + "AllowedMethod": ["GET", "POST", "PUT", "DELETE", "HEAD"], + "AllowedHeader": ["*"], + "ExposeHeader": ["ETag", "Date", "Content-Length", "x-cos-acl", "x-cos-version-id", "x-cos-request-id", "x-cos-delete-marker", "x-cos-server-side-encryption"], + "MaxAgeSeconds": "5" + }] }, function (err, data) { logger.log(err || data); }); @@ -570,15 +577,69 @@ function deleteBucketReplication() { }); } -function deleteBucket() { - cos.deleteBucket({ - Bucket: config.Bucket, +function putBucketWebsite() { + cos.putBucketWebsite({ + Bucket: config.Bucket, // Bucket 格式:test-1250000000 Region: config.Region, + WebsiteConfiguration: { + IndexDocument: { + Suffix: "index.html" // 必选 + }, + RedirectAllRequestsTo: { + Protocol: "https" + }, + // ErrorDocument: { + // Key: "error.html" + // }, + // RoutingRules: [{ + // Condition: { + // HttpErrorCodeReturnedEquals: "404" + // }, + // Redirect: { + // Protocol: "https", + // ReplaceKeyWith: "404.html" + // } + // }, { + // Condition: { + // KeyPrefixEquals: "docs/" + // }, + // Redirect: { + // Protocol: "https", + // ReplaceKeyPrefixWith: "documents/" + // } + // }, { + // Condition: { + // KeyPrefixEquals: "img/" + // }, + // Redirect: { + // Protocol: "https", + // ReplaceKeyWith: "picture.jpg" + // } + // }] + } }, function (err, data) { logger.log(err || data); }); } +function getBucketWebsite() { + cos.getBucketWebsite({ + Bucket: config.Bucket, // Bucket 格式:test-1250000000 + Region: config.Region + },function(err, data){ + logger.log(err || data); + }); +} + +function deleteBucketWebsite() { + cos.deleteBucketWebsite({ + Bucket: config.Bucket, // Bucket 格式:test-1250000000 + Region: config.Region + },function(err, data){ + logger.log(err || data); + }); +} + function putObject() { // 创建测试文件 var filename = '1mb.zip'; @@ -908,6 +969,9 @@ function sliceCopyFile() { 'putBucketReplication', 'getBucketReplication', 'deleteBucketReplication', + 'putBucketWebsite', + 'getBucketWebsite', + 'deleteBucketWebsite', 'deleteBucket', 'putObject', 'putObjectCopy', diff --git a/dist/cos-js-sdk-v5.js b/dist/cos-js-sdk-v5.js index 8ceb74d..27d3ced 100644 --- a/dist/cos-js-sdk-v5.js +++ b/dist/cos-js-sdk-v5.js @@ -2003,7 +2003,7 @@ base.init(COS, task); advance.init(COS, task); COS.getAuthorization = util.getAuth; -COS.version = '0.5.20'; +COS.version = '0.5.21'; module.exports = COS; @@ -3811,39 +3811,43 @@ var initTask = function (cos) { }; var startNextTask = function () { - if (nextUploadIndex < queue.length && uploadingFileCount < cos.options.FileParallelLimit) { - var task = queue[nextUploadIndex]; - nextUploadIndex++; - if (task.state === 'waiting') { - uploadingFileCount++; - task.state = 'checking'; - task.params.onTaskStart && task.params.onTaskStart(formatTask(task)); - !task.params.UploadData && (task.params.UploadData = {}); - var apiParams = util.formatParams(task.api, task.params); - originApiMap[task.api].call(cos, apiParams, function (err, data) { - if (!cos._isRunningTask(task.id)) return; - if (task.state === 'checking' || task.state === 'uploading') { - task.state = err ? 'error' : 'success'; - err && (task.error = err); - uploadingFileCount--; - emitListUpdate(); - startNextTask(cos); - task.callback && task.callback(err, data); - if (task.state === 'success') { - if (task.params) { - delete task.params.UploadData; - delete task.params.Body; - delete task.params; - } - delete task.callback; - } - } - clearQueue(); - }); + // 检查是否允许增加执行进程 + if (uploadingFileCount >= cos.options.FileParallelLimit) return; + // 跳过不可执行的任务 + while (queue[nextUploadIndex] && queue[nextUploadIndex].state !== 'waiting') nextUploadIndex++; + // 检查是否已遍历结束 + if (nextUploadIndex >= queue.length) return; + // 上传该遍历到的任务 + var task = queue[nextUploadIndex]; + nextUploadIndex++; + uploadingFileCount++; + task.state = 'checking'; + task.params.onTaskStart && task.params.onTaskStart(formatTask(task)); + !task.params.UploadData && (task.params.UploadData = {}); + var apiParams = util.formatParams(task.api, task.params); + originApiMap[task.api].call(cos, apiParams, function (err, data) { + if (!cos._isRunningTask(task.id)) return; + if (task.state === 'checking' || task.state === 'uploading') { + task.state = err ? 'error' : 'success'; + err && (task.error = err); + uploadingFileCount--; emitListUpdate(); + startNextTask(); + task.callback && task.callback(err, data); + if (task.state === 'success') { + if (task.params) { + delete task.params.UploadData; + delete task.params.Body; + delete task.params; + } + delete task.callback; + } } - startNextTask(cos); - } + clearQueue(); + }); + emitListUpdate(); + // 异步执行下一个任务 + setTimeout(startNextTask); }; var killTask = function (id, switchToState) { @@ -3861,7 +3865,7 @@ var initTask = function (cos) { emitListUpdate(); if (running) { uploadingFileCount--; - startNextTask(cos); + startNextTask(); } if (switchToState === 'canceled') { if (task.params) { @@ -3950,7 +3954,7 @@ var initTask = function (cos) { queue.push(task); task.size = size; !ignoreAddEvent && emitListUpdate(); - startNextTask(cos); + startNextTask(); clearQueue(); }); return id; @@ -4104,46 +4108,6 @@ function deleteBucket(params, callback) { }); } -/** - * 获取 Bucket 的 权限列表 - * @param {Object} params 参数对象,必须 - * @param {String} params.Bucket Bucket名称,必须 - * @param {String} params.Region 地域名称,必须 - * @param {Function} callback 回调函数,必须 - * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 - * @return {Object} data 返回的数据 - * @return {Object} data.AccessControlPolicy 访问权限信息 - */ -function getBucketAcl(params, callback) { - submitRequest.call(this, { - Action: 'name/cos:GetBucketACL', - method: 'GET', - Bucket: params.Bucket, - Region: params.Region, - headers: params.Headers, - action: 'acl' - }, function (err, data) { - if (err) { - return callback(err); - } - var AccessControlPolicy = data.AccessControlPolicy || {}; - var Owner = AccessControlPolicy.Owner || {}; - var Grant = AccessControlPolicy.AccessControlList.Grant || []; - Grant = util.isArray(Grant) ? Grant : [Grant]; - var result = decodeAcl(AccessControlPolicy); - if (data.headers && data.headers['x-cos-acl']) { - result.ACL = data.headers['x-cos-acl']; - } - result = util.extend(result, { - Owner: Owner, - Grants: Grant, - statusCode: data.statusCode, - headers: data.headers - }); - callback(null, result); - }); -} - /** * 设置 Bucket 的 权限列表 * @param {Object} params 参数对象,必须 @@ -4201,55 +4165,42 @@ function putBucketAcl(params, callback) { } /** - * 获取 Bucket 的 跨域设置 + * 获取 Bucket 的 权限列表 * @param {Object} params 参数对象,必须 * @param {String} params.Bucket Bucket名称,必须 * @param {String} params.Region 地域名称,必须 * @param {Function} callback 回调函数,必须 * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 * @return {Object} data 返回的数据 - * @return {Object} data.CORSRules Bucket的跨域设置 + * @return {Object} data.AccessControlPolicy 访问权限信息 */ -function getBucketCors(params, callback) { +function getBucketAcl(params, callback) { submitRequest.call(this, { - Action: 'name/cos:GetBucketCORS', + Action: 'name/cos:GetBucketACL', method: 'GET', Bucket: params.Bucket, Region: params.Region, headers: params.Headers, - action: 'cors' + action: 'acl' }, function (err, data) { if (err) { - if (err.statusCode === 404 && err.error && err.error.Code === 'NoSuchCORSConfiguration') { - var result = { - CORSRules: [], - statusCode: err.statusCode - }; - err.headers && (result.headers = err.headers); - callback(null, result); - } else { - callback(err); - } - return; + return callback(err); } - var CORSConfiguration = data.CORSConfiguration || {}; - var CORSRules = CORSConfiguration.CORSRules || CORSConfiguration.CORSRule || []; - CORSRules = util.clone(util.isArray(CORSRules) ? CORSRules : [CORSRules]); - - util.each(CORSRules, function (rule) { - util.each(['AllowedOrigin', 'AllowedHeader', 'AllowedMethod', 'ExposeHeader'], function (key, j) { - var sKey = key + 's'; - var val = rule[sKey] || rule[key] || []; - delete rule[key]; - rule[sKey] = util.isArray(val) ? val : [val]; - }); - }); - - callback(null, { - CORSRules: CORSRules, + var AccessControlPolicy = data.AccessControlPolicy || {}; + var Owner = AccessControlPolicy.Owner || {}; + var Grant = AccessControlPolicy.AccessControlList.Grant || []; + Grant = util.isArray(Grant) ? Grant : [Grant]; + var result = decodeAcl(AccessControlPolicy); + if (data.headers && data.headers['x-cos-acl']) { + result.ACL = data.headers['x-cos-acl']; + } + result = util.extend(result, { + Owner: Owner, + Grants: Grant, statusCode: data.statusCode, headers: data.headers }); + callback(null, result); }); } @@ -4304,68 +4255,52 @@ function putBucketCors(params, callback) { } /** - * 删除 Bucket 的 跨域设置 - * @param {Object} params 参数对象,必须 - * @param {String} params.Bucket Bucket名称,必须 - * @param {String} params.Region 地域名称,必须 - * @param {Function} callback 回调函数,必须 - * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 - * @return {Object} data 返回的数据 + * 获取 Bucket 的 跨域设置 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回的数据 + * @return {Object} data.CORSRules Bucket的跨域设置 */ -function deleteBucketCors(params, callback) { +function getBucketCors(params, callback) { submitRequest.call(this, { - Action: 'name/cos:DeleteBucketCORS', - method: 'DELETE', + Action: 'name/cos:GetBucketCORS', + method: 'GET', Bucket: params.Bucket, Region: params.Region, headers: params.Headers, action: 'cors' }, function (err, data) { - if (err && err.statusCode === 204) { - return callback(null, { statusCode: err.statusCode }); - } else if (err) { - return callback(err); - } - callback(null, { - statusCode: data.statusCode || err.statusCode, - headers: data.headers - }); - }); -} - -function putBucketPolicy(params, callback) { - var Policy = params['Policy']; - var PolicyStr = Policy; - try { - if (typeof Policy === 'string') { - Policy = JSON.parse(PolicyStr); - } else { - PolicyStr = JSON.stringify(Policy); + if (err) { + if (err.statusCode === 404 && err.error && err.error.Code === 'NoSuchCORSConfiguration') { + var result = { + CORSRules: [], + statusCode: err.statusCode + }; + err.headers && (result.headers = err.headers); + callback(null, result); + } else { + callback(err); + } + return; } - } catch (e) { - callback({ error: 'Policy format error' }); - } + var CORSConfiguration = data.CORSConfiguration || {}; + var CORSRules = CORSConfiguration.CORSRules || CORSConfiguration.CORSRule || []; + CORSRules = util.clone(util.isArray(CORSRules) ? CORSRules : [CORSRules]); - var headers = params.Headers; - headers['Content-Type'] = 'application/json'; - headers['Content-MD5'] = util.binaryBase64(util.md5(PolicyStr)); + util.each(CORSRules, function (rule) { + util.each(['AllowedOrigin', 'AllowedHeader', 'AllowedMethod', 'ExposeHeader'], function (key, j) { + var sKey = key + 's'; + var val = rule[sKey] || rule[key] || []; + delete rule[key]; + rule[sKey] = util.isArray(val) ? val : [val]; + }); + }); - submitRequest.call(this, { - Action: 'name/cos:PutBucketPolicy', - method: 'PUT', - Bucket: params.Bucket, - Region: params.Region, - action: 'policy', - body: util.isBrowser ? PolicyStr : Policy, - headers: headers, - json: true - }, function (err, data) { - if (err && err.statusCode === 204) { - return callback(null, { statusCode: err.statusCode }); - } else if (err) { - return callback(err); - } callback(null, { + CORSRules: CORSRules, statusCode: data.statusCode, headers: data.headers }); @@ -4381,14 +4316,14 @@ function putBucketPolicy(params, callback) { * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 * @return {Object} data 返回的数据 */ -function deleteBucketPolicy(params, callback) { +function deleteBucketCors(params, callback) { submitRequest.call(this, { - Action: 'name/cos:DeleteBucketPolicy', + Action: 'name/cos:DeleteBucketCORS', method: 'DELETE', Bucket: params.Bucket, Region: params.Region, headers: params.Headers, - action: 'policy' + action: 'cors' }, function (err, data) { if (err && err.statusCode === 204) { return callback(null, { statusCode: err.statusCode }); @@ -4427,6 +4362,45 @@ function getBucketLocation(params, callback) { }); } +function putBucketPolicy(params, callback) { + var Policy = params['Policy']; + var PolicyStr = Policy; + try { + if (typeof Policy === 'string') { + Policy = JSON.parse(PolicyStr); + } else { + PolicyStr = JSON.stringify(Policy); + } + } catch (e) { + callback({ error: 'Policy format error' }); + } + + var headers = params.Headers; + headers['Content-Type'] = 'application/json'; + headers['Content-MD5'] = util.binaryBase64(util.md5(PolicyStr)); + + submitRequest.call(this, { + Action: 'name/cos:PutBucketPolicy', + method: 'PUT', + Bucket: params.Bucket, + Region: params.Region, + action: 'policy', + body: util.isBrowser ? PolicyStr : Policy, + headers: headers, + json: true + }, function (err, data) { + if (err && err.statusCode === 204) { + return callback(null, { statusCode: err.statusCode }); + } else if (err) { + return callback(err); + } + callback(null, { + statusCode: data.statusCode, + headers: data.headers + }); + }); +} + /** * 获取 Bucket 的读取权限策略 * @param {Object} params 参数对象,必须 @@ -4471,44 +4445,30 @@ function getBucketPolicy(params, callback) { } /** - * 获取 Bucket 的标签设置 - * @param {Object} params 参数对象,必须 - * @param {String} params.Bucket Bucket名称,必须 - * @param {String} params.Region 地域名称,必须 - * @param {Function} callback 回调函数,必须 - * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 - * @return {Object} data 返回数据 + * 删除 Bucket 的 跨域设置 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回的数据 */ -function getBucketTagging(params, callback) { +function deleteBucketPolicy(params, callback) { submitRequest.call(this, { - Action: 'name/cos:GetBucketTagging', - method: 'GET', + Action: 'name/cos:DeleteBucketPolicy', + method: 'DELETE', Bucket: params.Bucket, Region: params.Region, headers: params.Headers, - action: 'tagging' + action: 'policy' }, function (err, data) { - if (err) { - if (err.statusCode === 404 && err.error && (err.error === "Not Found" || err.error.Code === 'NoSuchTagSet')) { - var result = { - Tags: [], - statusCode: err.statusCode - }; - err.headers && (result.headers = err.headers); - callback(null, result); - } else { - callback(err); - } - return; + if (err && err.statusCode === 204) { + return callback(null, { statusCode: err.statusCode }); + } else if (err) { + return callback(err); } - var Tags = []; - try { - Tags = data.Tagging.TagSet.Tag || []; - } catch (e) {} - Tags = util.clone(util.isArray(Tags) ? Tags : [Tags]); callback(null, { - Tags: Tags, - statusCode: data.statusCode, + statusCode: data.statusCode || err.statusCode, headers: data.headers }); }); @@ -4556,6 +4516,50 @@ function putBucketTagging(params, callback) { }); } +/** + * 获取 Bucket 的标签设置 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回数据 + */ +function getBucketTagging(params, callback) { + submitRequest.call(this, { + Action: 'name/cos:GetBucketTagging', + method: 'GET', + Bucket: params.Bucket, + Region: params.Region, + headers: params.Headers, + action: 'tagging' + }, function (err, data) { + if (err) { + if (err.statusCode === 404 && err.error && (err.error === "Not Found" || err.error.Code === 'NoSuchTagSet')) { + var result = { + Tags: [], + statusCode: err.statusCode + }; + err.headers && (result.headers = err.headers); + callback(null, result); + } else { + callback(err); + } + return; + } + var Tags = []; + try { + Tags = data.Tagging.TagSet.Tag || []; + } catch (e) {} + Tags = util.clone(util.isArray(Tags) ? Tags : [Tags]); + callback(null, { + Tags: Tags, + statusCode: data.statusCode, + headers: data.headers + }); + }); +} + /** * 删除 Bucket 的 标签设置 * @param {Object} params 参数对象,必须 @@ -4809,6 +4813,140 @@ function deleteBucketReplication(params, callback) { }); } +/** + * 设置 Bucket 静态网站配置信息 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Object} params.WebsiteConfiguration 地域名称,必须 + * @param {Object} WebsiteConfiguration.IndexDocument 索引文档,必须 + * @param {Object} WebsiteConfiguration.ErrorDocument 错误文档,非必须 + * @param {Object} WebsiteConfiguration.RedirectAllRequestsTo 重定向所有请求,非必须 + * @param {Array} params.RoutingRules 重定向规则,非必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回数据 + */ +function putBucketWebsite(params, callback) { + + if (!params['WebsiteConfiguration']) { + callback({ error: 'missing param WebsiteConfiguration' }); + return; + } + + var WebsiteConfiguration = util.clone(params['WebsiteConfiguration'] || {}); + var RoutingRules = WebsiteConfiguration['RoutingRules'] || WebsiteConfiguration['RoutingRule'] || []; + RoutingRules = util.isArray(RoutingRules) ? RoutingRules : [RoutingRules]; + delete WebsiteConfiguration.RoutingRule; + delete WebsiteConfiguration.RoutingRules; + RoutingRules.length > 0 && (WebsiteConfiguration.RoutingRules = { RoutingRule: RoutingRules }); + var xml = util.json2xml({ WebsiteConfiguration: WebsiteConfiguration }); + + var headers = params.Headers; + headers['Content-Type'] = 'application/xml'; + headers['Content-MD5'] = util.binaryBase64(util.md5(xml)); + + submitRequest.call(this, { + Action: 'name/cos:PutBucketWebsite', + method: 'PUT', + Bucket: params.Bucket, + Region: params.Region, + body: xml, + action: 'website', + headers: headers + }, function (err, data) { + if (err && err.statusCode === 204) { + return callback(null, { statusCode: err.statusCode }); + } else if (err) { + return callback(err); + } + callback(null, { + statusCode: data.statusCode, + headers: data.headers + }); + }); +} + +/** + * 获取 Bucket 的静态网站配置信息 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回数据 + */ +function getBucketWebsite(params, callback) { + + submitRequest.call(this, { + Action: 'name/cos:GetBucketWebsite', + method: 'GET', + Bucket: params.Bucket, + Region: params.Region, + Key: params.Key, + headers: params.Headers, + action: 'website' + }, function (err, data) { + if (err) { + if (err.statusCode === 404 && err.error.Code === 'NoSuchWebsiteConfiguration') { + var result = { + WebsiteConfiguration: {}, + statusCode: err.statusCode + }; + err.headers && (result.headers = err.headers); + callback(null, result); + } else { + callback(err); + } + return; + } + + var WebsiteConfiguration = data.WebsiteConfiguration || {}; + if (WebsiteConfiguration['RoutingRules']) { + var RoutingRules = util.clone(WebsiteConfiguration['RoutingRules'].RoutingRule || []); + RoutingRules = util.makeArray(RoutingRules); + WebsiteConfiguration.RoutingRules = RoutingRules; + } + + callback(null, { + WebsiteConfiguration: WebsiteConfiguration, + statusCode: data.statusCode, + headers: data.headers + }); + }); +} + +/** + * 删除 Bucket 的静态网站配置 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回数据 + */ +function deleteBucketWebsite(params, callback) { + + submitRequest.call(this, { + Action: 'name/cos:DeleteBucketWebsite', + method: 'DELETE', + Bucket: params.Bucket, + Region: params.Region, + headers: params.Headers, + action: 'website' + }, function (err, data) { + if (err && err.statusCode === 204) { + return callback(null, { statusCode: err.statusCode }); + } else if (err) { + return callback(err); + } + callback(null, { + statusCode: data.statusCode, + headers: data.headers + }); + }); +} + // Object 相关 /** @@ -5466,7 +5604,7 @@ function multipartInit(params, callback) { // 特殊处理 Cache-Control !headers['Cache-Control'] && (headers['Cache-Control'] = ''); - util.getBodyMd5(params.UploadAddMetaMd5 || self.options.UploadAddMetaMd5, params.Body, function (md5) { + util.getBodyMd5(params.Body && (params.UploadAddMetaMd5 || self.options.UploadAddMetaMd5), params.Body, function (md5) { if (md5) params.Headers['x-cos-meta-md5'] = md5; submitRequest.call(self, { Action: 'name/cos:InitiateMultipartUpload', @@ -6329,29 +6467,32 @@ function _submitRequest(params, callback) { var API_MAP = { // Bucket 相关方法 + headBucket: headBucket, // Bucket getBucket: getBucket, - headBucket: headBucket, deleteBucket: deleteBucket, + putBucketAcl: putBucketAcl, // BucketACL getBucketAcl: getBucketAcl, - putBucketAcl: putBucketAcl, + putBucketCors: putBucketCors, // BucketCors getBucketCors: getBucketCors, - putBucketCors: putBucketCors, deleteBucketCors: deleteBucketCors, - getBucketLocation: getBucketLocation, - putBucketTagging: putBucketTagging, - getBucketTagging: getBucketTagging, - deleteBucketTagging: deleteBucketTagging, - getBucketPolicy: getBucketPolicy, + getBucketLocation: getBucketLocation, // BucketLocation + getBucketPolicy: getBucketPolicy, // BucketPolicy putBucketPolicy: putBucketPolicy, deleteBucketPolicy: deleteBucketPolicy, + putBucketTagging: putBucketTagging, // BucketTagging + getBucketTagging: getBucketTagging, + deleteBucketTagging: deleteBucketTagging, + putBucketLifecycle: putBucketLifecycle, // BucketLifecycle getBucketLifecycle: getBucketLifecycle, - putBucketLifecycle: putBucketLifecycle, deleteBucketLifecycle: deleteBucketLifecycle, - putBucketVersioning: putBucketVersioning, + putBucketVersioning: putBucketVersioning, // BucketVersioning getBucketVersioning: getBucketVersioning, - putBucketReplication: putBucketReplication, + putBucketReplication: putBucketReplication, // BucketReplication getBucketReplication: getBucketReplication, deleteBucketReplication: deleteBucketReplication, + putBucketWebsite: putBucketWebsite, // BucketWebsite + getBucketWebsite: getBucketWebsite, + deleteBucketWebsite: deleteBucketWebsite, // Object 相关方法 getObject: getObject, @@ -11832,6 +11973,26 @@ function sliceCopyFile(params, callback) { } TargetHeader['x-cos-storage-class'] = params.Headers['x-cos-storage-class'] || SourceHeaders['x-cos-storage-class']; TargetHeader = util.clearKey(TargetHeader); + /** + * 对于归档存储的对象,如果未恢复副本,则不允许 Copy + */ + if (SourceHeaders['x-cos-storage-class'] === 'ARCHIVE') { + var restoreHeader = SourceHeaders['x-cos-restore']; + if (!restoreHeader || restoreHeader === 'ongoing-request="true"') { + callback({ error: 'Unrestored archive object is not allowed to be copied' }); + return; + } + } + /** + * 去除一些无用的头部,规避 multipartInit 出错 + * 这些头部通常是在 putObjectCopy 时才使用 + */ + delete TargetHeader['x-cos-copy-source']; + delete TargetHeader['x-cos-metadata-directive']; + delete TargetHeader['x-cos-copy-source-If-Modified-Since']; + delete TargetHeader['x-cos-copy-source-If-Unmodified-Since']; + delete TargetHeader['x-cos-copy-source-If-Match']; + delete TargetHeader['x-cos-copy-source-If-None-Match']; self.multipartInit({ Bucket: Bucket, Region: Region, diff --git a/dist/cos-js-sdk-v5.min.js b/dist/cos-js-sdk-v5.min.js index 901eea4..2ca063e 100644 --- a/dist/cos-js-sdk-v5.min.js +++ b/dist/cos-js-sdk-v5.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.COS=t():e.COS=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=3)}([function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function o(e){return u(e,function(e){return"object"==typeof e?o(e):e})}function i(e,t){return c(t,function(n,r){e[r]=t[r]}),e}function a(e){return e instanceof Array}function s(e,t){for(var n=!1,r=0;rt?1:-1})},d=function(e){var t,n,o,i=[],a=l(e);for(t=0;t=r){var c=i.digest("hex");return void t(null,c)}var u=Math.min(r,s+1048576);E.fileSlice(e,s,u,!1,function(e){v(e,function(t){e=null,i=i.update(t,!0),o+=t.length,t=null,n&&n({loaded:o,total:r,percent:Math.round(o/r*1e4)/1e4}),a(s+1048576)})})};a(0)},x=function(e){var t,n,r,o="";for(t=0,n=e.length/2;t-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!r)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e){if(!n)return"Bucket";if(!r)return"Region";if(!o)return"Key"}return!1},S=function(e,t){if(t=i({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};if(t&&"object"==typeof t){!function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}();var r={"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext"};E.each(r,function(e,r){void 0!==t[e]&&(n[r]=t[e])}),t.Headers=y(n)}}return t},T=function(e,t){return function(n,r){"function"==typeof n&&(r=n,n={}),n=S(e,n);var o=function(e){return e&&e.headers&&(e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},i=function(e,t){r&&r(o(e),o(t))};if("getService"!==e&&"abortUploadTask"!==e){var a;if(a=k(e,n))return void i({error:"missing param "+a});if(n.Region){if(n.Region.indexOf("cos.")>-1)return void i({error:'param Region should not be start with "cos."'});if(!/^([a-z\d-]+)$/.test(n.Region))return void i({error:"Region format error."});this.options.CompatibilityMode||-1!==n.Region.indexOf("-")||"yfb"===n.Region||"default"===n.Region||console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!this.options.AppId)return void i({error:'Bucket should format as "test-1250000000".'});n.Bucket=n.Bucket+"-"+this.options.AppId}n.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete n.AppId)}!this.options.UseRawKey&&n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}var s=t.call(this,n,i);if("getAuth"===e||"getObjectUrl"===e)return s}},w=function(e,t){function n(){if(o=0,t&&"function"==typeof t){r=Date.now();var n,i=Math.max(0,Math.round((s-a)/((r-c)/1e3)*100)/100);n=0===s&&0===e?1:Math.round(s/e*100)/100||0,c=r,a=s;try{t({loaded:s,total:e,speed:i,percent:n})}catch(e){}}}var r,o,i=this,a=0,s=0,c=Date.now();return function(t,r){if(t&&(s=t.loaded,e=t.total),r)clearTimeout(o),n();else{if(o)return;o=setTimeout(n,i.options.ProgressInterval)}}},R=function(e,t,n){var r;if("string"==typeof t.Body&&(t.Body=new Blob([t.Body],{type:"text/plain"})),!t.Body||!(t.Body instanceof Blob||"[object File]"===t.Body.toString()||"[object Blob]"===t.Body.toString()))return void n({error:"params body format error, Only allow File|Blob|String."});r=t.Body.size,t.ContentLength=r,n(null,r)},A=function(e){return Date.now()+(e||0)},E={noop:m,formatParams:S,apiWrapper:T,xml2json:p,json2xml:h,md5:d,clearKey:y,getFileMd5:C,binaryBase64:x,extend:i,isArray:a,isInArray:s,each:c,map:u,filter:l,clone:o,uuid:b,camSafeUrlEncode:r,throttleOnProgress:w,getFileSize:R,getSkewTime:A,getAuth:g,isBrowser:!0},B=function(){var e=function(e,t){e=e.split("."),t=t.split(".");for(var n=0;nparseInt(t[n])?1:-1;return 0};return function(t){var n=(t.match(/Chrome\/([.\d]+)/)||[])[1],r=(t.match(/QBCore\/([.\d]+)/)||[])[1],o=(t.match(/QQBrowser\/([.\d]+)/)||[])[1];return n&&e(n,"53.0.2785.116")<0&&r&&e(r,"3.53.991.400")<0&&o&&e(o,"9.0.2524.400")<=0||!1}(navigator&&navigator.userAgent)}();E.fileSlice=function(e,t,n,r,o){var i;if(e.slice?i=e.slice(t,n):e.mozSlice?i=e.mozSlice(t,n):e.webkitSlice&&(i=e.webkitSlice(t,n)),r&&B){var a=new FileReader;a.onload=function(e){i=null,o(new Blob([a.result]))},a.readAsArrayBuffer(i)}else o(i)},E.getFileUUID=function(e,t){return e.name&&e.size&&e.lastModifiedDate&&t?E.md5([e.name,e.size,e.lastModifiedDate,t].join("::")):null},E.getBodyMd5=function(e,t,n,r){n=n||m,e?"string"==typeof t?n(E.md5(t,!0)):Blob&&t instanceof Blob?E.getFileMd5(t,function(e,t){n(t)},r):n():n()},e.exports=E},function(e,t){function n(e,t){for(var n in e)t[n]=e[n]}function r(e,t){function r(){}var o=e.prototype;if(Object.create){var i=Object.create(t.prototype);o.__proto__=i}o instanceof t||(r.prototype=t.prototype,r=new r,n(o,r),e.prototype=o=r),o.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),o.constructor=e)}function o(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,oe[e]),this.message=oe[e],Error.captureStackTrace&&Error.captureStackTrace(this,o);return n.code=e,t&&(this.message=this.message+": "+t),n}function i(){}function a(e,t){this._node=e,this._refresh=t,s(this)}function s(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);F(e,"length",r.length),n(r,e),e._inc=t}}function c(){}function u(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function l(e,t,n,r){if(r?t[u(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var o=e.ownerDocument;o&&(r&&v(o,e,r),y(o,e,n))}}function d(e,t,n){var r=u(t,n);if(!(r>=0))throw o(ae,new Error(e.tagName+"@"+n));for(var i=t.length-1;r"==e&&">"||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function g(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(g(e,t))return!0}while(e=e.nextSibling)}function m(){}function y(e,t,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&(t._nsMap[n.prefix?n.localName:""]=n.value)}function v(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function C(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i}}}function x(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,C(e.ownerDocument,e),t}function b(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===te){var o=t.firstChild;if(null==o)return t;var i=t.lastChild}else o=i=t;var a=n?n.previousSibling:e.lastChild;o.previousSibling=a,i.nextSibling=n,a?a.nextSibling=o:e.firstChild=o,null==n?e.lastChild=i:n.previousSibling=i;do{o.parentNode=e}while(o!==i&&(o=o.nextSibling));return C(e.ownerDocument||e,e),t.nodeType==te&&(t.firstChild=t.lastChild=null),t}function k(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t);var r=e.lastChild}var r=e.lastChild;return t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,C(e.ownerDocument,e,t),t}function S(){this._nsMap={}}function T(){}function w(){}function R(){}function A(){}function E(){}function B(){}function N(){}function _(){}function P(){}function D(){}function I(){}function O(){}function M(e,t){var n=[],r=9==this.nodeType?this.documentElement:this,o=r.prefix,i=r.namespaceURI;if(i&&null==o){var o=r.lookupPrefix(i);if(null==o)var a=[{namespace:i,prefix:null}]}return j(this,n,e,t,a),n.join("")}function L(e,t,n){var r=e.prefix||"",o=e.namespaceURI;if(!r&&!o)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===o||"http://www.w3.org/2000/xmlns/"==o)return!1;for(var i=n.length;i--;){var a=n[i];if(a.prefix==r)return a.namespace!=o}return!0}function j(e,t,n,r,o){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case G:o||(o=[]);var i=(o.length,e.attributes),a=i.length,s=e.firstChild,c=e.tagName;n=z===e.namespaceURI||n,t.push("<",c);for(var u=0;u"),n&&/^script$/i.test(c))for(;s;)s.data?t.push(s.data):j(s,t,n,r,o),s=s.nextSibling;else for(;s;)j(s,t,n,r,o),s=s.nextSibling;t.push("")}else t.push("/>");return;case Z:case te:for(var s=e.firstChild;s;)j(s,t,n,r,o),s=s.nextSibling;return;case V:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,h),'"');case X:return t.push(e.data.replace(/[<&]/g,h));case W:return t.push("");case Y:return t.push("\x3c!--",e.data,"--\x3e");case ee:var g=e.publicId,m=e.systemId;if(t.push("');else if(m&&"."!=m)t.push(' SYSTEM "',m,'">');else{var y=e.internalSubset;y&&t.push(" [",y,"]"),t.push(">")}return;case J:return t.push("");case $:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function U(e,t,n){var r;switch(t.nodeType){case G:r=t.cloneNode(!1),r.ownerDocument=e;case te:break;case V:n=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null,n)for(var o=t.firstChild;o;)r.appendChild(U(e,o,n)),o=o.nextSibling;return r}function H(e,t,n){var r=new t.constructor;for(var o in t){var a=t[o];"object"!=typeof a&&a!=r[o]&&(r[o]=a)}switch(t.childNodes&&(r.childNodes=new i),r.ownerDocument=e,r.nodeType){case G:var s=t.attributes,u=r.attributes=new c,l=s.length;u._ownerElement=r;for(var d=0;d0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==V?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==V?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},n(q,p),n(q,p.prototype),m.prototype={nodeName:"#document",nodeType:Z,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==te){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==G&&(this.documentElement=e),b(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),x(this,e)},importNode:function(e,t){return U(this,e,t)},getElementById:function(e){var t=null;return g(this.documentElement,function(n){if(n.nodeType==G&&n.getAttribute("id")==e)return t=n,!0}),t},createElement:function(e){var t=new S;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new i,(t.attributes=new c)._ownerElement=t,t},createDocumentFragment:function(){var e=new D;return e.ownerDocument=this,e.childNodes=new i,e},createTextNode:function(e){var t=new R;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new A;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new E;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new I;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new T;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new P;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new S,r=t.split(":"),o=n.attributes=new c;return n.childNodes=new i,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,o._ownerElement=n,n},createAttributeNS:function(e,t){var n=new T,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},r(m,p),S.prototype={nodeType:G,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===te?this.insertBefore(e,null):k(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new a(this,function(t){var n=[];return g(t,function(r){r===t||r.nodeType!=G||"*"!==e&&r.tagName!=e||n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new a(this,function(n){var r=[];return g(n,function(o){o===n||o.nodeType!==G||"*"!==e&&o.namespaceURI!==e||"*"!==t&&o.localName!=t||r.push(o)}),r})}},m.prototype.getElementsByTagName=S.prototype.getElementsByTagName,m.prototype.getElementsByTagNameNS=S.prototype.getElementsByTagNameNS,r(S,p),T.prototype.nodeType=V,r(T,p),w.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(oe[ie])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},r(w,p),R.prototype={nodeName:"#text",nodeType:X,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},r(R,w),A.prototype={nodeName:"#comment",nodeType:Y},r(A,w),E.prototype={nodeName:"#cdata-section",nodeType:W},r(E,w),B.prototype.nodeType=ee,r(B,p),N.prototype.nodeType=ne,r(N,p),_.prototype.nodeType=Q,r(_,p),P.prototype.nodeType=$,r(P,p),D.prototype.nodeName="#document-fragment",D.prototype.nodeType=te,r(D,p),I.prototype.nodeType=J,r(I,p),O.prototype.serializeToString=function(e,t,n){return M.call(e,t,n)},p.prototype.toString=M;try{Object.defineProperty&&(Object.defineProperty(a.prototype,"length",{get:function(){return s(this),this.$$length}}),Object.defineProperty(p.prototype,"textContent",{get:function(){return K(this)},set:function(e){switch(this.nodeType){case G:case te:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),F=function(e,t,n){e["$$"+t]=n})}catch(e){}t.DOMImplementation=f,t.XMLSerializer=O},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){"task-list-update"===e&&console.warn('warning: Event "'+e+'" has been deprecated. Please use "list-update" instead.'),n(e).push(t)},e.off=function(e,t){for(var r=n(e),o=r.length-1;o>=0;o--)t===r[o]&&r.splice(o,1)},e.emit=function(e,t){for(var r=n(e).map(function(e){return e}),o=0;o>>32-o,n)}function o(e,t,n,o,i,a,s){return r(t&n|~t&o,e,t,i,a,s)}function i(e,t,n,o,i,a,s){return r(t&o|n&~o,e,t,i,a,s)}function a(e,t,n,o,i,a,s){return r(t^n^o,e,t,i,a,s)}function s(e,t,n,o,i,a,s){return r(n^(t|~o),e,t,i,a,s)}function c(e){var t,r=e.length,o=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)n(o,l(e.substring(t-64,t)));e=e.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(o,i),t=0;t<16;t++)i[t]=0;return i[14]=8*r,n(o,i),o}function u(){var e={};return e.state=[1732584193,-271733879,-1732584194,271733878],e.tail="",e.size=0,e.update=function(t,r){r||(t=p(t)),e.size+=t.length,t=e.tail+t;var o,i=e.state;for(o=64;o<=t.length;o+=64)n(i,l(t.substring(o-64,o)));return e.tail=t.substring(o-64),e},e.digest=function(t){var r,o=e.size,i=e.state,a=e.tail,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r>2]|=a.charCodeAt(r)<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(n(i,s),r=0;r<16;r++)s[r]=0;return s[14]=8*o,n(i,s),"hex"===t?f(i):"base64"===t?g(f(i)):i},e}function l(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function d(e){for(var t="",n=0;n<4;n++)t+=m[e>>8*n+4&15]+m[e>>8*n&15];return t}function f(e){for(var t=0;t127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}function h(e,t){return t||(e=p(e)),f(c(e))}var g=function(e){var t,n,r,o="";for(t=0,n=e.length/2;t>16)+(t>>16)+(n>>16)<<16|65535&n}),h.getCtx=u,e.exports=h},function(e,t,n){var r=r||function(e,t){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var o=0;o>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},u=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0);if(t=s*i,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}l=(r<<5|r>>>27)+c+i[u],l=20>u?l+(1518500249+(o&a|~o&s)):40>u?l+(1859775393+(o^a^s)):60>u?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),c=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=o._createHelper(t),e.HmacSHA1=o._createHmacHelper(t)}(),function(){var e=r,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,o=4*r;n.sigBytes>o&&(n=e.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,c=a.words,u=0;u>>2]>>>24-i%4*8&255,s=t[i+1>>>2]>>>24-(i+1)%4*8&255,c=t[i+2>>>2]>>>24-(i+2)%4*8&255,u=a<<16|s<<8|c,l=0;l<4&&i+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=r.charAt(64);if(o){var i=e.indexOf(o);-1!=i&&(t=i)}for(var a=[],s=0,c=0;c>>6-c%4*2;a[s>>>2]|=(u|l)<<24-s%4*8,s++}return n.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.exports=r},function(e,t,n){var r=n(8).DOMParser,o=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/);new RegExp(/^\s+|\s+$/g);return this.grokType=function(e){return/^\s*$/.test(e)?null:/^(?:true|false)$/i.test(e)?"true"===e.toLowerCase():isFinite(e)?parseFloat(e):e},this.parseString=function(e,t){if(e){var n=this.stringToXML(e);return n.getElementsByTagName("parsererror").length?null:this.parseXML(n,t)}return null},this.parseXML=function(n,r){for(var i in r)e[i]=r[i];var a={},s=0,c="";if(n.childNodes.length)for(var u,l,d,f=0;f=t+n||t?new java.lang.String(e,t,n)+"":e}function u(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new l,a=n.domBuilder||new i,s=n.errorHandler,c=n.locator,u=n.xmlns||{},d={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return c&&a.setDocumentLocator(c),r.errorHandler=o(s,a,c),r.domBuilder=n.domBuilder||a,/\/x?html?$/.test(t)&&(d.nbsp="\xa0",d.copy="\xa9",u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,u,d):r.errorHandler.error("invalid doc source"),a.doc},i.prototype={startDocument:function(){this.doc=(new d).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var o=this.doc,i=o.createElementNS(e,n||t),s=r.length;u(this,i),this.currentElement=i,this.locator&&a(this.locator,i);for(var c=0;c65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function h(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?p(parseInt(t.substr(1).replace("x","0x"))):(u.error("entity not found:"+e),e)}function g(t){if(t>S){var n=e.substring(S,t).replace(/&#?\w+;/g,h);x&&m(S),r.characters(n,0,t-S),S=t}}function m(t,n){for(;t>=v&&(n=C.exec(e));)y=n.index,v=y+n[0].length,x.lineNumber++;x.columnNumber=t-y+1}for(var y=0,v=0,C=/.*(?:\r\n?|\n)|.*$/g,x=r.locator,b=[{currentNSMap:t}],k={},S=0;;){try{var T=e.indexOf("<",S);if(T<0){if(!e.substr(S).match(/^\s*$/)){var w=r.doc,R=w.createTextNode(e.substr(S));w.appendChild(R),r.currentElement=R}return}switch(T>S&&g(T),e.charAt(T+1)){case"/":var A=e.indexOf(">",T+3),E=e.substring(T+2,A),B=b.pop();A<0?(E=e.substring(T+2).replace(/[\s<].*/,""),u.error("end tag name: "+E+" is not complete:"+B.tagName),A=T+1+E.length):E.match(/\sS?S=A:g(Math.max(T,S)+1)}}function o(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function i(e,t,n,r,o,i){for(var a,s,c=++t,u=v;;){var l=e.charAt(c);switch(l){case"=":if(u===C)a=e.slice(t,c),u=b;else{if(u!==x)throw new Error("attribute equal must after attrName");u=b}break;case"'":case'"':if(u===b||u===C){if(u===C&&(i.warning('attribute value must after "="'),a=e.slice(t,c)),t=c+1,!((c=e.indexOf(l,t))>0))throw new Error("attribute value no end '"+l+"' match");s=e.slice(t,c).replace(/&#?\w+;/g,o),n.add(a,s,t-1),u=S}else{if(u!=k)throw new Error('attribute value must after "="');s=e.slice(t,c).replace(/&#?\w+;/g,o),n.add(a,s,t),i.warning('attribute "'+a+'" missed start quot('+l+")!!"),t=c+1,u=S}break;case"/":switch(u){case v:n.setTagName(e.slice(t,c));case S:case T:case w:u=w,n.closed=!0;case k:case C:case x:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),u==v&&n.setTagName(e.slice(t,c)),c;case">":switch(u){case v:n.setTagName(e.slice(t,c));case S:case T:case w:break;case k:case C:s=e.slice(t,c),"/"===s.slice(-1)&&(n.closed=!0,s=s.slice(0,-1));case x:u===x&&(s=a),u==k?(i.warning('attribute "'+s+'" missed quot(")!!'),n.add(a,s.replace(/&#?\w+;/g,o),t)):("http://www.w3.org/1999/xhtml"===r[""]&&s.match(/^(?:disabled|checked|selected)$/i)||i.warning('attribute "'+s+'" missed value!! "'+s+'" instead!!'),n.add(s,s,t));break;case b:throw new Error("attribute value missed!!")}return c;case"\x80":l=" ";default:if(l<=" ")switch(u){case v:n.setTagName(e.slice(t,c)),u=T;break;case C:a=e.slice(t,c),u=x;break;case k:var s=e.slice(t,c).replace(/&#?\w+;/g,o);i.warning('attribute "'+s+'" missed quot(")!!'),n.add(a,s,t);case S:u=T}else switch(u){case x:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&a.match(/^(?:disabled|checked|selected)$/i)||i.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),n.add(a,a,t),t=c,u=C;break;case S:i.warning('attribute space is required"'+a+'"!!');case T:u=C,t=c;break;case b:u=k,t=c;break;case w:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function a(e,t,n){for(var r=e.tagName,o=null,i=e.length;i--;){var a=e[i],s=a.qName,c=a.value,l=s.indexOf(":");if(l>0)var d=a.prefix=s.slice(0,l),f=s.slice(l+1),p="xmlns"===d&&f;else f=s,d=null,p="xmlns"===s&&"";a.localName=f,!1!==p&&(null==o&&(o={},u(n,n={})),n[p]=o[p]=c,a.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(p,c))}for(var i=e.length;i--;){a=e[i];var d=a.prefix;d&&("xml"===d&&(a.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==d&&(a.uri=n[d||""]))}var l=r.indexOf(":");l>0?(d=e.prefix=r.slice(0,l),f=e.localName=r.slice(l+1)):(d=null,f=e.localName=r);var h=e.uri=n[d||""];if(t.startElement(h,f,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=o,!0;if(t.endElement(h,f,r),o)for(d in o)t.endPrefixMapping(d)}function s(e,t,n,r,o){if(/^(?:script|textarea)$/i.test(n)){var i=e.indexOf("",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(n)?(o.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),o.characters(a,0,a.length),i)}return t+1}function c(e,t,n,r){var o=r[n];return null==o&&(o=e.lastIndexOf(""),ot?(n.comment(e,t+4,o-t-4),o+3):(r.error("Unclosed comment"),-1)}return-1;default:if("CDATA["==e.substr(t+3,6)){var o=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var i=h(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var s=i[1][0],c=a>3&&/^public$/i.test(i[2][0])&&i[3][0],u=a>4&&i[4][0],l=i[a-1];return n.startDTD(s,c&&c.replace(/^(['"])(.*?)\1$/,"$2"),u&&u.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),l.index+l[0].length}}return-1}function d(e,t,n){var r=e.indexOf("?>",t);if(r){var o=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),r+2}return-1}return-1}function f(e){}function p(e,t){return e.__proto__=t,e}function h(e,t){var n,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=t,o.exec(e);n=o.exec(e);)if(r.push(n),n[1])return r}var g=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=new RegExp("[\\-\\.0-9"+g.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),y=new RegExp("^"+g.source+m.source+"*(?::"+g.source+m.source+"*)?$"),v=0,C=1,x=2,b=3,k=4,S=5,T=6,w=7;n.prototype={parse:function(e,t,n){var o=this.domBuilder;o.startDocument(),u(t,t={}),r(e,t,n,o,this.errorHandler),o.endDocument()}},f.prototype={setTagName:function(e){if(!y.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!y.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},p({},p.prototype)instanceof p||(p=function(e,t){function n(){}n.prototype=t,n=new n;for(t in e)n[t]=e[t];return n}),t.XMLReader=n},function(e,t){function n(e){return(""+e).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(o,"")}var r=new RegExp("^([^a-zA-Z_\xc0-\xd6\xd8-\xf6\xf8-\xff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fff\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd])|^((x|X)(m|M)(l|L))|([^a-zA-Z_\xc0-\xd6\xd8-\xf6\xf8-\xff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fff\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd-.0-9\xb7\u0300-\u036f\u203f\u2040])","g"),o=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,i=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},a=function(e,t){var o=function(e,n,o,i,a){var s=void 0!==t.indent?t.indent:"\t",c=t.prettyPrint?"\n"+new Array(i).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(r,"_"));var u=[c,"<",e,o||""];return n&&n.length>0?(u.push(">"),u.push(n),a&&u.push(c),u.push("")):u.push("/>"),u.join("")};return function e(r,a,s){var c=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?c="array":r instanceof Date&&(c="date"),c){case"array":var u=[];return r.map(function(t){u.push(e(t,1,s+1))}),t.prettyPrint&&u.push("\n"),u.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":var l=[];for(var d in r)if(r.hasOwnProperty(d))if(r[d]instanceof Array)for(var f=0;f0&&l.push("\n"),l.join("");case"function":return r();default:return t.escape?n(r):""+r}}(e,0,0)},s=function(e){var t=['"),t.join("")};e.exports=function(e,t){if(t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),"string"==typeof e)try{e=JSON.parse(e.toString())}catch(e){return!1}var n="",r="";return t&&("object"==typeof t?(t.xmlHeader&&(n=s(!!t.xmlHeader.standalone)),void 0!==t.docType&&(r="")):n=s()),t=t||{},[n,t.prettyPrint&&r?"\n":"",r,a(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t,n){var r=n(0),o={},i=function(e,t){o[t]=e[t],e[t]=function(e,n){e.SkipTask?o[t].call(this,e,n):this._addTask(t,e,n)}},a=function(e){var t=[],n={},i=0,a=0,s=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),e._custom&&(t._custom=e._custom),t},c=function(){var n,o=function(){n=0,e.emit("task-list-update",{list:r.map(t,s)}),e.emit("list-update",{list:r.map(t,s)})};return function(){n||(n=setTimeout(o))}}(),u=function(){if(!(t.length<=e.options.UploadQueueSize)){for(var r=0;re.options.UploadQueueSize;){var o="waiting"===t[r].state||"checking"===t[r].state||"uploading"===t[r].state;t[r]&&o?r++:(n[t[r].id]&&delete n[t[r].id],t.splice(r,1),a--)}c()}},l=function(){if(a/gi,"<$1Rule>"),r=r.replace(/<(\/?)Tags>/gi,"<$1Tag>");var o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=te.binaryBase64(te.md5(r)),J.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"replication",headers:o},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function T(e,t){J.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var r={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)})}function w(e,t){J.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function R(e,t){J.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0,statusCode:o}):t(n)}r.headers&&r.headers.etag&&(r.ETag=r.headers&&r.headers.etag),t(null,r)})}function A(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,J.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions"},function(e,n){if(e)return t(e);var r=n.ListVersionsResult||{},o=r.DeleteMarker||[];o=te.isArray(o)?o:[o];var i=r.Version||[];i=te.isArray(i)?i:[i];var a=te.clone(r);delete a.DeleteMarker,delete a.Version,te.extend(a,{DeleteMarkers:o,Versions:i,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function E(e,t){var n={};n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,J.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,rawBody:!0},function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0}):t(n)}var i={};i.Body=r.body,r.headers&&r.headers.etag&&(i.ETag=r.headers&&r.headers.etag),te.extend(i,{statusCode:r.statusCode,headers:r.headers}),t(null,i)})}function B(e,t){var n=this,r=e.ContentLength,o=te.throttleOnProgress.call(n,r,e.onProgress),i=e.Headers;!i["Cache-Control"]&&(i["Cache-Control"]="");var a=i["Content-Type"]||e.Body&&e.Body.type;!i["Content-Type"]&&a&&(i["Content-Type"]=a);var s=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5;te.getBodyMd5(s,e.Body,function(i){i&&(n.options.UploadCheckContentMd5&&(e.Headers["Content-MD5"]=te.binaryBase64(i)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(e.Headers["x-cos-meta-md5"]=i)),void 0!==e.ContentLength&&(e.Headers["Content-Length"]=e.ContentLength),o(null,!0),J.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,body:e.Body,onProgress:o},function(i,a){if(i)return o(null,!0),t(i);if(o({loaded:r,total:r},!0),a){var s=W({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key});s=s.substr(s.indexOf("://")+3);var c={Location:s,statusCode:a.statusCode,headers:a.headers};return a.headers&&a.headers.etag&&(c.ETag=a.headers.etag),t(null,c)}t(null,a)})},e.onHashProgress)}function N(e,t){J.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId},function(e,n){if(e){var r=e.statusCode;return r&&204===r?t(null,{statusCode:r}):r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})})}function _(e,t){J.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"acl"},function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},o=r.Owner||{},i=r.AccessControlList&&r.AccessControlList.Grant||[];i=te.isArray(i)?i:[i];var a=V(r);n.headers&&n.headers["x-cos-acl"]&&(a.ACL=n.headers["x-cos-acl"]),a=te.extend(a,{Owner:o,Grants:i,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function P(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var o=te.clone(e.AccessControlPolicy||{}),i=o.Grants||o.Grant;i=te.isArray(i)?i:[i],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:i},r=te.json2xml({AccessControlPolicy:o}),n["Content-Type"]="application/xml",n["Content-MD5"]=te.binaryBase64(te.md5(r))}te.each(n,function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=X(n[t]))}),J.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:r},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})}function D(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,J.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n},function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var r=n.headers||{};t(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})})}function I(e,t){var n=e.Headers;!n["Cache-Control"]&&(n["Cache-Control"]="");var r=e.CopySource||"",o=r.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!o)return void t({error:"CopySource format error"});var i=o[1],a=o[3],s=decodeURIComponent(o[4]);J.call(this,{Scope:[{action:"name/cos:GetObject",bucket:i,region:a,prefix:s},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(e,n){if(e)return t(e);var r=te.clone(n.CopyObjectResult||{});te.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function O(e,t){var n=e.CopySource||"",r=n.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!r)return void t({error:"CopySource format error"});var o=r[1],i=r[3],a=decodeURIComponent(r[4]);J.call(this,{Scope:[{action:"name/cos:GetObject",bucket:o,region:i,prefix:a},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers},function(e,n){if(e)return t(e);var r=te.clone(n.CopyPartResult||{});te.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function M(e,t){var n=e.Objects||[],r=e.Quiet;n=te.isArray(n)?n:[n];var o=te.json2xml({Delete:{Object:n,Quiet:r||!1}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=te.binaryBase64(te.md5(o));var a=te.map(n,function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}});J.call(this,{Scope:a,method:"POST",Bucket:e.Bucket,Region:e.Region,body:o,action:"delete",headers:i},function(e,n){if(e)return t(e);var r=n.DeleteResult||{},o=r.Deleted||[],i=r.Error||[];o=te.isArray(o)?o:[o],i=te.isArray(i)?i:[i];var a=te.clone(r);te.extend(a,{Error:i,Deleted:o,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function L(e,t){var n=e.Headers;if(!e.RestoreRequest)return void t({error:"missing param RestoreRequest"});var r=e.RestoreRequest||{},o=te.json2xml({RestoreRequest:r});n["Content-Type"]="application/xml",n["Content-MD5"]=te.binaryBase64(te.md5(o)),J.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:o,action:"restore",headers:n},function(e,n){t(e,n)})}function j(e,t){var n=this,r=e.Headers;!r["Cache-Control"]&&(r["Cache-Control"]=""),te.getBodyMd5(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5,e.Body,function(r){r&&(e.Headers["x-cos-meta-md5"]=r),J.call(n,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers},function(e,n){return e?t(e):(n=te.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,te.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)})},e.onHashProgress)}function U(e,t){var n=this;te.getFileSize("multipartUpload",e,function(){te.getBodyMd5(n.options.UploadCheckContentMd5,e.Body,function(r){r&&(e.Headers["Content-MD5"]=te.binaryBase64(r)),J.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null},function(e,n){if(e)return t(e);n.headers=n.headers||{},t(null,{ETag:n.headers.etag||"",statusCode:n.statusCode,headers:n.headers})})})})}function H(e,t){for(var n=this,r=e.UploadId,o=e.Parts,i=0,a=o.length;i-1?n.Authorization:"sign="+encodeURIComponent(n.Authorization)),n.XCosSecurityToken&&(o+="&x-cos-security-token="+n.XCosSecurityToken),n.ClientIP&&(o+="&clientIP="+n.ClientIP),n.ClientUA&&(o+="&clientUA="+n.ClientUA),n.Token&&(o+="&token="+n.Token),setTimeout(function(){t(null,{Url:o})})}});return o?r+"?"+o.Authorization+(o.XCosSecurityToken?"&x-cos-security-token="+o.XCosSecurityToken:""):r}function V(e){var t={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},n={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},r=e.AccessControlList.Grant;r&&(r=te.isArray(r)?r:[r]);var o={READ:0,WRITE:0,FULL_CONTROL:0};return r.length&&te.each(r,function(r){"qcs::cam::anyone:anyone"===r.Grantee.ID||"http://cam.qcloud.com/groups/global/AllUsers"===r.Grantee.URI?o[r.Permission]=1:r.Grantee.ID!==e.Owner.ID&&t[n[r.Permission]].push('id="'+r.Grantee.ID+'"')}),o.FULL_CONTROL||o.WRITE&&o.READ?t.ACL="public-read-write":o.READ?t.ACL="public-read":t.ACL="private",te.each(n,function(e){t[e]=X(t[e].join(","))}),t}function X(e){var t,n,r=e.split(","),o={};for(t=0;t-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(o="{Bucket}."+o)),o=o.replace(/\{\{AppId\}\}/gi,r).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,i).replace(/\{\{.*?\}\}/gi,""),o=o.replace(/\{AppId\}/gi,r).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,i).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(o)||(o=s+"//"+o),"/"===o.slice(-1)&&(o=o.slice(0,-1));var c=o;return e.ForcePathStyle&&(c+="/"+t),c+="/",a&&(c+=te.camSafeUrlEncode(a).replace(/%2F/g,"/")),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}function $(e,t){var n=te.clone(e.Headers);delete n["Content-Type"],delete n["Cache-Control"],te.each(n,function(e,t){""===e&&delete n[t]});var r=function(e){var n=!1,r=e.Authorization;if(r)if(r.indexOf(" ")>-1)n=!1;else if(r.indexOf("q-sign-algorithm=")>-1&&r.indexOf("q-ak=")>-1&&r.indexOf("q-sign-time=")>-1&&r.indexOf("q-key-time=")>-1&&r.indexOf("q-url-param-list=")>-1)n=!0;else try{r=atob(r),r.indexOf("a=")>-1&&r.indexOf("k=")>-1&&r.indexOf("t=")>-1&&r.indexOf("r=")>-1&&r.indexOf("b=")>-1&&(n=!0)}catch(e){}n?t&&t(null,e):t&&t("authorization error")},o=this,i=e.Bucket||"",a=e.Region||"",s=e.Key||"";o.options.ForcePathStyle&&i&&(s=i+"/"+s);var c="/"+s,u={},l=e.Scope;if(!l){var d=e.Action||"",f=e.ResourceKey||e.Key||"";l=e.Scope||[{action:d,bucket:i,region:a,prefix:f}]}var p=te.md5(JSON.stringify(l));o._StsCache=o._StsCache||[],function(){var e,t;for(e=o._StsCache.length-1;e>=0;e--){t=o._StsCache[e];var n=Math.round(te.getSkewTime(o.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)o._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===p){u=t;break}}}();var h=function(){var t=te.getAuth({SecretId:u.TmpSecretId,SecretKey:u.TmpSecretKey,Method:e.Method,Pathname:c,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:o.options.UseRawKey,SystemClockOffset:o.options.SystemClockOffset}),i={Authorization:t,XCosSecurityToken:u.XCosSecurityToken||"",Token:u.Token||"",ClientIP:u.ClientIP||"",ClientUA:u.ClientUA||""};r(i)};if(u.ExpiredTime&&u.ExpiredTime-te.getSkewTime(o.options.SystemClockOffset)/1e3>60)h();else if(o.options.getAuthorization)o.options.getAuthorization.call(o,{Bucket:i,Region:a,Method:e.Method,Key:s,Pathname:c,Query:e.Query,Headers:n,Scope:l},function(e){"string"==typeof e&&(e={Authorization:e}),e.TmpSecretId&&e.TmpSecretKey&&e.XCosSecurityToken&&e.ExpiredTime?(u=e||{},u.Scope=l,u.ScopeKey=p,o._StsCache.push(u),h()):r(e)});else{if(!o.options.getSTS)return function(){var t=te.getAuth({SecretId:e.SecretId||o.options.SecretId,SecretKey:e.SecretKey||o.options.SecretKey,Method:e.Method,Pathname:c,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:o.options.UseRawKey,SystemClockOffset:o.options.SystemClockOffset}),i={Authorization:t,XCosSecurityToken:o.options.XCosSecurityToken};return r(i),i}();o.options.getSTS.call(o,{Bucket:i,Region:a},function(e){u=e||{},u.Scope=l,u.ScopeKey=p,u.TmpSecretId=u.SecretId,u.TmpSecretKey=u.SecretKey,o._StsCache.push(u),h()})}return""}function Q(e){var t=!1,n=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var o=e.error.Code,i=e.error.Message;("RequestTimeTooSkewed"===o||"AccessDenied"===o&&"Request has expired"===i)&&(n=!0)}catch(e){}if(e)if(n&&r){var a=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(te.getSkewTime(this.options.SystemClockOffset)-a)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=a-Date.now(),t=!0)}else 5===Math.round(e.statusCode/100)&&(t=!0);return t}function J(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=te.clearKey(e.qs),e.headers&&(e.headers=te.clearKey(e.headers)),e.qs&&(e.qs=te.clearKey(e.qs));var r=te.clone(e.qs);e.action&&(r[e.action]="");var o=function(i){var a=n.options.SystemClockOffset;$.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:r,Headers:e.headers,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope},function(r,s){if(r)return void t(r);e.AuthData=s,Y.call(n,e,function(r,s){r&&i<2&&(a!==n.options.SystemClockOffset||Q.call(n,r))?(e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,delete e.headers["x-cos-security-token"]),o(i+1)):t(r,s)})})};o(1)}function Y(e,t){var n=this,r=e.TaskId;if(!r||n._isRunningTask(r)){var o=e.Bucket,i=e.Region,a=e.Key,s=e.method||"GET",c=e.url,u=e.body,l=e.json,d=e.rawBody;c=c||W({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:o,region:i,object:a}),e.action&&(c=c+"?"+e.action);var f={method:s,url:c,headers:e.headers,qs:e.qs,body:u,json:l};if(f.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(f.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(f.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(f.headers.clientUA=e.AuthData.ClientUA),e.AuthData.XCosSecurityToken&&(f.headers["x-cos-security-token"]=e.AuthData.XCosSecurityToken),f.headers&&(f.headers=te.clearKey(f.headers)),f=te.clearKey(f),e.onProgress&&"function"==typeof e.onProgress){var p=u&&(u.size||u.length)||0;f.onProgress=function(t){if(!r||n._isRunningTask(r)){var o=t?t.loaded:0;e.onProgress({loaded:o,total:p})}}}this.options.Timeout&&(f.timeout=this.options.Timeout),n.emit("before-send",f);var h=ee(f,function(e,o,i){if("abort"!==e){var a,s=function(e,i){if(r&&n.off("inner-kill-task",g),!a){a=!0;var s={};o&&o.statusCode&&(s.statusCode=o.statusCode),o&&o.headers&&(s.headers=o.headers),e?(e=te.extend(e||{},s),t(e,null)):(i=te.extend(i||{},s),t(null,i)),h=null}};if(e)return void s({error:e});var c;if(d)c={},c.body=i;else try{c=i&&i.indexOf("<")>-1&&i.indexOf(">")>-1&&te.xml2json(i)||{}}catch(e){c=i||{}}var u=o.statusCode;return 2===Math.floor(u/100)?c.Error?void s({error:c.Error}):void s(null,c):void s({error:c.Error||c})}}),g=function(e){e.TaskId===r&&(h&&h.abort&&h.abort(),n.off("inner-kill-task",g))};r&&n.on("inner-kill-task",g)}}function Z(e,t,n){te.each(["Cors","Acl"],function(r){if(e.slice(-r.length)===r){var o=e.slice(0,-r.length)+r.toUpperCase(),i=te.apiWrapper(e,t),a=!1;n[o]=function(){!a&&console.warn("warning: cos."+o+" has been deprecated. Please Use cos."+e+" instead."),a=!0,i.apply(this,arguments)}}})}var ee=n(13),te=n(0),ne={getBucket:o,headBucket:r,deleteBucket:i,getBucketAcl:a,putBucketAcl:s,getBucketCors:c,putBucketCors:u,deleteBucketCors:l,getBucketLocation:p,putBucketTagging:m,getBucketTagging:g,deleteBucketTagging:y,getBucketPolicy:h,putBucketPolicy:d,deleteBucketPolicy:f,getBucketLifecycle:C,putBucketLifecycle:v,deleteBucketLifecycle:x,putBucketVersioning:b,getBucketVersioning:k,putBucketReplication:S,getBucketReplication:T,deleteBucketReplication:w,getObject:E,headObject:R,listObjectVersions:A,putObject:B,deleteObject:N,getObjectAcl:_,putObjectAcl:P,optionsObject:D,putObjectCopy:I,deleteMultipleObject:M,restoreObject:L,uploadPartCopy:O,multipartInit:j,multipartUpload:U,multipartComplete:H,multipartList:F,multipartListPart:K,multipartAbort:z,getObjectUrl:G,getAuth:q};e.exports.init=function(e,t){t.transferToTaskMethod(ne,"putObject"),te.each(ne,function(t,n){e.prototype[n]=te.apiWrapper(n,t),Z(n,t,e.prototype)})}},function(e,t,n){var r=n(14),o=function(){function e(e){var t=e.length,n=E.type(e);return"function"!==n&&!E.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e))}function t(e){var t=L[e]={};return E.each(e.match(M)||[],function(e,n){t[n]=!0}),t}function n(){I.addEventListener?(I.removeEventListener("DOMContentLoaded",r,!1),window.removeEventListener("load",r,!1)):(I.detachEvent("onreadystatechange",r),window.detachEvent("onload",r))}function r(){(I.addEventListener||"load"===event.type||"complete"===I.readyState)&&(n(),E.ready())}function o(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(F,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:H.test(n)?E.parseJSON(n):n)}catch(e){}E.data(e,t,n)}else n=void 0}return n}function i(e){var t;for(t in e)if(("data"!==t||!E.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function a(e,t,n,r){if(E.acceptData(e)){var o,i,a=E.expando,s=e.nodeType,c=s?E.cache:e,u=s?e[a]:e[a]&&a;if(u&&c[u]&&(r||c[u].data)||void 0!==n||"string"!=typeof t)return u||(u=s?e[a]=v.pop()||E.guid++:a),c[u]||(c[u]=s?{}:{toJSON:E.noop}),"object"!=typeof t&&"function"!=typeof t||(r?c[u]=E.extend(c[u],t):c[u].data=E.extend(c[u].data,t)),i=c[u],r||(i.data||(i.data={}),i=i.data),void 0!==n&&(i[E.camelCase(t)]=n),"string"==typeof t?null==(o=i[t])&&(o=i[E.camelCase(t)]):o=i,o}}function s(e,t,n){if(E.acceptData(e)){var r,o,a=e.nodeType,s=a?E.cache:e,c=a?e[E.expando]:E.expando;if(s[c]){if(t&&(r=n?s[c]:s[c].data)){E.isArray(t)?t=t.concat(E.map(t,E.camelCase)):t in r?t=[t]:(t=E.camelCase(t),t=t in r?[t]:t.split(" ")),o=t.length;for(;o--;)delete r[t[o]];if(n?!i(r):!E.isEmptyObject(r))return}(n||(delete s[c].data,i(s[c])))&&(a?E.cleanData([e],!0):R.deleteExpando||s!=s.window?delete s[c]:s[c]=null)}}}function c(){return!0}function u(){return!1}function l(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(M)||[];if(E.isFunction(n))for(;r=i[o++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function d(e,t,n,r){function o(s){var c;return i[s]=!0,E.each(e[s]||[],function(e,s){var u=s(t,n,r);return"string"!=typeof u||a||i[u]?a?!(c=u):void 0:(t.dataTypes.unshift(u),o(u),!1)}),c}var i={},a=e===ae;return o(t.dataTypes[0])||!i["*"]&&o("*")}function f(e,t){var n,r,o=E.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((o[r]?e:n||(n={}))[r]=t[r]);return n&&E.extend(!0,e,n),e}function p(e,t,n){for(var r,o,i,a,s=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),void 0===o&&(o=e.mimeType||t.getResponseHeader("Content-Type"));if(o)for(a in s)if(s[a]&&s[a].test(o)){c.unshift(a);break}if(c[0]in n)i=c[0];else{for(a in n){if(!c[0]||e.converters[a+" "+c[0]]){i=a;break}r||(r=a)}i=i||r}if(i)return i!==c[0]&&c.unshift(i),n[i]}function h(e,t,n,r){var o,i,a,s,c,u={},l=e.dataTypes.slice();if(l[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];for(i=l.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!c&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=i,i=l.shift())if("*"===i)i=c;else if("*"!==c&&c!==i){if(!(a=u[c+" "+i]||u["* "+i]))for(o in u)if(s=o.split(" "),s[1]===i&&(a=u[c+" "+s[0]]||u["* "+s[0]])){!0===a?a=u[o]:!0!==u[o]&&(i=s[0],l.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+c+" to "+i}}}return{state:"success",data:t}}function g(e,t,n,r){var o;if(E.isArray(t))E.each(t,function(t,o){n||ue.test(e)?r(e,o):g(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==E.type(t))r(e,t);else for(o in t)g(e+"["+o+"]",t[o],n,r)}function m(){try{return new window.XMLHttpRequest}catch(e){}}function y(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}var v=[],C=v.slice,x=v.concat,b=v.push,k=v.indexOf,S={},T=S.toString,w=S.hasOwnProperty,R={},A="1.11.1 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset,-deprecated,-event-alias,-wrap",E=function(e,t){return new E.fn.init(e,t)},B=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^-ms-/,_=/-([\da-z])/gi,P=function(e,t){return t.toUpperCase()};E.fn=E.prototype={jquery:A,constructor:E,selector:"",length:0,toArray:function(){return C.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:C.call(this)},pushStack:function(e){var t=E.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return E.each(this,e,t)},map:function(e){return this.pushStack(E.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(C.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==E.type(e)||e.nodeType||E.isWindow(e))return!1;try{if(e.constructor&&!w.call(e,"constructor")&&!w.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(R.ownLast)for(t in e)return w.call(e,t);for(t in e);return void 0===t||w.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?S[T.call(e)]||"object":typeof e},globalEval:function(e){e&&E.trim(e)&&(window.execScript||function(e){window.eval.call(window,e)})(e)},camelCase:function(e){return e.replace(N,"ms-").replace(_,P)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(t,n,r){var o=0,i=t.length,a=e(t);if(r){if(a)for(;o)[^>]*|#([\w-]*))$/;(E.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:O.exec(e))||!n[1]&&t)return!t||t.jquery?(t||D).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof E?t[0]:t,E.merge(this,E.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:I,!0)),rsingleTag.test(n[1])&&E.isPlainObject(t))for(n in t)E.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((r=I.getElementById(n[2]))&&r.parentNode){if(r.id!==n[2])return D.find(e);this.length=1,this[0]=r}return this.context=I,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):E.isFunction(e)?void 0!==D.ready?D.ready(e):e(E):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),E.makeArray(e,this))}).prototype=E.fn,D=E(I);var M=/\S+/g,L={};E.Callbacks=function(e){e="string"==typeof e?L[e]||t(e):E.extend({},e);var n,r,o,i,a,s,c=[],u=!e.once&&[],l=function(t){for(r=e.memory&&t,o=!0,a=s||0,s=0,i=c.length,n=!0;c&&a-1;)c.splice(r,1),n&&(r<=i&&i--,r<=a&&a--)}),this},has:function(e){return e?E.inArray(e,c)>-1:!(!c||!c.length)},empty:function(){return c=[],i=0,this},disable:function(){return c=u=r=void 0,this},disabled:function(){return!c},lock:function(){return u=void 0,r||d.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!c||o&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):l(t)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!o}};return d},E.extend({Deferred:function(e){var t=[["resolve","done",E.Callbacks("once memory"),"resolved"],["reject","fail",E.Callbacks("once memory"),"rejected"],["notify","progress",E.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return E.Deferred(function(n){E.each(t,function(t,i){var a=E.isFunction(e[t])&&e[t];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&E.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?E.extend(e,r):r}},o={};return r.pipe=r.then,E.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=C.call(arguments),a=i.length,s=1!==a||e&&E.isFunction(e.promise)?a:0,c=1===s?e:E.Deferred(),u=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?C.call(arguments):o,r===t?c.notifyWith(n,r):--s||c.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);o0||(j.resolveWith(I,[E]),E.fn.triggerHandler&&(E(I).triggerHandler("ready"),E(I).off("ready")))}}}),E.ready.promise=function(e){if(!j)if(j=E.Deferred(),"complete"===I.readyState)setTimeout(E.ready);else if(I.addEventListener)I.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1);else{I.attachEvent("onreadystatechange",r),window.attachEvent("onload",r);var t=!1;try{t=null==window.frameElement&&I.documentElement}catch(e){}t&&t.doScroll&&function e(){if(!E.isReady){try{t.doScroll("left")}catch(t){return setTimeout(e,50)}n(),E.ready()}}()}return j.promise(e)};var U;for(U in E(R))break;R.ownLast="0"!==U,R.inlineBlockNeedsLayout=!1,E(function(){var e,t,n,r;(n=I.getElementsByTagName("body")[0])&&n.style&&(t=I.createElement("div"),r=I.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),void 0!==t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",R.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=I.createElement("div");if(null==R.deleteExpando){R.deleteExpando=!0;try{delete e.test}catch(e){R.deleteExpando=!1}}e=null}(),E.acceptData=function(e){var t=E.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||!0!==t&&e.getAttribute("classid")===t)};var H=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,F=/([A-Z])/g;E.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return!!(e=e.nodeType?E.cache[e[E.expando]]:e[E.expando])&&!i(e)},data:function(e,t,n){return a(e,t,n)},removeData:function(e,t){return s(e,t)},_data:function(e,t,n){return a(e,t,n,!0)},_removeData:function(e,t){return s(e,t,!0)}}),E.fn.extend({data:function(e,t){var n,r,i,a=this[0],s=a&&a.attributes;if(void 0===e){if(this.length&&(i=E.data(a),1===a.nodeType&&!E._data(a,"parsedAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=E.camelCase(r.slice(5)),o(a,r,i[r])));E._data(a,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){E.data(this,e)}):arguments.length>1?this.each(function(){E.data(this,e,t)}):a?o(a,e,E.data(a,e)):void 0},removeData:function(e){return this.each(function(){E.removeData(this,e)})}}),E.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=E._data(e,t),n&&(!r||E.isArray(n)?r=E._data(e,t,E.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=E.queue(e,t),r=n.length,o=n.shift(),i=E._queueHooks(e,t),a=function(){E.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return E._data(e,n)||E._data(e,n,{empty:E.Callbacks("once memory").add(function(){E._removeData(e,t+"queue"),E._removeData(e,n)})})}}),E.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length=0&&(p=f.split("."),f=p.shift(),p.sort()),i=f.indexOf(":")<0&&"on"+f,e=e[E.expando]?e:new E.Event(f,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:E.makeArray(t,[e]),c=E.event.special[f]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!E.isWindow(n)){for(s=c.delegateType||f,G.test(s+f)||(a=a.parentNode);a;a=a.parentNode)d.push(a),u=a;u===(n.ownerDocument||I)&&d.push(u.defaultView||u.parentWindow||window)}for(l=0;(a=d[l++])&&!e.isPropagationStopped();)e.type=l>1?s:c.bindType||f,o=(E._data(a,"events")||{})[e.type]&&E._data(a,"handle"),o&&o.apply(a,t),(o=i&&a[i])&&o.apply&&E.acceptData(a)&&(e.result=o.apply(a,t),!1===e.result&&e.preventDefault());if(e.type=f,!r&&!e.isDefaultPrevented()&&(!c._default||!1===c._default.apply(d.pop(),t))&&E.acceptData(n)&&i&&n[f]&&!E.isWindow(n)){u=n[i],u&&(n[i]=null),E.event.triggered=f;try{n[f]()}catch(e){}E.event.triggered=void 0,u&&(n[i]=u)}return e.result}},dispatch:function(e){e=E.event.fix(e);var t,n,r,o,i,a=[],s=C.call(arguments),c=(E._data(this,"events")||{})[e.type]||[],u=E.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!u.preDispatch||!1!==u.preDispatch.call(this,e)){for(a=E.event.handlers.call(this,e,c),t=0;(o=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,i=0;(r=o.handlers[i++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(r.namespace)||(e.handleObj=r,e.data=r.data,void 0!==(n=((E.event.special[r.origType]||{}).handle||r.handler).apply(o.elem,s))&&!1===(e.result=n)&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,o,i,a=[],s=t.delegateCount,c=e.target;if(s&&c.nodeType&&(!e.button||"click"!==e.type))for(;c!=this;c=c.parentNode||this)if(1===c.nodeType&&(!0!==c.disabled||"click"!==e.type)){for(o=[],i=0;i=0:E.find(n,this,null,[c]).length),o[n]&&o.push(r);o.length&&a.push({elem:c,handlers:o})}return s0?4:0,o=e>=200&&e<300||304===e,n&&(x=p(f,T,n)),x=h(f,x,T,o),o?(f.ifModified&&(b=T.getResponseHeader("Last-Modified"),b&&(E.lastModified[i]=b),(b=T.getResponseHeader("etag"))&&(E.etag[i]=b)),204===e||"HEAD"===f.type?S="nocontent":304===e?S="notmodified":(S=x.state,l=x.data,d=x.error,o=!d)):(d=S,!e&&S||(S="error",e<0&&(e=0))),T.status=e,T.statusText=(t||S)+"",o?y.resolveWith(g,[l,S,T]):y.rejectWith(g,[T,S,d]),T.statusCode(C),C=void 0,c&&m.trigger(o?"ajaxSuccess":"ajaxError",[T,f,o?l:d]),v.fireWith(g,[T,S]),c&&(m.trigger("ajaxComplete",[T,f]),--E.active||E.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,o,i,a,s,c,u,l,f=E.ajaxSetup({},t),g=f.context||f,m=f.context&&(g.nodeType||g.jquery)?E(g):E.event,y=E.Deferred(),v=E.Callbacks("once memory"),C=f.statusCode||{},x={},b={},k=0,S="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===k){if(!l)for(l={};t=ee.exec(a);)l[t[1].toLowerCase()]=t[2];t=l[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===k?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return k||(e=b[n]=b[n]||e,x[e]=t),this},overrideMimeType:function(e){return k||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(k<2)for(t in e)C[t]=[C[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||S;return u&&u.abort(t),n(0,t),this}};if(y.promise(T).complete=v.add,T.success=T.done,T.error=T.fail,f.url=((e||f.url||J)+"").replace(Y,"").replace(re,Q[1]+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=E.trim(f.dataType||"*").toLowerCase().match(M)||[""],null==f.crossDomain&&(r=oe.exec(f.url.toLowerCase()),f.crossDomain=!(!r||r[1]===Q[1]&&r[2]===Q[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(Q[3]||("http:"===Q[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=E.param(f.data,f.traditional)),d(ie,f,t,T),2===k)return T;c=f.global,c&&0==E.active++&&E.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!ne.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(W.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=Z.test(i)?i.replace(Z,"$1_="+X++):i+(W.test(i)?"&":"?")+"_="+X++)),f.ifModified&&(E.lastModified[i]&&T.setRequestHeader("If-Modified-Since",E.lastModified[i]),E.etag[i]&&T.setRequestHeader("If-None-Match",E.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&T.setRequestHeader("Content-Type",f.contentType);for(o in f.headers)T.setRequestHeader(o,f.headers[o]);if(f.beforeSend&&(!1===f.beforeSend.call(g,T,f)||2===k))return T.abort();S="abort";for(o in{success:1,error:1,complete:1})T[o](f[o]);if(u=d(ae,f,t,T)){T.readyState=1,c&&m.trigger("ajaxSend",[T,f]),f.async&&f.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},f.timeout));try{k=1,u.send(x,n)}catch(e){if(!(k<2))throw e;n(-1,e)}}else n(-1,"No Transport");return T},getJSON:function(e,t,n){return E.get(e,t,n,"json")},getScript:function(e,t){return E.get(e,void 0,t,"script")}}),E.each(["get","post"],function(e,t){E[t]=function(e,n,r,o){return E.isFunction(n)&&(o=o||r,r=n,n=void 0),E.ajax({url:e,type:t,dataType:o,data:n,success:r})}}),E.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){E.fn[t]=function(e){return this.on(t,e)}}),E._evalUrl=function(e){return E.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})};var ce=/%20/g,ue=/\[\]$/,le=/\r?\n/g,de=/^(?:submit|button|image|reset|file)$/i,fe=/^(?:input|select|textarea|keygen)/i;E.param=function(e,t){var n,r=[],o=function(e,t){t=E.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=E.ajaxSettings&&E.ajaxSettings.traditional),E.isArray(e)||e.jquery&&!E.isPlainObject(e))E.each(e,function(){o(this.name,this.value)});else for(n in e)g(n,e[n],t,o);return r.join("&").replace(ce,"+")},E.fn.extend({serialize:function(){return E.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=E.prop(this,"elements");return e?E.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!E(this).is(":disabled")&&fe.test(this.nodeName)&&!de.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=E(this).val();return null==n?null:E.isArray(n)?E.map(n,function(e){return{name:t.name,value:e.replace(le,"\r\n")}}):{name:t.name,value:n.replace(le,"\r\n")}}).get()}}),E.ajaxSettings.xhr=void 0!==window.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&m()||y()}:m;var pe=0,he={},ge=E.ajaxSettings.xhr();window.ActiveXObject&&E(window).on("unload",function(){for(var e in he)he[e](void 0,!0)}),R.cors=!!ge&&"withCredentials"in ge,ge=R.ajax=!!ge,ge&&E.ajaxTransport(function(e){if(!e.crossDomain||R.cors){var t;return{send:function(n,r){var o,i=e.xhr(),a=++pe;if(i.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)i[o]=e.xhrFields[o];e.mimeType&&i.overrideMimeType&&i.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(o in n)void 0!==n[o]&&i.setRequestHeader(o,n[o]+"");i.upload&&e.progress&&(i.upload.onprogress=e.progress),i.send(e.hasContent&&(e.body||e.data)||null),t=function(n,o){var s,c,u;if(t&&(o||4===i.readyState))if(delete he[a],t=void 0,i.onreadystatechange=E.noop,o)4!==i.readyState&&i.abort();else{u={},s=i.status,"string"==typeof i.responseText&&(u.text=i.responseText);try{c=i.statusText}catch(e){c=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=u.text?200:404}u&&r(s,c,u,i.getAllResponseHeaders())},e.async?4===i.readyState?setTimeout(t):i.onreadystatechange=he[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),E.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return E.globalEval(e),e}}}),E.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),E.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=I.head||E("head")[0]||I.documentElement;return{send:function(r,o){t=I.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||o(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var me=[],ye=/(=)\?(?=&|$)|\?\?/;return E.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=me.pop()||E.expando+"_"+X++;return this[e]=!0,e}}),E.ajaxPrefilter("json jsonp",function(e,t,n){var r,o,i,a=!1!==e.jsonp&&(ye.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ye.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=E.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(ye,"$1"+r):!1!==e.jsonp&&(e.url+=(W.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return i||E.error(r+" was not called"),i[0]},e.dataTypes[0]="json",o=window[r],window[r]=function(){i=arguments},n.always(function(){window[r]=o,e[r]&&(e.jsonpCallback=t.jsonpCallback,me.push(r)),i&&E.isFunction(o)&&o(i[0]),i=o=void 0}),"script"}),E.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||I;var r=rsingleTag.exec(e),o=!n&&[];return r?[t.createElement(r[1])]:(r=E.buildFragment([e],t,o),o&&o.length&&E(o).remove(),E.merge([],r.childNodes))},E}(),i=function(e,t){if(e=o.extend(!0,{headers:{},qs:{}},e),e.type=e.method,delete e.method,e.onProgress&&(e.progress=e.onProgress,delete e.onProgress),e.qs){var n=r.stringify(e.qs);n&&(e.url+=(-1===e.url.indexOf("?")?"?":"&")+n),delete e.qs}if(e.json&&(e.data=e.body,delete e.json,delete e.body,!e.headers&&(e.headers={}),e.headers["Content-Type"]="application/json"),e.body&&(e.body instanceof Blob||"[object File]"===e.body.toString()||"[object Blob]"===e.body.toString()||(e.data=e.body,delete e.body)),e.headers){var i=e.headers;delete e.headers,e.beforeSend=function(e){for(var t in i)i.hasOwnProperty(t)&&"content-length"!==t.toLowerCase()&&"user-agent"!==t.toLowerCase()&&"origin"!==t.toLowerCase()&&"host"!==t.toLowerCase()&&e.setRequestHeader(t,i[t])}}var a=function(e){var t={};return e.getAllResponseHeaders().trim().split("\n").forEach(function(e){if(e){var n=e.indexOf(":"),r=e.substr(0,n).trim().toLowerCase(),o=e.substr(n+1).trim();t[r]=o}}),{statusCode:e.status,statusMessage:e.statusText,headers:t}};return e.success=function(e,n,r){t(null,a(r),e)},e.error=function(e){e.responseText?t(null,a(e),e.responseText):t(e.statusText,a(e),e.responseText)},e.dataType="text",o.ajax(e)};e.exports=i},function(e,t,n){"use strict";t.decode=t.parse=n(15),t.encode=t.stringify=n(16)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var c=1e3;i&&"number"==typeof i.maxKeys&&(c=i.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var l=0;l=0?(d=g.substr(0,m),f=g.substr(m+1)):(d=g,f=""),p=decodeURIComponent(d),h=decodeURIComponent(f),r(a,p)?o(a[p])?a[p].push(h):a[p]=[a[p],h]:a[p]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=0;r--)C[r][0]===e&&C[r][1]===t&&C.splice(r,1);C.unshift([e,t]);var i=this.options.UploadIdCacheLimit;C.length>i&&C.splice(i),i&&setTimeout(function(){try{localStorage.setItem(T,JSON.stringify(C))}catch(e){}})}function a(e){o.call(this),delete S[e];for(var t=C.length-1;t>=0;t--)C[t][1]===e&&C.splice(t,1);var n=this.options.UploadIdCacheLimit;C.length>n&&C.splice(n),n&&setTimeout(function(){try{C.length?localStorage.setItem(T,JSON.stringify(C)):localStorage.removeItem(T)}catch(e){}})}function s(e){o.call(this);for(var t=[],n=0;ng)return t(null,!1);if(n>1){if(Math.max(e[0].Size,e[1].Size)!==h)return t(null,!1)}var r=function(o){if(o=c.length)return void w.emit("has_upload_id",t);var s=c[e];return k.isInArray(t,s)?S[s]?void f(e+1):void l.call(d,{Bucket:r,Region:o,Key:i,UploadId:s},function(t,r){d._isRunningTask(n)&&(t?(a.call(d,s),f(e+1)):w.emit("upload_id_ready",{UploadId:s,PartList:r.PartList}))}):(a.call(d,s),void f(e+1))};f(0)}else w.emit("has_upload_id",t)}),w.on("get_remote_upload_id_list",function(t){u.call(d,{Bucket:r,Region:o,Key:i},function(t,r){if(d._isRunningTask(n)){if(t)return w.emit("error",t);var o=k.filter(r.UploadList,function(e){return e.Key===i&&(!c||e.StorageClass.toUpperCase()===c.toUpperCase())}).reverse().map(function(e){return e.UploadId||e.UploadID});if(o.length)w.emit("seek_local_avail_upload_id",o);else{var u,l=k.getFileUUID(e.Body,e.ChunkSize);l&&(u=s.call(d,l))&&k.each(u,function(e){a.call(d,e)}),w.emit("no_available_upload_id")}}})}),w.emit("get_remote_upload_id_list")}function u(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key},i=function(){n.multipartList(o,function(e,n){if(e)return t(e);r.push.apply(r,n.Upload||[]),"true"===n.IsTruncated?(o.KeyMarker=n.NextKeyMarker,o.UploadIdMarker=n.NextUploadIdMarker,i()):t(null,{UploadList:r})})};i()}function l(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId},i=function(){n.multipartListPart(o,function(e,n){if(e)return t(e);r.push.apply(r,n.Part||[]),"true"===n.IsTruncated?(o.PartNumberMarker=n.NextPartNumberMarker,i()):t(null,{PartList:r})})};i()}function d(e,t){var n=this,r=e.TaskId,o=e.Bucket,i=e.Region,a=e.Key,s=e.UploadData,c=e.FileSize,u=e.SliceSize,l=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),d=e.Body,p=Math.ceil(c/u),h=0,g=e.ServerSideEncryption,m=k.filter(s.PartList,function(e){return e.Uploaded&&(h+=e.PartNumber>=p?c%u||u:u),!e.Uploaded}),y=e.onProgress;x.eachLimit(m,l,function(e,t){if(n._isRunningTask(r)){var l=e.PartNumber,p=Math.min(c,e.PartNumber*u)-(e.PartNumber-1)*u,m=0;f.call(n,{TaskId:r,Bucket:o,Region:i,Key:a,SliceSize:u,FileSize:c,PartNumber:l,ServerSideEncryption:g,Body:d,UploadData:s,onProgress:function(e){h+=e.loaded-m,m=e.loaded,y({loaded:h,total:c})}},function(o,i){n._isRunningTask(r)&&(!k.isBrowser||o||i.ETag||(o='get ETag error, please add "ETag" to CORS ExposeHeader setting.'),o?h-=m:(h+=p-m,e.ETag=i.ETag),t(o||null,i))})}},function(e){if(n._isRunningTask(r))return e?t(e):void t(null,{UploadId:s.UploadId,SliceList:s.PartList})})}function f(e,t){var n=this,r=e.TaskId,o=e.Bucket,i=e.Region,a=e.Key,s=e.FileSize,c=e.Body,u=1*e.PartNumber,l=e.SliceSize,d=e.ServerSideEncryption,f=e.UploadData,p=n.options.ChunkRetryTimes+1,h=l*(u-1),g=l,m=h+l;m>s&&(m=s,g=m-h);var y=f.PartList[u-1];x.retry(p,function(t){n._isRunningTask(r)&&k.fileSlice(c,h,m,!0,function(s){n.multipartUpload({TaskId:r,Bucket:o,Region:i,Key:a,ContentLength:g,PartNumber:u,UploadId:f.UploadId,ServerSideEncryption:d,Body:s,onProgress:e.onProgress},function(e,o){if(n._isRunningTask(r))return e?t(e):(y.Uploaded=!0,t(null,o))})})},function(e,o){if(n._isRunningTask(r))return t(e,o)})}function p(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,a=e.SliceList,s=this,c=this.options.ChunkRetryTimes+1,u=a.map(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}});x.retry(c,function(e){s.multipartComplete({Bucket:n,Region:r,Key:o,UploadId:i,Parts:u},e)},function(e,n){t(e,n)})}function h(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,a=e.Level||"task",s=e.AsyncLimit,c=this,l=new b;if(l.on("error",function(e){return t(e)}),l.on("get_abort_array",function(i){g.call(c,{Bucket:n,Region:r,Key:o,Headers:e.Headers,AsyncLimit:s,AbortArray:i},function(e,n){if(e)return t(e);t(null,n)})}),"bucket"===a)u.call(c,{Bucket:n,Region:r},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])});else if("file"===a){if(!o)return t({error:"abort_upload_task_no_key"});u.call(c,{Bucket:n,Region:r,Key:o},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])})}else{if("task"!==a)return t({error:"abort_unknown_level"});if(!i)return t({error:"abort_upload_task_no_id"});if(!o)return t({error:"abort_upload_task_no_key"});l.emit("get_abort_array",[{Key:o,UploadId:i}])}}function g(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.AbortArray,a=e.AsyncLimit||1,s=this,c=0,u=new Array(i.length);x.eachLimit(i,a,function(t,i){var a=c;if(o&&o!==t.Key)return u[a]={error:{KeyNotMatch:!0}},void i(null);var l=t.UploadId||t.UploadID;s.multipartAbort({Bucket:n,Region:r,Key:t.Key,Headers:e.Headers,UploadId:l},function(e,o){var s={Bucket:n,Region:r,Key:t.Key,UploadId:l};u[a]={error:e,task:s},i(null)}),c++},function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=u.length;o=r?"sliceUploadFile":"putObject";d.push({api:v,params:e,callback:y})}()}),n._addTasks(d)}function y(e,t){var n=new b,r=this,o=e.Bucket,i=e.Region,a=e.Key,s=e.CopySource,c=s.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!c)return void t({error:"CopySource format error"});var u=c[1],l=c[3],d=decodeURIComponent(c[4]),f=void 0===e.CopySliceSize?r.options.CopySliceSize:e.CopySliceSize;f=Math.max(0,f);var p,h,g=e.CopyChunkSize||this.options.CopyChunkSize,m=this.options.CopyChunkParallelLimit,y=0;n.on("copy_slice_complete",function(e){r.multipartComplete({Bucket:o,Region:i,Key:a,UploadId:e.UploadId,Parts:e.PartList},function(e,n){if(e)return h(null,!0),t(e);h({loaded:p,total:p},!0),t(null,n)})}),n.on("get_copy_data_finish",function(e){x.eachLimit(e.PartList,m,function(t,n){var c=t.PartNumber,u=t.CopySourceRange,l=t.end-t.start,d=0;v.call(r,{Bucket:o,Region:i,Key:a,CopySource:s,UploadId:e.UploadId,PartNumber:c,CopySourceRange:u,onProgress:function(e){y+=e.loaded-d,d=e.loaded,h({loaded:y,total:p})}},function(e,r){if(e)return n(e);h({loaded:y,total:p}),y+=l-d,t.ETag=r.ETag,n(e||null,r)})},function(r){if(r)return h(null,!0),t(r);n.emit("copy_slice_complete",e)})}),n.on("get_file_size_finish",function(s){!function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o"x-cos-meta-".length&&(s[t]=e)}),n.emit("get_file_size_finish",s)}})}function v(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,i=e.Key,a=e.CopySource,s=e.UploadId,c=1*e.PartNumber,u=e.CopySourceRange,l=this.options.ChunkRetryTimes+1,d=this;x.retry(l,function(t){d.uploadPartCopy({TaskId:n,Bucket:r,Region:o,Key:i,CopySource:a,UploadId:s,PartNumber:c,CopySourceRange:u,onProgress:e.onProgress},function(e,n){t(e||null,n)})},function(e,n){return t(e,n)})}var C,x=n(18),b=n(2).EventProxy,k=n(0),S={},T="cos_sdk_upload_cache",w={sliceUploadFile:r,abortUploadTask:h,uploadFiles:m,sliceCopyFile:y};e.exports.init=function(e,t){t.transferToTaskMethod(w,"sliceUploadFile"),k.each(w,function(t,n){e.prototype[n]=k.apiWrapper(n,t)})}},function(e,t){var n=function(e,t,n,r){if(r=r||function(){},!e.length||t<=0)return r();var o=0,i=0,a=0;!function s(){if(o>=e.length)return r();for(;a=e.length?r():s())})}()},r=function(e,t,n){var r=function(o){t(function(t,i){t&&ot?1:-1})},d=function(e){var t,n,o,i=[],a=l(e);for(t=0;t=r){var c=i.digest("hex");return void t(null,c)}var u=Math.min(r,s+1048576);E.fileSlice(e,s,u,!1,function(e){v(e,function(t){e=null,i=i.update(t,!0),o+=t.length,t=null,n&&n({loaded:o,total:r,percent:Math.round(o/r*1e4)/1e4}),a(s+1048576)})})};a(0)},b=function(e){var t,n,r,o="";for(t=0,n=e.length/2;t-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!r)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e){if(!n)return"Bucket";if(!r)return"Region";if(!o)return"Key"}return!1},S=function(e,t){if(t=i({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};if(t&&"object"==typeof t){!function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}();var r={"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext"};E.each(r,function(e,r){void 0!==t[e]&&(n[r]=t[e])}),t.Headers=y(n)}}return t},T=function(e,t){return function(n,r){"function"==typeof n&&(r=n,n={}),n=S(e,n);var o=function(e){return e&&e.headers&&(e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},i=function(e,t){r&&r(o(e),o(t))};if("getService"!==e&&"abortUploadTask"!==e){var a;if(a=k(e,n))return void i({error:"missing param "+a});if(n.Region){if(n.Region.indexOf("cos.")>-1)return void i({error:'param Region should not be start with "cos."'});if(!/^([a-z\d-]+)$/.test(n.Region))return void i({error:"Region format error."});this.options.CompatibilityMode||-1!==n.Region.indexOf("-")||"yfb"===n.Region||"default"===n.Region||console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!this.options.AppId)return void i({error:'Bucket should format as "test-1250000000".'});n.Bucket=n.Bucket+"-"+this.options.AppId}n.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete n.AppId)}!this.options.UseRawKey&&n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}var s=t.call(this,n,i);if("getAuth"===e||"getObjectUrl"===e)return s}},w=function(e,t){function n(){if(o=0,t&&"function"==typeof t){r=Date.now();var n,i=Math.max(0,Math.round((s-a)/((r-c)/1e3)*100)/100);n=0===s&&0===e?1:Math.round(s/e*100)/100||0,c=r,a=s;try{t({loaded:s,total:e,speed:i,percent:n})}catch(e){}}}var r,o,i=this,a=0,s=0,c=Date.now();return function(t,r){if(t&&(s=t.loaded,e=t.total),r)clearTimeout(o),n();else{if(o)return;o=setTimeout(n,i.options.ProgressInterval)}}},R=function(e,t,n){var r;if("string"==typeof t.Body&&(t.Body=new Blob([t.Body],{type:"text/plain"})),!t.Body||!(t.Body instanceof Blob||"[object File]"===t.Body.toString()||"[object Blob]"===t.Body.toString()))return void n({error:"params body format error, Only allow File|Blob|String."});r=t.Body.size,t.ContentLength=r,n(null,r)},A=function(e){return Date.now()+(e||0)},E={noop:m,formatParams:S,apiWrapper:T,xml2json:p,json2xml:h,md5:d,clearKey:y,getFileMd5:C,binaryBase64:b,extend:i,isArray:a,isInArray:s,each:c,map:u,filter:l,clone:o,uuid:x,camSafeUrlEncode:r,throttleOnProgress:w,getFileSize:R,getSkewTime:A,getAuth:g,isBrowser:!0},B=function(){var e=function(e,t){e=e.split("."),t=t.split(".");for(var n=0;nparseInt(t[n])?1:-1;return 0};return function(t){var n=(t.match(/Chrome\/([.\d]+)/)||[])[1],r=(t.match(/QBCore\/([.\d]+)/)||[])[1],o=(t.match(/QQBrowser\/([.\d]+)/)||[])[1];return n&&e(n,"53.0.2785.116")<0&&r&&e(r,"3.53.991.400")<0&&o&&e(o,"9.0.2524.400")<=0||!1}(navigator&&navigator.userAgent)}();E.fileSlice=function(e,t,n,r,o){var i;if(e.slice?i=e.slice(t,n):e.mozSlice?i=e.mozSlice(t,n):e.webkitSlice&&(i=e.webkitSlice(t,n)),r&&B){var a=new FileReader;a.onload=function(e){i=null,o(new Blob([a.result]))},a.readAsArrayBuffer(i)}else o(i)},E.getFileUUID=function(e,t){return e.name&&e.size&&e.lastModifiedDate&&t?E.md5([e.name,e.size,e.lastModifiedDate,t].join("::")):null},E.getBodyMd5=function(e,t,n,r){n=n||m,e?"string"==typeof t?n(E.md5(t,!0)):Blob&&t instanceof Blob?E.getFileMd5(t,function(e,t){n(t)},r):n():n()},e.exports=E},function(e,t){function n(e,t){for(var n in e)t[n]=e[n]}function r(e,t){function r(){}var o=e.prototype;if(Object.create){var i=Object.create(t.prototype);o.__proto__=i}o instanceof t||(r.prototype=t.prototype,r=new r,n(o,r),e.prototype=o=r),o.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),o.constructor=e)}function o(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,oe[e]),this.message=oe[e],Error.captureStackTrace&&Error.captureStackTrace(this,o);return n.code=e,t&&(this.message=this.message+": "+t),n}function i(){}function a(e,t){this._node=e,this._refresh=t,s(this)}function s(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);F(e,"length",r.length),n(r,e),e._inc=t}}function c(){}function u(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function l(e,t,n,r){if(r?t[u(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var o=e.ownerDocument;o&&(r&&v(o,e,r),y(o,e,n))}}function d(e,t,n){var r=u(t,n);if(!(r>=0))throw o(ae,new Error(e.tagName+"@"+n));for(var i=t.length-1;r"==e&&">"||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function g(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(g(e,t))return!0}while(e=e.nextSibling)}function m(){}function y(e,t,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&(t._nsMap[n.prefix?n.localName:""]=n.value)}function v(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function C(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i}}}function b(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,C(e.ownerDocument,e),t}function x(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===te){var o=t.firstChild;if(null==o)return t;var i=t.lastChild}else o=i=t;var a=n?n.previousSibling:e.lastChild;o.previousSibling=a,i.nextSibling=n,a?a.nextSibling=o:e.firstChild=o,null==n?e.lastChild=i:n.previousSibling=i;do{o.parentNode=e}while(o!==i&&(o=o.nextSibling));return C(e.ownerDocument||e,e),t.nodeType==te&&(t.firstChild=t.lastChild=null),t}function k(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t);var r=e.lastChild}var r=e.lastChild;return t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,C(e.ownerDocument,e,t),t}function S(){this._nsMap={}}function T(){}function w(){}function R(){}function A(){}function E(){}function B(){}function N(){}function _(){}function P(){}function D(){}function I(){}function O(){}function M(e,t){var n=[],r=9==this.nodeType?this.documentElement:this,o=r.prefix,i=r.namespaceURI;if(i&&null==o){var o=r.lookupPrefix(i);if(null==o)var a=[{namespace:i,prefix:null}]}return j(this,n,e,t,a),n.join("")}function L(e,t,n){var r=e.prefix||"",o=e.namespaceURI;if(!r&&!o)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===o||"http://www.w3.org/2000/xmlns/"==o)return!1;for(var i=n.length;i--;){var a=n[i];if(a.prefix==r)return a.namespace!=o}return!0}function j(e,t,n,r,o){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case G:o||(o=[]);var i=(o.length,e.attributes),a=i.length,s=e.firstChild,c=e.tagName;n=z===e.namespaceURI||n,t.push("<",c);for(var u=0;u"),n&&/^script$/i.test(c))for(;s;)s.data?t.push(s.data):j(s,t,n,r,o),s=s.nextSibling;else for(;s;)j(s,t,n,r,o),s=s.nextSibling;t.push("")}else t.push("/>");return;case Z:case te:for(var s=e.firstChild;s;)j(s,t,n,r,o),s=s.nextSibling;return;case W:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,h),'"');case V:return t.push(e.data.replace(/[<&]/g,h));case X:return t.push("");case Y:return t.push("\x3c!--",e.data,"--\x3e");case ee:var g=e.publicId,m=e.systemId;if(t.push("');else if(m&&"."!=m)t.push(' SYSTEM "',m,'">');else{var y=e.internalSubset;y&&t.push(" [",y,"]"),t.push(">")}return;case J:return t.push("");case $:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function U(e,t,n){var r;switch(t.nodeType){case G:r=t.cloneNode(!1),r.ownerDocument=e;case te:break;case W:n=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null,n)for(var o=t.firstChild;o;)r.appendChild(U(e,o,n)),o=o.nextSibling;return r}function H(e,t,n){var r=new t.constructor;for(var o in t){var a=t[o];"object"!=typeof a&&a!=r[o]&&(r[o]=a)}switch(t.childNodes&&(r.childNodes=new i),r.ownerDocument=e,r.nodeType){case G:var s=t.attributes,u=r.attributes=new c,l=s.length;u._ownerElement=r;for(var d=0;d0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==W?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==W?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},n(q,p),n(q,p.prototype),m.prototype={nodeName:"#document",nodeType:Z,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==te){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==G&&(this.documentElement=e),x(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),b(this,e)},importNode:function(e,t){return U(this,e,t)},getElementById:function(e){var t=null;return g(this.documentElement,function(n){if(n.nodeType==G&&n.getAttribute("id")==e)return t=n,!0}),t},createElement:function(e){var t=new S;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new i,(t.attributes=new c)._ownerElement=t,t},createDocumentFragment:function(){var e=new D;return e.ownerDocument=this,e.childNodes=new i,e},createTextNode:function(e){var t=new R;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new A;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new E;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new I;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new T;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new P;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new S,r=t.split(":"),o=n.attributes=new c;return n.childNodes=new i,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,o._ownerElement=n,n},createAttributeNS:function(e,t){var n=new T,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},r(m,p),S.prototype={nodeType:G,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===te?this.insertBefore(e,null):k(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new a(this,function(t){var n=[];return g(t,function(r){r===t||r.nodeType!=G||"*"!==e&&r.tagName!=e||n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new a(this,function(n){var r=[];return g(n,function(o){o===n||o.nodeType!==G||"*"!==e&&o.namespaceURI!==e||"*"!==t&&o.localName!=t||r.push(o)}),r})}},m.prototype.getElementsByTagName=S.prototype.getElementsByTagName,m.prototype.getElementsByTagNameNS=S.prototype.getElementsByTagNameNS,r(S,p),T.prototype.nodeType=W,r(T,p),w.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(oe[ie])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},r(w,p),R.prototype={nodeName:"#text",nodeType:V,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},r(R,w),A.prototype={nodeName:"#comment",nodeType:Y},r(A,w),E.prototype={nodeName:"#cdata-section",nodeType:X},r(E,w),B.prototype.nodeType=ee,r(B,p),N.prototype.nodeType=ne,r(N,p),_.prototype.nodeType=Q,r(_,p),P.prototype.nodeType=$,r(P,p),D.prototype.nodeName="#document-fragment",D.prototype.nodeType=te,r(D,p),I.prototype.nodeType=J,r(I,p),O.prototype.serializeToString=function(e,t,n){return M.call(e,t,n)},p.prototype.toString=M;try{Object.defineProperty&&(Object.defineProperty(a.prototype,"length",{get:function(){return s(this),this.$$length}}),Object.defineProperty(p.prototype,"textContent",{get:function(){return K(this)},set:function(e){switch(this.nodeType){case G:case te:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),F=function(e,t,n){e["$$"+t]=n})}catch(e){}t.DOMImplementation=f,t.XMLSerializer=O},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){"task-list-update"===e&&console.warn('warning: Event "'+e+'" has been deprecated. Please use "list-update" instead.'),n(e).push(t)},e.off=function(e,t){for(var r=n(e),o=r.length-1;o>=0;o--)t===r[o]&&r.splice(o,1)},e.emit=function(e,t){for(var r=n(e).map(function(e){return e}),o=0;o>>32-o,n)}function o(e,t,n,o,i,a,s){return r(t&n|~t&o,e,t,i,a,s)}function i(e,t,n,o,i,a,s){return r(t&o|n&~o,e,t,i,a,s)}function a(e,t,n,o,i,a,s){return r(t^n^o,e,t,i,a,s)}function s(e,t,n,o,i,a,s){return r(n^(t|~o),e,t,i,a,s)}function c(e){var t,r=e.length,o=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)n(o,l(e.substring(t-64,t)));e=e.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(o,i),t=0;t<16;t++)i[t]=0;return i[14]=8*r,n(o,i),o}function u(){var e={};return e.state=[1732584193,-271733879,-1732584194,271733878],e.tail="",e.size=0,e.update=function(t,r){r||(t=p(t)),e.size+=t.length,t=e.tail+t;var o,i=e.state;for(o=64;o<=t.length;o+=64)n(i,l(t.substring(o-64,o)));return e.tail=t.substring(o-64),e},e.digest=function(t){var r,o=e.size,i=e.state,a=e.tail,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r>2]|=a.charCodeAt(r)<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(n(i,s),r=0;r<16;r++)s[r]=0;return s[14]=8*o,n(i,s),"hex"===t?f(i):"base64"===t?g(f(i)):i},e}function l(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function d(e){for(var t="",n=0;n<4;n++)t+=m[e>>8*n+4&15]+m[e>>8*n&15];return t}function f(e){for(var t=0;t127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}function h(e,t){return t||(e=p(e)),f(c(e))}var g=function(e){var t,n,r,o="";for(t=0,n=e.length/2;t>16)+(t>>16)+(n>>16)<<16|65535&n}),h.getCtx=u,e.exports=h},function(e,t,n){var r=r||function(e,t){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var o=0;o>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},u=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0);if(t=s*i,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}l=(r<<5|r>>>27)+c+i[u],l=20>u?l+(1518500249+(o&a|~o&s)):40>u?l+(1859775393+(o^a^s)):60>u?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),c=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=o._createHelper(t),e.HmacSHA1=o._createHmacHelper(t)}(),function(){var e=r,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,o=4*r;n.sigBytes>o&&(n=e.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,c=a.words,u=0;u>>2]>>>24-i%4*8&255,s=t[i+1>>>2]>>>24-(i+1)%4*8&255,c=t[i+2>>>2]>>>24-(i+2)%4*8&255,u=a<<16|s<<8|c,l=0;l<4&&i+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=r.charAt(64);if(o){var i=e.indexOf(o);-1!=i&&(t=i)}for(var a=[],s=0,c=0;c>>6-c%4*2;a[s>>>2]|=(u|l)<<24-s%4*8,s++}return n.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.exports=r},function(e,t,n){var r=n(8).DOMParser,o=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/);new RegExp(/^\s+|\s+$/g);return this.grokType=function(e){return/^\s*$/.test(e)?null:/^(?:true|false)$/i.test(e)?"true"===e.toLowerCase():isFinite(e)?parseFloat(e):e},this.parseString=function(e,t){if(e){var n=this.stringToXML(e);return n.getElementsByTagName("parsererror").length?null:this.parseXML(n,t)}return null},this.parseXML=function(n,r){for(var i in r)e[i]=r[i];var a={},s=0,c="";if(n.childNodes.length)for(var u,l,d,f=0;f=t+n||t?new java.lang.String(e,t,n)+"":e}function u(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new l,a=n.domBuilder||new i,s=n.errorHandler,c=n.locator,u=n.xmlns||{},d={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return c&&a.setDocumentLocator(c),r.errorHandler=o(s,a,c),r.domBuilder=n.domBuilder||a,/\/x?html?$/.test(t)&&(d.nbsp="\xa0",d.copy="\xa9",u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,u,d):r.errorHandler.error("invalid doc source"),a.doc},i.prototype={startDocument:function(){this.doc=(new d).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var o=this.doc,i=o.createElementNS(e,n||t),s=r.length;u(this,i),this.currentElement=i,this.locator&&a(this.locator,i);for(var c=0;c65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function h(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?p(parseInt(t.substr(1).replace("x","0x"))):(u.error("entity not found:"+e),e)}function g(t){if(t>S){var n=e.substring(S,t).replace(/&#?\w+;/g,h);b&&m(S),r.characters(n,0,t-S),S=t}}function m(t,n){for(;t>=v&&(n=C.exec(e));)y=n.index,v=y+n[0].length,b.lineNumber++;b.columnNumber=t-y+1}for(var y=0,v=0,C=/.*(?:\r\n?|\n)|.*$/g,b=r.locator,x=[{currentNSMap:t}],k={},S=0;;){try{var T=e.indexOf("<",S);if(T<0){if(!e.substr(S).match(/^\s*$/)){var w=r.doc,R=w.createTextNode(e.substr(S));w.appendChild(R),r.currentElement=R}return}switch(T>S&&g(T),e.charAt(T+1)){case"/":var A=e.indexOf(">",T+3),E=e.substring(T+2,A),B=x.pop();A<0?(E=e.substring(T+2).replace(/[\s<].*/,""),u.error("end tag name: "+E+" is not complete:"+B.tagName),A=T+1+E.length):E.match(/\sS?S=A:g(Math.max(T,S)+1)}}function o(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function i(e,t,n,r,o,i){for(var a,s,c=++t,u=v;;){var l=e.charAt(c);switch(l){case"=":if(u===C)a=e.slice(t,c),u=x;else{if(u!==b)throw new Error("attribute equal must after attrName");u=x}break;case"'":case'"':if(u===x||u===C){if(u===C&&(i.warning('attribute value must after "="'),a=e.slice(t,c)),t=c+1,!((c=e.indexOf(l,t))>0))throw new Error("attribute value no end '"+l+"' match");s=e.slice(t,c).replace(/&#?\w+;/g,o),n.add(a,s,t-1),u=S}else{if(u!=k)throw new Error('attribute value must after "="');s=e.slice(t,c).replace(/&#?\w+;/g,o),n.add(a,s,t),i.warning('attribute "'+a+'" missed start quot('+l+")!!"),t=c+1,u=S}break;case"/":switch(u){case v:n.setTagName(e.slice(t,c));case S:case T:case w:u=w,n.closed=!0;case k:case C:case b:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),u==v&&n.setTagName(e.slice(t,c)),c;case">":switch(u){case v:n.setTagName(e.slice(t,c));case S:case T:case w:break;case k:case C:s=e.slice(t,c),"/"===s.slice(-1)&&(n.closed=!0,s=s.slice(0,-1));case b:u===b&&(s=a),u==k?(i.warning('attribute "'+s+'" missed quot(")!!'),n.add(a,s.replace(/&#?\w+;/g,o),t)):("http://www.w3.org/1999/xhtml"===r[""]&&s.match(/^(?:disabled|checked|selected)$/i)||i.warning('attribute "'+s+'" missed value!! "'+s+'" instead!!'),n.add(s,s,t));break;case x:throw new Error("attribute value missed!!")}return c;case"\x80":l=" ";default:if(l<=" ")switch(u){case v:n.setTagName(e.slice(t,c)),u=T;break;case C:a=e.slice(t,c),u=b;break;case k:var s=e.slice(t,c).replace(/&#?\w+;/g,o);i.warning('attribute "'+s+'" missed quot(")!!'),n.add(a,s,t);case S:u=T}else switch(u){case b:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&a.match(/^(?:disabled|checked|selected)$/i)||i.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),n.add(a,a,t),t=c,u=C;break;case S:i.warning('attribute space is required"'+a+'"!!');case T:u=C,t=c;break;case x:u=k,t=c;break;case w:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function a(e,t,n){for(var r=e.tagName,o=null,i=e.length;i--;){var a=e[i],s=a.qName,c=a.value,l=s.indexOf(":");if(l>0)var d=a.prefix=s.slice(0,l),f=s.slice(l+1),p="xmlns"===d&&f;else f=s,d=null,p="xmlns"===s&&"";a.localName=f,!1!==p&&(null==o&&(o={},u(n,n={})),n[p]=o[p]=c,a.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(p,c))}for(var i=e.length;i--;){a=e[i];var d=a.prefix;d&&("xml"===d&&(a.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==d&&(a.uri=n[d||""]))}var l=r.indexOf(":");l>0?(d=e.prefix=r.slice(0,l),f=e.localName=r.slice(l+1)):(d=null,f=e.localName=r);var h=e.uri=n[d||""];if(t.startElement(h,f,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=o,!0;if(t.endElement(h,f,r),o)for(d in o)t.endPrefixMapping(d)}function s(e,t,n,r,o){if(/^(?:script|textarea)$/i.test(n)){var i=e.indexOf("",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(n)?(o.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),o.characters(a,0,a.length),i)}return t+1}function c(e,t,n,r){var o=r[n];return null==o&&(o=e.lastIndexOf(""),ot?(n.comment(e,t+4,o-t-4),o+3):(r.error("Unclosed comment"),-1)}return-1;default:if("CDATA["==e.substr(t+3,6)){var o=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var i=h(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var s=i[1][0],c=a>3&&/^public$/i.test(i[2][0])&&i[3][0],u=a>4&&i[4][0],l=i[a-1];return n.startDTD(s,c&&c.replace(/^(['"])(.*?)\1$/,"$2"),u&&u.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),l.index+l[0].length}}return-1}function d(e,t,n){var r=e.indexOf("?>",t);if(r){var o=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),r+2}return-1}return-1}function f(e){}function p(e,t){return e.__proto__=t,e}function h(e,t){var n,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=t,o.exec(e);n=o.exec(e);)if(r.push(n),n[1])return r}var g=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=new RegExp("[\\-\\.0-9"+g.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),y=new RegExp("^"+g.source+m.source+"*(?::"+g.source+m.source+"*)?$"),v=0,C=1,b=2,x=3,k=4,S=5,T=6,w=7;n.prototype={parse:function(e,t,n){var o=this.domBuilder;o.startDocument(),u(t,t={}),r(e,t,n,o,this.errorHandler),o.endDocument()}},f.prototype={setTagName:function(e){if(!y.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!y.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},p({},p.prototype)instanceof p||(p=function(e,t){function n(){}n.prototype=t,n=new n;for(t in e)n[t]=e[t];return n}),t.XMLReader=n},function(e,t){function n(e){return(""+e).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(o,"")}var r=new RegExp("^([^a-zA-Z_\xc0-\xd6\xd8-\xf6\xf8-\xff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fff\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd])|^((x|X)(m|M)(l|L))|([^a-zA-Z_\xc0-\xd6\xd8-\xf6\xf8-\xff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fff\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd-.0-9\xb7\u0300-\u036f\u203f\u2040])","g"),o=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,i=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},a=function(e,t){var o=function(e,n,o,i,a){var s=void 0!==t.indent?t.indent:"\t",c=t.prettyPrint?"\n"+new Array(i).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(r,"_"));var u=[c,"<",e,o||""];return n&&n.length>0?(u.push(">"),u.push(n),a&&u.push(c),u.push("")):u.push("/>"),u.join("")};return function e(r,a,s){var c=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?c="array":r instanceof Date&&(c="date"),c){case"array":var u=[];return r.map(function(t){u.push(e(t,1,s+1))}),t.prettyPrint&&u.push("\n"),u.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":var l=[];for(var d in r)if(r.hasOwnProperty(d))if(r[d]instanceof Array)for(var f=0;f0&&l.push("\n"),l.join("");case"function":return r();default:return t.escape?n(r):""+r}}(e,0,0)},s=function(e){var t=['"),t.join("")};e.exports=function(e,t){if(t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),"string"==typeof e)try{e=JSON.parse(e.toString())}catch(e){return!1}var n="",r="";return t&&("object"==typeof t?(t.xmlHeader&&(n=s(!!t.xmlHeader.standalone)),void 0!==t.docType&&(r="")):n=s()),t=t||{},[n,t.prettyPrint&&r?"\n":"",r,a(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t,n){var r=n(0),o={},i=function(e,t){o[t]=e[t],e[t]=function(e,n){e.SkipTask?o[t].call(this,e,n):this._addTask(t,e,n)}},a=function(e){var t=[],n={},i=0,a=0,s=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),e._custom&&(t._custom=e._custom),t},c=function(){var n,o=function(){n=0,e.emit("task-list-update",{list:r.map(t,s)}),e.emit("list-update",{list:r.map(t,s)})};return function(){n||(n=setTimeout(o))}}(),u=function(){if(!(t.length<=e.options.UploadQueueSize)){for(var r=0;re.options.UploadQueueSize;){var o="waiting"===t[r].state||"checking"===t[r].state||"uploading"===t[r].state;t[r]&&o?r++:(n[t[r].id]&&delete n[t[r].id],t.splice(r,1),a--)}c()}},l=function(){if(!(i>=e.options.FileParallelLimit)){for(;t[a]&&"waiting"!==t[a].state;)a++;if(!(a>=t.length)){var n=t[a];a++,i++,n.state="checking",n.params.onTaskStart&&n.params.onTaskStart(s(n)),!n.params.UploadData&&(n.params.UploadData={});var d=r.formatParams(n.api,n.params);o[n.api].call(e,d,function(t,r){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=t?"error":"success",t&&(n.error=t),i--,c(),l(),n.callback&&n.callback(t,r),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),u())}),c(),setTimeout(l)}}},d=function(t,r){var o=n[t];if(o){var a=o&&"waiting"===o.state,s=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===r&&"canceled"!==o.state||"paused"===r&&a||"paused"===r&&s){if("paused"===r&&o.params.Body&&"function"==typeof o.params.Body.pipe)return void console.error("stream not support pause");o.state=r,e.emit("inner-kill-task",{TaskId:t,toState:r}),c(),s&&(i--,l()),"canceled"===r&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}u()}};e._addTasks=function(t){r.each(t,function(t){e._addTask(t.api,t.params,t.callback,!0)}),c()};var f=!0;e._addTask=function(o,i,a,s){i=r.formatParams(o,i);var d=r.uuid();i.TaskId=d,i.onTaskReady&&i.onTaskReady(d),i.TaskReady&&(i.TaskReady(d),f&&console.warn('warning: Param "TaskReady" has been deprecated. Please use "onTaskReady" instead.'),f=!1);var p={params:i,callback:a,api:o,index:t.length,id:d,Bucket:i.Bucket,Region:i.Region,Key:i.Key,FilePath:i.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:i._custom},h=i.onHashProgress;i.onHashProgress=function(t){e._isRunningTask(p.id)&&(p.hashPercent=t.percent,h&&h(t),c())};var g=i.onProgress;return i.onProgress=function(t){e._isRunningTask(p.id)&&("checking"===p.state&&(p.state="uploading"),p.loaded=t.loaded,p.speed=t.speed,p.percent=t.percent,g&&g(t),c())},r.getFileSize(o,i,function(e,r){if(e)return void a(e);n[d]=p,t.push(p),p.size=r,!s&&c(),l(),u()}),d},e._isRunningTask=function(e){var t=n[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return r.map(t,s)},e.cancelTask=function(e){d(e,"canceled")},e.pauseTask=function(e){d(e,"paused")},e.restartTask=function(e){var t=("string"==typeof e?{id:e}:e)||{},r=n[e];!r||"paused"!==r.state&&"error"!==r.state||(r.state="waiting",t&&c(),a=0,l())},e.isUploadRunning=function(){return i||a/gi,"<$1Rule>"),r=r.replace(/<(\/?)Tags>/gi,"<$1Tag>");var o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=oe.binaryBase64(oe.md5(r)),ee.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"replication",headers:o},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function T(e,t){ee.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var r={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)})}function w(e,t){ee.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function R(e,t){if(!e.WebsiteConfiguration)return void t({error:"missing param WebsiteConfiguration"});var n=oe.clone(e.WebsiteConfiguration||{}),r=n.RoutingRules||n.RoutingRule||[];r=oe.isArray(r)?r:[r],delete n.RoutingRule,delete n.RoutingRules,r.length>0&&(n.RoutingRules={RoutingRule:r});var o=oe.json2xml({WebsiteConfiguration:n}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=oe.binaryBase64(oe.md5(o)),ee.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:o,action:"website",headers:i},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function A(e,t){ee.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website"},function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var r={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var o=n.WebsiteConfiguration||{};if(o.RoutingRules){var i=oe.clone(o.RoutingRules.RoutingRule||[]);i=oe.makeArray(i),o.RoutingRules=i}t(null,{WebsiteConfiguration:o,statusCode:n.statusCode,headers:n.headers})}})}function E(e,t){ee.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function B(e,t){ee.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0,statusCode:o}):t(n)}r.headers&&r.headers.etag&&(r.ETag=r.headers&&r.headers.etag),t(null,r)})}function N(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,ee.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions"},function(e,n){if(e)return t(e);var r=n.ListVersionsResult||{},o=r.DeleteMarker||[];o=oe.isArray(o)?o:[o];var i=r.Version||[];i=oe.isArray(i)?i:[i];var a=oe.clone(r);delete a.DeleteMarker,delete a.Version,oe.extend(a,{DeleteMarkers:o,Versions:i,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function _(e,t){var n={};n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,ee.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,rawBody:!0},function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0}):t(n)}var i={};i.Body=r.body,r.headers&&r.headers.etag&&(i.ETag=r.headers&&r.headers.etag),oe.extend(i,{statusCode:r.statusCode,headers:r.headers}),t(null,i)})}function P(e,t){var n=this,r=e.ContentLength,o=oe.throttleOnProgress.call(n,r,e.onProgress),i=e.Headers;!i["Cache-Control"]&&(i["Cache-Control"]="");var a=i["Content-Type"]||e.Body&&e.Body.type;!i["Content-Type"]&&a&&(i["Content-Type"]=a);var s=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5;oe.getBodyMd5(s,e.Body,function(i){i&&(n.options.UploadCheckContentMd5&&(e.Headers["Content-MD5"]=oe.binaryBase64(i)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(e.Headers["x-cos-meta-md5"]=i)),void 0!==e.ContentLength&&(e.Headers["Content-Length"]=e.ContentLength),o(null,!0),ee.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,body:e.Body,onProgress:o},function(i,a){if(i)return o(null,!0),t(i);if(o({loaded:r,total:r},!0),a){var s=J({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key});s=s.substr(s.indexOf("://")+3);var c={Location:s,statusCode:a.statusCode,headers:a.headers};return a.headers&&a.headers.etag&&(c.ETag=a.headers.etag),t(null,c)}t(null,a)})},e.onHashProgress)}function D(e,t){ee.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId},function(e,n){if(e){var r=e.statusCode;return r&&204===r?t(null,{statusCode:r}):r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})})}function I(e,t){ee.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"acl"},function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},o=r.Owner||{},i=r.AccessControlList&&r.AccessControlList.Grant||[];i=oe.isArray(i)?i:[i];var a=$(r);n.headers&&n.headers["x-cos-acl"]&&(a.ACL=n.headers["x-cos-acl"]),a=oe.extend(a,{Owner:o,Grants:i,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function O(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var o=oe.clone(e.AccessControlPolicy||{}),i=o.Grants||o.Grant;i=oe.isArray(i)?i:[i],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:i},r=oe.json2xml({AccessControlPolicy:o}),n["Content-Type"]="application/xml",n["Content-MD5"]=oe.binaryBase64(oe.md5(r))}oe.each(n,function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=Q(n[t]))}),ee.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:r},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})}function M(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,ee.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n},function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var r=n.headers||{};t(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})})}function L(e,t){var n=e.Headers;!n["Cache-Control"]&&(n["Cache-Control"]="");var r=e.CopySource||"",o=r.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!o)return void t({error:"CopySource format error"});var i=o[1],a=o[3],s=decodeURIComponent(o[4]);ee.call(this,{Scope:[{action:"name/cos:GetObject",bucket:i,region:a,prefix:s},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(e,n){if(e)return t(e);var r=oe.clone(n.CopyObjectResult||{});oe.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function j(e,t){var n=e.CopySource||"",r=n.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!r)return void t({error:"CopySource format error"});var o=r[1],i=r[3],a=decodeURIComponent(r[4]);ee.call(this,{Scope:[{action:"name/cos:GetObject",bucket:o,region:i,prefix:a},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers},function(e,n){if(e)return t(e);var r=oe.clone(n.CopyPartResult||{});oe.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function U(e,t){var n=e.Objects||[],r=e.Quiet;n=oe.isArray(n)?n:[n];var o=oe.json2xml({Delete:{Object:n,Quiet:r||!1}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=oe.binaryBase64(oe.md5(o));var a=oe.map(n,function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}});ee.call(this,{Scope:a,method:"POST",Bucket:e.Bucket,Region:e.Region,body:o,action:"delete",headers:i},function(e,n){if(e)return t(e);var r=n.DeleteResult||{},o=r.Deleted||[],i=r.Error||[];o=oe.isArray(o)?o:[o],i=oe.isArray(i)?i:[i];var a=oe.clone(r);oe.extend(a,{Error:i,Deleted:o,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function H(e,t){var n=e.Headers;if(!e.RestoreRequest)return void t({error:"missing param RestoreRequest"});var r=e.RestoreRequest||{},o=oe.json2xml({RestoreRequest:r});n["Content-Type"]="application/xml",n["Content-MD5"]=oe.binaryBase64(oe.md5(o)),ee.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:o,action:"restore",headers:n},function(e,n){t(e,n)})}function F(e,t){var n=this,r=e.Headers;!r["Cache-Control"]&&(r["Cache-Control"]=""),oe.getBodyMd5(e.Body&&(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5),e.Body,function(r){r&&(e.Headers["x-cos-meta-md5"]=r),ee.call(n,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers},function(e,n){return e?t(e):(n=oe.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,oe.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)})},e.onHashProgress)}function K(e,t){var n=this;oe.getFileSize("multipartUpload",e,function(){oe.getBodyMd5(n.options.UploadCheckContentMd5,e.Body,function(r){r&&(e.Headers["Content-MD5"]=oe.binaryBase64(r)),ee.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null},function(e,n){if(e)return t(e);n.headers=n.headers||{},t(null,{ETag:n.headers.etag||"",statusCode:n.statusCode,headers:n.headers})})})})}function z(e,t){for(var n=this,r=e.UploadId,o=e.Parts,i=0,a=o.length;i-1?n.Authorization:"sign="+encodeURIComponent(n.Authorization)),n.XCosSecurityToken&&(o+="&x-cos-security-token="+n.XCosSecurityToken),n.ClientIP&&(o+="&clientIP="+n.ClientIP),n.ClientUA&&(o+="&clientUA="+n.ClientUA),n.Token&&(o+="&token="+n.Token),setTimeout(function(){t(null,{Url:o})})}});return o?r+"?"+o.Authorization+(o.XCosSecurityToken?"&x-cos-security-token="+o.XCosSecurityToken:""):r}function $(e){var t={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},n={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},r=e.AccessControlList.Grant;r&&(r=oe.isArray(r)?r:[r]);var o={READ:0,WRITE:0,FULL_CONTROL:0};return r.length&&oe.each(r,function(r){"qcs::cam::anyone:anyone"===r.Grantee.ID||"http://cam.qcloud.com/groups/global/AllUsers"===r.Grantee.URI?o[r.Permission]=1:r.Grantee.ID!==e.Owner.ID&&t[n[r.Permission]].push('id="'+r.Grantee.ID+'"')}),o.FULL_CONTROL||o.WRITE&&o.READ?t.ACL="public-read-write":o.READ?t.ACL="public-read":t.ACL="private",oe.each(n,function(e){t[e]=Q(t[e].join(","))}),t}function Q(e){var t,n,r=e.split(","),o={};for(t=0;t-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(o="{Bucket}."+o)),o=o.replace(/\{\{AppId\}\}/gi,r).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,i).replace(/\{\{.*?\}\}/gi,""),o=o.replace(/\{AppId\}/gi,r).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,i).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(o)||(o=s+"//"+o),"/"===o.slice(-1)&&(o=o.slice(0,-1));var c=o;return e.ForcePathStyle&&(c+="/"+t),c+="/",a&&(c+=oe.camSafeUrlEncode(a).replace(/%2F/g,"/")),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}function Y(e,t){var n=oe.clone(e.Headers);delete n["Content-Type"],delete n["Cache-Control"],oe.each(n,function(e,t){""===e&&delete n[t]});var r=function(e){var n=!1,r=e.Authorization;if(r)if(r.indexOf(" ")>-1)n=!1;else if(r.indexOf("q-sign-algorithm=")>-1&&r.indexOf("q-ak=")>-1&&r.indexOf("q-sign-time=")>-1&&r.indexOf("q-key-time=")>-1&&r.indexOf("q-url-param-list=")>-1)n=!0;else try{r=atob(r),r.indexOf("a=")>-1&&r.indexOf("k=")>-1&&r.indexOf("t=")>-1&&r.indexOf("r=")>-1&&r.indexOf("b=")>-1&&(n=!0)}catch(e){}n?t&&t(null,e):t&&t("authorization error")},o=this,i=e.Bucket||"",a=e.Region||"",s=e.Key||"";o.options.ForcePathStyle&&i&&(s=i+"/"+s);var c="/"+s,u={},l=e.Scope;if(!l){var d=e.Action||"",f=e.ResourceKey||e.Key||"";l=e.Scope||[{action:d,bucket:i,region:a,prefix:f}]}var p=oe.md5(JSON.stringify(l));o._StsCache=o._StsCache||[],function(){var e,t;for(e=o._StsCache.length-1;e>=0;e--){t=o._StsCache[e];var n=Math.round(oe.getSkewTime(o.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)o._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===p){u=t;break}}}();var h=function(){var t=oe.getAuth({SecretId:u.TmpSecretId,SecretKey:u.TmpSecretKey,Method:e.Method,Pathname:c,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:o.options.UseRawKey,SystemClockOffset:o.options.SystemClockOffset}),i={Authorization:t,XCosSecurityToken:u.XCosSecurityToken||"",Token:u.Token||"",ClientIP:u.ClientIP||"",ClientUA:u.ClientUA||""};r(i)};if(u.ExpiredTime&&u.ExpiredTime-oe.getSkewTime(o.options.SystemClockOffset)/1e3>60)h();else if(o.options.getAuthorization)o.options.getAuthorization.call(o,{Bucket:i,Region:a,Method:e.Method,Key:s,Pathname:c,Query:e.Query,Headers:n,Scope:l},function(e){"string"==typeof e&&(e={Authorization:e}),e.TmpSecretId&&e.TmpSecretKey&&e.XCosSecurityToken&&e.ExpiredTime?(u=e||{},u.Scope=l,u.ScopeKey=p,o._StsCache.push(u),h()):r(e)});else{if(!o.options.getSTS)return function(){var t=oe.getAuth({SecretId:e.SecretId||o.options.SecretId,SecretKey:e.SecretKey||o.options.SecretKey,Method:e.Method,Pathname:c,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:o.options.UseRawKey,SystemClockOffset:o.options.SystemClockOffset}),i={Authorization:t,XCosSecurityToken:o.options.XCosSecurityToken};return r(i),i}();o.options.getSTS.call(o,{Bucket:i,Region:a},function(e){u=e||{},u.Scope=l,u.ScopeKey=p,u.TmpSecretId=u.SecretId,u.TmpSecretKey=u.SecretKey,o._StsCache.push(u),h()})}return""}function Z(e){var t=!1,n=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var o=e.error.Code,i=e.error.Message;("RequestTimeTooSkewed"===o||"AccessDenied"===o&&"Request has expired"===i)&&(n=!0)}catch(e){}if(e)if(n&&r){var a=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(oe.getSkewTime(this.options.SystemClockOffset)-a)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=a-Date.now(),t=!0)}else 5===Math.round(e.statusCode/100)&&(t=!0);return t}function ee(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=oe.clearKey(e.qs),e.headers&&(e.headers=oe.clearKey(e.headers)),e.qs&&(e.qs=oe.clearKey(e.qs));var r=oe.clone(e.qs);e.action&&(r[e.action]="");var o=function(i){var a=n.options.SystemClockOffset;Y.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:r,Headers:e.headers,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope},function(r,s){if(r)return void t(r);e.AuthData=s,te.call(n,e,function(r,s){r&&i<2&&(a!==n.options.SystemClockOffset||Z.call(n,r))?(e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,delete e.headers["x-cos-security-token"]),o(i+1)):t(r,s)})})};o(1)}function te(e,t){var n=this,r=e.TaskId;if(!r||n._isRunningTask(r)){var o=e.Bucket,i=e.Region,a=e.Key,s=e.method||"GET",c=e.url,u=e.body,l=e.json,d=e.rawBody;c=c||J({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:o,region:i,object:a}),e.action&&(c=c+"?"+e.action);var f={method:s,url:c,headers:e.headers,qs:e.qs,body:u,json:l};if(f.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(f.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(f.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(f.headers.clientUA=e.AuthData.ClientUA),e.AuthData.XCosSecurityToken&&(f.headers["x-cos-security-token"]=e.AuthData.XCosSecurityToken),f.headers&&(f.headers=oe.clearKey(f.headers)),f=oe.clearKey(f),e.onProgress&&"function"==typeof e.onProgress){var p=u&&(u.size||u.length)||0;f.onProgress=function(t){if(!r||n._isRunningTask(r)){var o=t?t.loaded:0;e.onProgress({loaded:o,total:p})}}}this.options.Timeout&&(f.timeout=this.options.Timeout),n.emit("before-send",f);var h=re(f,function(e,o,i){if("abort"!==e){var a,s=function(e,i){if(r&&n.off("inner-kill-task",g),!a){a=!0;var s={};o&&o.statusCode&&(s.statusCode=o.statusCode),o&&o.headers&&(s.headers=o.headers),e?(e=oe.extend(e||{},s),t(e,null)):(i=oe.extend(i||{},s),t(null,i)),h=null}};if(e)return void s({error:e});var c;if(d)c={},c.body=i;else try{c=i&&i.indexOf("<")>-1&&i.indexOf(">")>-1&&oe.xml2json(i)||{}}catch(e){c=i||{}}var u=o.statusCode;return 2===Math.floor(u/100)?c.Error?void s({error:c.Error}):void s(null,c):void s({error:c.Error||c})}}),g=function(e){e.TaskId===r&&(h&&h.abort&&h.abort(),n.off("inner-kill-task",g))};r&&n.on("inner-kill-task",g)}}function ne(e,t,n){oe.each(["Cors","Acl"],function(r){if(e.slice(-r.length)===r){var o=e.slice(0,-r.length)+r.toUpperCase(),i=oe.apiWrapper(e,t),a=!1;n[o]=function(){!a&&console.warn("warning: cos."+o+" has been deprecated. Please Use cos."+e+" instead."),a=!0,i.apply(this,arguments)}}})}var re=n(13),oe=n(0),ie={headBucket:r,getBucket:o,deleteBucket:i,putBucketAcl:a,getBucketAcl:s,putBucketCors:c,getBucketCors:u,deleteBucketCors:l,getBucketLocation:d,getBucketPolicy:p,putBucketPolicy:f,deleteBucketPolicy:h,putBucketTagging:g,getBucketTagging:m,deleteBucketTagging:y,putBucketLifecycle:v,getBucketLifecycle:C,deleteBucketLifecycle:b,putBucketVersioning:x,getBucketVersioning:k,putBucketReplication:S,getBucketReplication:T,deleteBucketReplication:w,putBucketWebsite:R,getBucketWebsite:A,deleteBucketWebsite:E,getObject:_,headObject:B,listObjectVersions:N,putObject:P,deleteObject:D,getObjectAcl:I,putObjectAcl:O,optionsObject:M,putObjectCopy:L,deleteMultipleObject:U,restoreObject:H,uploadPartCopy:j,multipartInit:F,multipartUpload:K,multipartComplete:z,multipartList:q,multipartListPart:G,multipartAbort:W,getObjectUrl:X,getAuth:V};e.exports.init=function(e,t){t.transferToTaskMethod(ie,"putObject"),oe.each(ie,function(t,n){e.prototype[n]=oe.apiWrapper(n,t),ne(n,t,e.prototype)})}},function(e,t,n){var r=n(14),o=function(){function e(e){var t=e.length,n=E.type(e);return"function"!==n&&!E.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e))}function t(e){var t=L[e]={};return E.each(e.match(M)||[],function(e,n){t[n]=!0}),t}function n(){I.addEventListener?(I.removeEventListener("DOMContentLoaded",r,!1),window.removeEventListener("load",r,!1)):(I.detachEvent("onreadystatechange",r),window.detachEvent("onload",r))}function r(){(I.addEventListener||"load"===event.type||"complete"===I.readyState)&&(n(),E.ready())}function o(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(F,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:H.test(n)?E.parseJSON(n):n)}catch(e){}E.data(e,t,n)}else n=void 0}return n}function i(e){var t;for(t in e)if(("data"!==t||!E.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function a(e,t,n,r){if(E.acceptData(e)){var o,i,a=E.expando,s=e.nodeType,c=s?E.cache:e,u=s?e[a]:e[a]&&a;if(u&&c[u]&&(r||c[u].data)||void 0!==n||"string"!=typeof t)return u||(u=s?e[a]=v.pop()||E.guid++:a),c[u]||(c[u]=s?{}:{toJSON:E.noop}),"object"!=typeof t&&"function"!=typeof t||(r?c[u]=E.extend(c[u],t):c[u].data=E.extend(c[u].data,t)),i=c[u],r||(i.data||(i.data={}),i=i.data),void 0!==n&&(i[E.camelCase(t)]=n),"string"==typeof t?null==(o=i[t])&&(o=i[E.camelCase(t)]):o=i,o}}function s(e,t,n){if(E.acceptData(e)){var r,o,a=e.nodeType,s=a?E.cache:e,c=a?e[E.expando]:E.expando;if(s[c]){if(t&&(r=n?s[c]:s[c].data)){E.isArray(t)?t=t.concat(E.map(t,E.camelCase)):t in r?t=[t]:(t=E.camelCase(t),t=t in r?[t]:t.split(" ")),o=t.length;for(;o--;)delete r[t[o]];if(n?!i(r):!E.isEmptyObject(r))return}(n||(delete s[c].data,i(s[c])))&&(a?E.cleanData([e],!0):R.deleteExpando||s!=s.window?delete s[c]:s[c]=null)}}}function c(){return!0}function u(){return!1}function l(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(M)||[];if(E.isFunction(n))for(;r=i[o++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function d(e,t,n,r){function o(s){var c;return i[s]=!0,E.each(e[s]||[],function(e,s){var u=s(t,n,r);return"string"!=typeof u||a||i[u]?a?!(c=u):void 0:(t.dataTypes.unshift(u),o(u),!1)}),c}var i={},a=e===ae;return o(t.dataTypes[0])||!i["*"]&&o("*")}function f(e,t){var n,r,o=E.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((o[r]?e:n||(n={}))[r]=t[r]);return n&&E.extend(!0,e,n),e}function p(e,t,n){for(var r,o,i,a,s=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),void 0===o&&(o=e.mimeType||t.getResponseHeader("Content-Type"));if(o)for(a in s)if(s[a]&&s[a].test(o)){c.unshift(a);break}if(c[0]in n)i=c[0];else{for(a in n){if(!c[0]||e.converters[a+" "+c[0]]){i=a;break}r||(r=a)}i=i||r}if(i)return i!==c[0]&&c.unshift(i),n[i]}function h(e,t,n,r){var o,i,a,s,c,u={},l=e.dataTypes.slice();if(l[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];for(i=l.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!c&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=i,i=l.shift())if("*"===i)i=c;else if("*"!==c&&c!==i){if(!(a=u[c+" "+i]||u["* "+i]))for(o in u)if(s=o.split(" "),s[1]===i&&(a=u[c+" "+s[0]]||u["* "+s[0]])){!0===a?a=u[o]:!0!==u[o]&&(i=s[0],l.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+c+" to "+i}}}return{state:"success",data:t}}function g(e,t,n,r){var o;if(E.isArray(t))E.each(t,function(t,o){n||ue.test(e)?r(e,o):g(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==E.type(t))r(e,t);else for(o in t)g(e+"["+o+"]",t[o],n,r)}function m(){try{return new window.XMLHttpRequest}catch(e){}}function y(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}var v=[],C=v.slice,b=v.concat,x=v.push,k=v.indexOf,S={},T=S.toString,w=S.hasOwnProperty,R={},A="1.11.1 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset,-deprecated,-event-alias,-wrap",E=function(e,t){return new E.fn.init(e,t)},B=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^-ms-/,_=/-([\da-z])/gi,P=function(e,t){return t.toUpperCase()};E.fn=E.prototype={jquery:A,constructor:E,selector:"",length:0,toArray:function(){return C.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:C.call(this)},pushStack:function(e){var t=E.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return E.each(this,e,t)},map:function(e){return this.pushStack(E.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(C.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==E.type(e)||e.nodeType||E.isWindow(e))return!1;try{if(e.constructor&&!w.call(e,"constructor")&&!w.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(R.ownLast)for(t in e)return w.call(e,t);for(t in e);return void 0===t||w.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?S[T.call(e)]||"object":typeof e},globalEval:function(e){e&&E.trim(e)&&(window.execScript||function(e){window.eval.call(window,e)})(e)},camelCase:function(e){return e.replace(N,"ms-").replace(_,P)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(t,n,r){var o=0,i=t.length,a=e(t);if(r){if(a)for(;o)[^>]*|#([\w-]*))$/;(E.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:O.exec(e))||!n[1]&&t)return!t||t.jquery?(t||D).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof E?t[0]:t,E.merge(this,E.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:I,!0)),rsingleTag.test(n[1])&&E.isPlainObject(t))for(n in t)E.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((r=I.getElementById(n[2]))&&r.parentNode){if(r.id!==n[2])return D.find(e);this.length=1,this[0]=r}return this.context=I,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):E.isFunction(e)?void 0!==D.ready?D.ready(e):e(E):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),E.makeArray(e,this))}).prototype=E.fn,D=E(I);var M=/\S+/g,L={};E.Callbacks=function(e){e="string"==typeof e?L[e]||t(e):E.extend({},e);var n,r,o,i,a,s,c=[],u=!e.once&&[],l=function(t){for(r=e.memory&&t,o=!0,a=s||0,s=0,i=c.length,n=!0;c&&a-1;)c.splice(r,1),n&&(r<=i&&i--,r<=a&&a--)}),this},has:function(e){return e?E.inArray(e,c)>-1:!(!c||!c.length)},empty:function(){return c=[],i=0,this},disable:function(){return c=u=r=void 0,this},disabled:function(){return!c},lock:function(){return u=void 0,r||d.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!c||o&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):l(t)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!o}};return d},E.extend({Deferred:function(e){var t=[["resolve","done",E.Callbacks("once memory"),"resolved"],["reject","fail",E.Callbacks("once memory"),"rejected"],["notify","progress",E.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return E.Deferred(function(n){E.each(t,function(t,i){var a=E.isFunction(e[t])&&e[t];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&E.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?E.extend(e,r):r}},o={};return r.pipe=r.then,E.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=C.call(arguments),a=i.length,s=1!==a||e&&E.isFunction(e.promise)?a:0,c=1===s?e:E.Deferred(),u=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?C.call(arguments):o,r===t?c.notifyWith(n,r):--s||c.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);o0||(j.resolveWith(I,[E]),E.fn.triggerHandler&&(E(I).triggerHandler("ready"),E(I).off("ready")))}}}),E.ready.promise=function(e){if(!j)if(j=E.Deferred(),"complete"===I.readyState)setTimeout(E.ready);else if(I.addEventListener)I.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1);else{I.attachEvent("onreadystatechange",r),window.attachEvent("onload",r);var t=!1;try{t=null==window.frameElement&&I.documentElement}catch(e){}t&&t.doScroll&&function e(){if(!E.isReady){try{t.doScroll("left")}catch(t){return setTimeout(e,50)}n(),E.ready()}}()}return j.promise(e)};var U;for(U in E(R))break;R.ownLast="0"!==U,R.inlineBlockNeedsLayout=!1,E(function(){var e,t,n,r;(n=I.getElementsByTagName("body")[0])&&n.style&&(t=I.createElement("div"),r=I.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),void 0!==t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",R.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=I.createElement("div");if(null==R.deleteExpando){R.deleteExpando=!0;try{delete e.test}catch(e){R.deleteExpando=!1}}e=null}(),E.acceptData=function(e){var t=E.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||!0!==t&&e.getAttribute("classid")===t)};var H=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,F=/([A-Z])/g;E.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return!!(e=e.nodeType?E.cache[e[E.expando]]:e[E.expando])&&!i(e)},data:function(e,t,n){return a(e,t,n)},removeData:function(e,t){return s(e,t)},_data:function(e,t,n){return a(e,t,n,!0)},_removeData:function(e,t){return s(e,t,!0)}}),E.fn.extend({data:function(e,t){var n,r,i,a=this[0],s=a&&a.attributes;if(void 0===e){if(this.length&&(i=E.data(a),1===a.nodeType&&!E._data(a,"parsedAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=E.camelCase(r.slice(5)),o(a,r,i[r])));E._data(a,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){E.data(this,e)}):arguments.length>1?this.each(function(){E.data(this,e,t)}):a?o(a,e,E.data(a,e)):void 0},removeData:function(e){return this.each(function(){E.removeData(this,e)})}}),E.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=E._data(e,t),n&&(!r||E.isArray(n)?r=E._data(e,t,E.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=E.queue(e,t),r=n.length,o=n.shift(),i=E._queueHooks(e,t),a=function(){E.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return E._data(e,n)||E._data(e,n,{empty:E.Callbacks("once memory").add(function(){E._removeData(e,t+"queue"),E._removeData(e,n)})})}}),E.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length=0&&(p=f.split("."),f=p.shift(),p.sort()),i=f.indexOf(":")<0&&"on"+f,e=e[E.expando]?e:new E.Event(f,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:E.makeArray(t,[e]),c=E.event.special[f]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!E.isWindow(n)){for(s=c.delegateType||f,G.test(s+f)||(a=a.parentNode);a;a=a.parentNode)d.push(a),u=a;u===(n.ownerDocument||I)&&d.push(u.defaultView||u.parentWindow||window)}for(l=0;(a=d[l++])&&!e.isPropagationStopped();)e.type=l>1?s:c.bindType||f,o=(E._data(a,"events")||{})[e.type]&&E._data(a,"handle"),o&&o.apply(a,t),(o=i&&a[i])&&o.apply&&E.acceptData(a)&&(e.result=o.apply(a,t),!1===e.result&&e.preventDefault());if(e.type=f,!r&&!e.isDefaultPrevented()&&(!c._default||!1===c._default.apply(d.pop(),t))&&E.acceptData(n)&&i&&n[f]&&!E.isWindow(n)){u=n[i],u&&(n[i]=null),E.event.triggered=f;try{n[f]()}catch(e){}E.event.triggered=void 0,u&&(n[i]=u)}return e.result}},dispatch:function(e){e=E.event.fix(e);var t,n,r,o,i,a=[],s=C.call(arguments),c=(E._data(this,"events")||{})[e.type]||[],u=E.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!u.preDispatch||!1!==u.preDispatch.call(this,e)){for(a=E.event.handlers.call(this,e,c),t=0;(o=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,i=0;(r=o.handlers[i++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(r.namespace)||(e.handleObj=r,e.data=r.data,void 0!==(n=((E.event.special[r.origType]||{}).handle||r.handler).apply(o.elem,s))&&!1===(e.result=n)&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,o,i,a=[],s=t.delegateCount,c=e.target;if(s&&c.nodeType&&(!e.button||"click"!==e.type))for(;c!=this;c=c.parentNode||this)if(1===c.nodeType&&(!0!==c.disabled||"click"!==e.type)){for(o=[],i=0;i=0:E.find(n,this,null,[c]).length),o[n]&&o.push(r);o.length&&a.push({elem:c,handlers:o})}return s0?4:0,o=e>=200&&e<300||304===e,n&&(b=p(f,T,n)),b=h(f,b,T,o),o?(f.ifModified&&(x=T.getResponseHeader("Last-Modified"),x&&(E.lastModified[i]=x),(x=T.getResponseHeader("etag"))&&(E.etag[i]=x)),204===e||"HEAD"===f.type?S="nocontent":304===e?S="notmodified":(S=b.state,l=b.data,d=b.error,o=!d)):(d=S,!e&&S||(S="error",e<0&&(e=0))),T.status=e,T.statusText=(t||S)+"",o?y.resolveWith(g,[l,S,T]):y.rejectWith(g,[T,S,d]),T.statusCode(C),C=void 0,c&&m.trigger(o?"ajaxSuccess":"ajaxError",[T,f,o?l:d]),v.fireWith(g,[T,S]),c&&(m.trigger("ajaxComplete",[T,f]),--E.active||E.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,o,i,a,s,c,u,l,f=E.ajaxSetup({},t),g=f.context||f,m=f.context&&(g.nodeType||g.jquery)?E(g):E.event,y=E.Deferred(),v=E.Callbacks("once memory"),C=f.statusCode||{},b={},x={},k=0,S="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===k){if(!l)for(l={};t=ee.exec(a);)l[t[1].toLowerCase()]=t[2];t=l[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===k?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return k||(e=x[n]=x[n]||e,b[e]=t),this},overrideMimeType:function(e){return k||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(k<2)for(t in e)C[t]=[C[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||S;return u&&u.abort(t),n(0,t),this}};if(y.promise(T).complete=v.add,T.success=T.done,T.error=T.fail,f.url=((e||f.url||J)+"").replace(Y,"").replace(re,Q[1]+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=E.trim(f.dataType||"*").toLowerCase().match(M)||[""],null==f.crossDomain&&(r=oe.exec(f.url.toLowerCase()),f.crossDomain=!(!r||r[1]===Q[1]&&r[2]===Q[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(Q[3]||("http:"===Q[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=E.param(f.data,f.traditional)),d(ie,f,t,T),2===k)return T;c=f.global,c&&0==E.active++&&E.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!ne.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(X.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=Z.test(i)?i.replace(Z,"$1_="+V++):i+(X.test(i)?"&":"?")+"_="+V++)),f.ifModified&&(E.lastModified[i]&&T.setRequestHeader("If-Modified-Since",E.lastModified[i]),E.etag[i]&&T.setRequestHeader("If-None-Match",E.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&T.setRequestHeader("Content-Type",f.contentType);for(o in f.headers)T.setRequestHeader(o,f.headers[o]);if(f.beforeSend&&(!1===f.beforeSend.call(g,T,f)||2===k))return T.abort();S="abort";for(o in{success:1,error:1,complete:1})T[o](f[o]);if(u=d(ae,f,t,T)){T.readyState=1,c&&m.trigger("ajaxSend",[T,f]),f.async&&f.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},f.timeout));try{k=1,u.send(b,n)}catch(e){if(!(k<2))throw e;n(-1,e)}}else n(-1,"No Transport");return T},getJSON:function(e,t,n){return E.get(e,t,n,"json")},getScript:function(e,t){return E.get(e,void 0,t,"script")}}),E.each(["get","post"],function(e,t){E[t]=function(e,n,r,o){return E.isFunction(n)&&(o=o||r,r=n,n=void 0),E.ajax({url:e,type:t,dataType:o,data:n,success:r})}}),E.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){E.fn[t]=function(e){return this.on(t,e)}}),E._evalUrl=function(e){return E.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})};var ce=/%20/g,ue=/\[\]$/,le=/\r?\n/g,de=/^(?:submit|button|image|reset|file)$/i,fe=/^(?:input|select|textarea|keygen)/i;E.param=function(e,t){var n,r=[],o=function(e,t){t=E.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=E.ajaxSettings&&E.ajaxSettings.traditional),E.isArray(e)||e.jquery&&!E.isPlainObject(e))E.each(e,function(){o(this.name,this.value)});else for(n in e)g(n,e[n],t,o);return r.join("&").replace(ce,"+")},E.fn.extend({serialize:function(){return E.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=E.prop(this,"elements");return e?E.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!E(this).is(":disabled")&&fe.test(this.nodeName)&&!de.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=E(this).val();return null==n?null:E.isArray(n)?E.map(n,function(e){return{name:t.name,value:e.replace(le,"\r\n")}}):{name:t.name,value:n.replace(le,"\r\n")}}).get()}}),E.ajaxSettings.xhr=void 0!==window.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&m()||y()}:m;var pe=0,he={},ge=E.ajaxSettings.xhr();window.ActiveXObject&&E(window).on("unload",function(){for(var e in he)he[e](void 0,!0)}),R.cors=!!ge&&"withCredentials"in ge,ge=R.ajax=!!ge,ge&&E.ajaxTransport(function(e){if(!e.crossDomain||R.cors){var t;return{send:function(n,r){var o,i=e.xhr(),a=++pe;if(i.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)i[o]=e.xhrFields[o];e.mimeType&&i.overrideMimeType&&i.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(o in n)void 0!==n[o]&&i.setRequestHeader(o,n[o]+"");i.upload&&e.progress&&(i.upload.onprogress=e.progress),i.send(e.hasContent&&(e.body||e.data)||null),t=function(n,o){var s,c,u;if(t&&(o||4===i.readyState))if(delete he[a],t=void 0,i.onreadystatechange=E.noop,o)4!==i.readyState&&i.abort();else{u={},s=i.status,"string"==typeof i.responseText&&(u.text=i.responseText);try{c=i.statusText}catch(e){c=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=u.text?200:404}u&&r(s,c,u,i.getAllResponseHeaders())},e.async?4===i.readyState?setTimeout(t):i.onreadystatechange=he[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),E.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return E.globalEval(e),e}}}),E.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),E.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=I.head||E("head")[0]||I.documentElement;return{send:function(r,o){t=I.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||o(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var me=[],ye=/(=)\?(?=&|$)|\?\?/;return E.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=me.pop()||E.expando+"_"+V++;return this[e]=!0,e}}),E.ajaxPrefilter("json jsonp",function(e,t,n){var r,o,i,a=!1!==e.jsonp&&(ye.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ye.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=E.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(ye,"$1"+r):!1!==e.jsonp&&(e.url+=(X.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return i||E.error(r+" was not called"),i[0]},e.dataTypes[0]="json",o=window[r],window[r]=function(){i=arguments},n.always(function(){window[r]=o,e[r]&&(e.jsonpCallback=t.jsonpCallback,me.push(r)),i&&E.isFunction(o)&&o(i[0]),i=o=void 0}),"script"}),E.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||I;var r=rsingleTag.exec(e),o=!n&&[];return r?[t.createElement(r[1])]:(r=E.buildFragment([e],t,o),o&&o.length&&E(o).remove(),E.merge([],r.childNodes))},E}(),i=function(e,t){if(e=o.extend(!0,{headers:{},qs:{}},e),e.type=e.method,delete e.method,e.onProgress&&(e.progress=e.onProgress,delete e.onProgress),e.qs){var n=r.stringify(e.qs);n&&(e.url+=(-1===e.url.indexOf("?")?"?":"&")+n),delete e.qs}if(e.json&&(e.data=e.body,delete e.json,delete e.body,!e.headers&&(e.headers={}),e.headers["Content-Type"]="application/json"),e.body&&(e.body instanceof Blob||"[object File]"===e.body.toString()||"[object Blob]"===e.body.toString()||(e.data=e.body,delete e.body)),e.headers){var i=e.headers;delete e.headers,e.beforeSend=function(e){for(var t in i)i.hasOwnProperty(t)&&"content-length"!==t.toLowerCase()&&"user-agent"!==t.toLowerCase()&&"origin"!==t.toLowerCase()&&"host"!==t.toLowerCase()&&e.setRequestHeader(t,i[t])}}var a=function(e){var t={};return e.getAllResponseHeaders().trim().split("\n").forEach(function(e){if(e){var n=e.indexOf(":"),r=e.substr(0,n).trim().toLowerCase(),o=e.substr(n+1).trim();t[r]=o}}),{statusCode:e.status,statusMessage:e.statusText,headers:t}};return e.success=function(e,n,r){t(null,a(r),e)},e.error=function(e){e.responseText?t(null,a(e),e.responseText):t(e.statusText,a(e),e.responseText)},e.dataType="text",o.ajax(e)};e.exports=i},function(e,t,n){"use strict";t.decode=t.parse=n(15),t.encode=t.stringify=n(16)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var c=1e3;i&&"number"==typeof i.maxKeys&&(c=i.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var l=0;l=0?(d=g.substr(0,m),f=g.substr(m+1)):(d=g,f=""),p=decodeURIComponent(d),h=decodeURIComponent(f),r(a,p)?o(a[p])?a[p].push(h):a[p]=[a[p],h]:a[p]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=0;r--)C[r][0]===e&&C[r][1]===t&&C.splice(r,1);C.unshift([e,t]);var i=this.options.UploadIdCacheLimit;C.length>i&&C.splice(i),i&&setTimeout(function(){try{localStorage.setItem(T,JSON.stringify(C))}catch(e){}})}function a(e){o.call(this),delete S[e];for(var t=C.length-1;t>=0;t--)C[t][1]===e&&C.splice(t,1);var n=this.options.UploadIdCacheLimit;C.length>n&&C.splice(n),n&&setTimeout(function(){try{C.length?localStorage.setItem(T,JSON.stringify(C)):localStorage.removeItem(T)}catch(e){}})}function s(e){o.call(this);for(var t=[],n=0;ng)return t(null,!1);if(n>1){if(Math.max(e[0].Size,e[1].Size)!==h)return t(null,!1)}var r=function(o){if(o=c.length)return void w.emit("has_upload_id",t);var s=c[e];return k.isInArray(t,s)?S[s]?void f(e+1):void l.call(d,{Bucket:r,Region:o,Key:i,UploadId:s},function(t,r){d._isRunningTask(n)&&(t?(a.call(d,s),f(e+1)):w.emit("upload_id_ready",{UploadId:s,PartList:r.PartList}))}):(a.call(d,s),void f(e+1))};f(0)}else w.emit("has_upload_id",t)}),w.on("get_remote_upload_id_list",function(t){u.call(d,{Bucket:r,Region:o,Key:i},function(t,r){if(d._isRunningTask(n)){if(t)return w.emit("error",t);var o=k.filter(r.UploadList,function(e){return e.Key===i&&(!c||e.StorageClass.toUpperCase()===c.toUpperCase())}).reverse().map(function(e){return e.UploadId||e.UploadID});if(o.length)w.emit("seek_local_avail_upload_id",o);else{var u,l=k.getFileUUID(e.Body,e.ChunkSize);l&&(u=s.call(d,l))&&k.each(u,function(e){a.call(d,e)}),w.emit("no_available_upload_id")}}})}),w.emit("get_remote_upload_id_list")}function u(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key},i=function(){n.multipartList(o,function(e,n){if(e)return t(e);r.push.apply(r,n.Upload||[]),"true"===n.IsTruncated?(o.KeyMarker=n.NextKeyMarker,o.UploadIdMarker=n.NextUploadIdMarker,i()):t(null,{UploadList:r})})};i()}function l(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId},i=function(){n.multipartListPart(o,function(e,n){if(e)return t(e);r.push.apply(r,n.Part||[]),"true"===n.IsTruncated?(o.PartNumberMarker=n.NextPartNumberMarker,i()):t(null,{PartList:r})})};i()}function d(e,t){var n=this,r=e.TaskId,o=e.Bucket,i=e.Region,a=e.Key,s=e.UploadData,c=e.FileSize,u=e.SliceSize,l=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),d=e.Body,p=Math.ceil(c/u),h=0,g=e.ServerSideEncryption,m=k.filter(s.PartList,function(e){return e.Uploaded&&(h+=e.PartNumber>=p?c%u||u:u),!e.Uploaded}),y=e.onProgress;b.eachLimit(m,l,function(e,t){if(n._isRunningTask(r)){var l=e.PartNumber,p=Math.min(c,e.PartNumber*u)-(e.PartNumber-1)*u,m=0;f.call(n,{TaskId:r,Bucket:o,Region:i,Key:a,SliceSize:u,FileSize:c,PartNumber:l,ServerSideEncryption:g,Body:d,UploadData:s,onProgress:function(e){h+=e.loaded-m,m=e.loaded,y({loaded:h,total:c})}},function(o,i){n._isRunningTask(r)&&(!k.isBrowser||o||i.ETag||(o='get ETag error, please add "ETag" to CORS ExposeHeader setting.'),o?h-=m:(h+=p-m,e.ETag=i.ETag),t(o||null,i))})}},function(e){if(n._isRunningTask(r))return e?t(e):void t(null,{UploadId:s.UploadId,SliceList:s.PartList})})}function f(e,t){var n=this,r=e.TaskId,o=e.Bucket,i=e.Region,a=e.Key,s=e.FileSize,c=e.Body,u=1*e.PartNumber,l=e.SliceSize,d=e.ServerSideEncryption,f=e.UploadData,p=n.options.ChunkRetryTimes+1,h=l*(u-1),g=l,m=h+l;m>s&&(m=s,g=m-h);var y=f.PartList[u-1];b.retry(p,function(t){n._isRunningTask(r)&&k.fileSlice(c,h,m,!0,function(s){n.multipartUpload({TaskId:r,Bucket:o,Region:i,Key:a,ContentLength:g,PartNumber:u,UploadId:f.UploadId,ServerSideEncryption:d,Body:s,onProgress:e.onProgress},function(e,o){if(n._isRunningTask(r))return e?t(e):(y.Uploaded=!0,t(null,o))})})},function(e,o){if(n._isRunningTask(r))return t(e,o)})}function p(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,a=e.SliceList,s=this,c=this.options.ChunkRetryTimes+1,u=a.map(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}});b.retry(c,function(e){s.multipartComplete({Bucket:n,Region:r,Key:o,UploadId:i,Parts:u},e)},function(e,n){t(e,n)})}function h(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,a=e.Level||"task",s=e.AsyncLimit,c=this,l=new x;if(l.on("error",function(e){return t(e)}),l.on("get_abort_array",function(i){g.call(c,{Bucket:n,Region:r,Key:o,Headers:e.Headers,AsyncLimit:s,AbortArray:i},function(e,n){if(e)return t(e);t(null,n)})}),"bucket"===a)u.call(c,{Bucket:n,Region:r},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])});else if("file"===a){if(!o)return t({error:"abort_upload_task_no_key"});u.call(c,{Bucket:n,Region:r,Key:o},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])})}else{if("task"!==a)return t({error:"abort_unknown_level"});if(!i)return t({error:"abort_upload_task_no_id"});if(!o)return t({error:"abort_upload_task_no_key"});l.emit("get_abort_array",[{Key:o,UploadId:i}])}}function g(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.AbortArray,a=e.AsyncLimit||1,s=this,c=0,u=new Array(i.length);b.eachLimit(i,a,function(t,i){var a=c;if(o&&o!==t.Key)return u[a]={error:{KeyNotMatch:!0}},void i(null);var l=t.UploadId||t.UploadID;s.multipartAbort({Bucket:n,Region:r,Key:t.Key,Headers:e.Headers,UploadId:l},function(e,o){var s={Bucket:n,Region:r,Key:t.Key,UploadId:l};u[a]={error:e,task:s},i(null)}),c++},function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=u.length;o=r?"sliceUploadFile":"putObject";d.push({api:v,params:e,callback:y})}()}),n._addTasks(d)}function y(e,t){var n=new x,r=this,o=e.Bucket,i=e.Region,a=e.Key,s=e.CopySource,c=s.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!c)return void t({error:"CopySource format error"});var u=c[1],l=c[3],d=decodeURIComponent(c[4]),f=void 0===e.CopySliceSize?r.options.CopySliceSize:e.CopySliceSize;f=Math.max(0,f);var p,h,g=e.CopyChunkSize||this.options.CopyChunkSize,m=this.options.CopyChunkParallelLimit,y=0;n.on("copy_slice_complete",function(e){r.multipartComplete({Bucket:o,Region:i,Key:a,UploadId:e.UploadId,Parts:e.PartList},function(e,n){if(e)return h(null,!0),t(e);h({loaded:p,total:p},!0),t(null,n)})}),n.on("get_copy_data_finish",function(e){b.eachLimit(e.PartList,m,function(t,n){var c=t.PartNumber,u=t.CopySourceRange,l=t.end-t.start,d=0;v.call(r,{Bucket:o,Region:i,Key:a,CopySource:s,UploadId:e.UploadId,PartNumber:c,CopySourceRange:u,onProgress:function(e){y+=e.loaded-d,d=e.loaded,h({loaded:y,total:p})}},function(e,r){if(e)return n(e);h({loaded:y,total:p}),y+=l-d,t.ETag=r.ETag,n(e||null,r)})},function(r){if(r)return h(null,!0),t(r);n.emit("copy_slice_complete",e)})}),n.on("get_file_size_finish",function(s){!function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o"x-cos-meta-".length&&(s[t]=e)}),n.emit("get_file_size_finish",s)}})}function v(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,i=e.Key,a=e.CopySource,s=e.UploadId,c=1*e.PartNumber,u=e.CopySourceRange,l=this.options.ChunkRetryTimes+1,d=this;b.retry(l,function(t){d.uploadPartCopy({TaskId:n,Bucket:r,Region:o,Key:i,CopySource:a,UploadId:s,PartNumber:c,CopySourceRange:u,onProgress:e.onProgress},function(e,n){t(e||null,n)})},function(e,n){return t(e,n)})}var C,b=n(18),x=n(2).EventProxy,k=n(0),S={},T="cos_sdk_upload_cache",w={sliceUploadFile:r,abortUploadTask:h,uploadFiles:m,sliceCopyFile:y};e.exports.init=function(e,t){t.transferToTaskMethod(w,"sliceUploadFile"),k.each(w,function(t,n){e.prototype[n]=k.apiWrapper(n,t)})}},function(e,t){var n=function(e,t,n,r){if(r=r||function(){},!e.length||t<=0)return r();var o=0,i=0,a=0;!function s(){if(o>=e.length)return r();for(;a=e.length?r():s())})}()},r=function(e,t,n){var r=function(o){t(function(t,i){t&&o 0 && (WebsiteConfiguration.RoutingRules = { RoutingRule: RoutingRules }); + var xml = util.json2xml({ WebsiteConfiguration: WebsiteConfiguration }); + + var headers = params.Headers; + headers['Content-Type'] = 'application/xml'; + headers['Content-MD5'] = util.binaryBase64(util.md5(xml)); + + submitRequest.call(this, { + Action: 'name/cos:PutBucketWebsite', + method: 'PUT', + Bucket: params.Bucket, + Region: params.Region, + body: xml, + action: 'website', + headers: headers, + }, function (err, data) { + if (err && err.statusCode === 204) { + return callback(null, {statusCode: err.statusCode}); + } else if (err) { + return callback(err); + } + callback(null, { + statusCode: data.statusCode, + headers: data.headers, + }); + }); +} + +/** + * 获取 Bucket 的静态网站配置信息 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回数据 + */ +function getBucketWebsite(params, callback) { + + submitRequest.call(this, { + Action: 'name/cos:GetBucketWebsite', + method: 'GET', + Bucket: params.Bucket, + Region: params.Region, + Key: params.Key, + headers: params.Headers, + action: 'website', + }, function (err, data) { + if (err) { + if(err.statusCode === 404 && err.error.Code === 'NoSuchWebsiteConfiguration'){ + var result = { + WebsiteConfiguration: {}, + statusCode: err.statusCode, + }; + err.headers && (result.headers = err.headers); + callback(null, result); + } else { + callback(err); + } + return; + } + + var WebsiteConfiguration = data.WebsiteConfiguration || {}; + if (WebsiteConfiguration['RoutingRules']) { + var RoutingRules = util.clone(WebsiteConfiguration['RoutingRules'].RoutingRule || []); + RoutingRules = util.makeArray(RoutingRules); + WebsiteConfiguration.RoutingRules = RoutingRules; + } + + callback(null, { + WebsiteConfiguration: WebsiteConfiguration, + statusCode: data.statusCode, + headers: data.headers, + }); + }); +} + +/** + * 删除 Bucket 的静态网站配置 + * @param {Object} params 参数对象,必须 + * @param {String} params.Bucket Bucket名称,必须 + * @param {String} params.Region 地域名称,必须 + * @param {Function} callback 回调函数,必须 + * @return {Object} err 请求失败的错误,如果请求成功,则为空。https://cloud.tencent.com/document/product/436/7730 + * @return {Object} data 返回数据 + */ +function deleteBucketWebsite(params, callback) { + + submitRequest.call(this, { + Action: 'name/cos:DeleteBucketWebsite', + method: 'DELETE', + Bucket: params.Bucket, + Region: params.Region, + headers: params.Headers, + action: 'website', + }, function (err, data) { + if (err && err.statusCode === 204) { + return callback(null, {statusCode: err.statusCode}); + } else if (err) { + return callback(err); + } + callback(null, { + statusCode: data.statusCode, + headers: data.headers, + }); + }); +} + // Object 相关 /** @@ -1480,7 +1613,7 @@ function multipartInit(params, callback) { // 特殊处理 Cache-Control !headers['Cache-Control'] && (headers['Cache-Control'] = ''); - util.getBodyMd5(params.UploadAddMetaMd5 || self.options.UploadAddMetaMd5, params.Body, function (md5) { + util.getBodyMd5(params.Body && (params.UploadAddMetaMd5 || self.options.UploadAddMetaMd5), params.Body, function (md5) { if (md5) params.Headers['x-cos-meta-md5'] = md5; submitRequest.call(self, { Action: 'name/cos:InitiateMultipartUpload', @@ -2367,29 +2500,32 @@ function _submitRequest(params, callback) { var API_MAP = { // Bucket 相关方法 + headBucket: headBucket, // Bucket getBucket: getBucket, - headBucket: headBucket, deleteBucket: deleteBucket, + putBucketAcl: putBucketAcl, // BucketACL getBucketAcl: getBucketAcl, - putBucketAcl: putBucketAcl, + putBucketCors: putBucketCors, // BucketCors getBucketCors: getBucketCors, - putBucketCors: putBucketCors, deleteBucketCors: deleteBucketCors, - getBucketLocation: getBucketLocation, - putBucketTagging: putBucketTagging, - getBucketTagging: getBucketTagging, - deleteBucketTagging: deleteBucketTagging, - getBucketPolicy: getBucketPolicy, + getBucketLocation: getBucketLocation, // BucketLocation + getBucketPolicy: getBucketPolicy, // BucketPolicy putBucketPolicy: putBucketPolicy, deleteBucketPolicy: deleteBucketPolicy, + putBucketTagging: putBucketTagging, // BucketTagging + getBucketTagging: getBucketTagging, + deleteBucketTagging: deleteBucketTagging, + putBucketLifecycle: putBucketLifecycle, // BucketLifecycle getBucketLifecycle: getBucketLifecycle, - putBucketLifecycle: putBucketLifecycle, deleteBucketLifecycle: deleteBucketLifecycle, - putBucketVersioning: putBucketVersioning, + putBucketVersioning: putBucketVersioning, // BucketVersioning getBucketVersioning: getBucketVersioning, - putBucketReplication: putBucketReplication, + putBucketReplication: putBucketReplication, // BucketReplication getBucketReplication: getBucketReplication, deleteBucketReplication: deleteBucketReplication, + putBucketWebsite: putBucketWebsite, // BucketWebsite + getBucketWebsite: getBucketWebsite, + deleteBucketWebsite: deleteBucketWebsite, // Object 相关方法 getObject: getObject, diff --git a/src/cos.js b/src/cos.js index fcd3d16..b966360 100644 --- a/src/cos.js +++ b/src/cos.js @@ -59,6 +59,6 @@ base.init(COS, task); advance.init(COS, task); COS.getAuthorization = util.getAuth; -COS.version = '0.5.20'; +COS.version = '0.5.21'; module.exports = COS; diff --git a/test/test.js b/test/test.js index ce0a6e2..0c34b20 100644 --- a/test/test.js +++ b/test/test.js @@ -190,7 +190,6 @@ var request = function (opt, callback) { }; var proxy = ''; - var cos = new COS({ // 必选参数 getAuthorization: getAuthorization,